db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1388565 - in /db/derby/code/branches/10.7: ./ java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
Date Fri, 21 Sep 2012 16:25:54 GMT
Author: mamta
Date: Fri Sep 21 16:25:54 2012
New Revision: 1388565

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

Backporting to 10.7


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

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

Modified: db/derby/code/branches/10.7/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java?rev=1388565&r1=1388564&r2=1388565&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
(original)
+++ db/derby/code/branches/10.7/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
Fri Sep 21 16:25:54 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



Mime
View raw message