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 ka...@apache.org on 2012/07/09 13:06:05 UTC

svn commit: r1359059 - in /db/derby/code/branches/10.8: ./ java/client/org/apache/derby/client/net/NetCursor.java java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java

Author: kahatlen
Date: Mon Jul  9 11:06:05 2012
New Revision: 1359059

URL: http://svn.apache.org/viewvc?rev=1359059&view=rev
Log:
DERBY-5358: SYSCS_COMPRESS_TABLE failed with conglomerate not found exception

Backported revision 1354015 from trunk.

Modified:
    db/derby/code/branches/10.8/   (props changed)
    db/derby/code/branches/10.8/java/client/org/apache/derby/client/net/NetCursor.java   (props changed)
    db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java

Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1354015

Propchange: db/derby/code/branches/10.8/java/client/org/apache/derby/client/net/NetCursor.java
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java:r1354015

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java?rev=1359059&r1=1359058&r2=1359059&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java (original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java Mon Jul  9 11:06:05 2012
@@ -142,7 +142,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;
@@ -336,8 +355,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