You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ma...@apache.org on 2012/09/21 22:56:01 UTC
svn commit: r1388678 - in /db/derby/code/branches/10.6: ./
java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
Author: mamta
Date: Fri Sep 21 20:56:01 2012
New Revision: 1388678
URL: http://svn.apache.org/viewvc?rev=1388678&view=rev
Log:
DERBY-5358 (SYSCS_COMPRESS_TABLE failed with conglomerate not found exception)
Backporting to 10.6
Modified:
db/derby/code/branches/10.6/ (props changed)
db/derby/code/branches/10.6/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
Propchange: db/derby/code/branches/10.6/
------------------------------------------------------------------------------
Merged /db/derby/code/trunk:r1354015
Merged /db/derby/code/branches/10.8:r1359059
Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java?rev=1388678&r1=1388677&r2=1388678&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java (original)
+++ db/derby/code/branches/10.6/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java Fri Sep 21 20:56:01 2012
@@ -113,7 +113,26 @@ public class TableDescriptor extends Tup
String tableName;
UUID oid;
int tableType;
- long heapConglomNumber = -1;
+
+ /**
+ * <p>
+ * The id of the heap conglomerate for the table described by this
+ * instance. The value -1 means it's uninitialized, in which case it
+ * will be initialized lazily when {@link #getHeapConglomerateId()} is
+ * called.
+ * </p>
+ *
+ * <p>
+ * It is declared volatile to ensure that concurrent callers of
+ * {@code getHeapConglomerateId()} while {@code heapConglomNumber} is
+ * uninitialized, will either see the value -1 or the fully initialized
+ * conglomerate number, and never see a partially initialized value
+ * (as was the case in DERBY-5358 because reads/writes of a long field are
+ * not guaranteed to be atomic unless the field is declared volatile).
+ * </p>
+ */
+ private volatile long heapConglomNumber = -1;
+
ColumnDescriptorList columnDescriptorList;
ConglomerateDescriptorList conglomerateDescriptorList;
ConstraintDescriptorList constraintDescriptorList;
@@ -307,8 +326,6 @@ public class TableDescriptor extends Tup
public long getHeapConglomerateId()
throws StandardException
{
- DataDictionary dd = getDataDictionary();
-
ConglomerateDescriptor cd = null;
/* If we've already cached the heap conglomerate number, then