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/22 03:08:31 UTC

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

Author: mamta
Date: Sat Sep 22 01:08:31 2012
New Revision: 1388730

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

Backporting to 10.5


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

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

Propchange: db/derby/code/branches/10.5/java/
------------------------------------------------------------------------------
  Merged /db/derby/code/branches/10.8/java:r1359059

Propchange: db/derby/code/branches/10.5/java/client/org/apache/derby/client/net/NetCursor.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Sep 22 01:08:31 2012
@@ -0,0 +1,4 @@
+/db/derby/code/branches/10.6/java/client/org/apache/derby/client/net/NetCursor.java:942027,957000,957287,958621,962738,965351,987678,1031623,1055601,1068474,1071167,1304470,1365674
+/db/derby/code/branches/10.7/java/client/org/apache/derby/client/net/NetCursor.java:1294731,1303263,1336809,1383996,1386854
+/db/derby/code/branches/10.8/java/client/org/apache/derby/client/net/NetCursor.java:1209227-1209228,1209284,1359059
+/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java:757811,764912,769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,791027,792001,792254,792434,793089,793588,794106,794276,794303,794955,795166,795459,796020,796027,796316,796372,797147,798347,798742,800523,803336,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,826263,827505,829022,829410,830545,831304,831319,832379,833430,835286,881074,881444,882732,884163,885421,885659,887246,888311,891350,892912,897161,898635,901165,901648,901760,902857,903108,905224,908418,908586,909176,910481,910511,911315,911793,915177,915733,916075,916897,917771,918152,918359,921028,927430,928065,929085,931076,934474,936215,938959,940462,940469,942286,942476,942480,942587,946794,948045,948069,951346,951366,952138,952237,952581,954748,955001,955634,956075,956445,956659,957
 260,958163,958618,959550,961892,962716,964039,964402,965647,966393,967201,967304,980089,980684,986689,986834,987539,989099,998170,999119,999485,1002291,1002682,1002853,1005347,1021426,1024511,1024528,1025615,1025795,1030043,1031559,1040658,1041374,1042537,1053724,1055169,1062096,1063809,1065061,1067250,1069661,1071318,1071886,1081455,1085078,1096991,1136363,1138341,1138444,1140744,1141924,1210846,1294512,1354015,1371041,1378206

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java?rev=1388730&r1=1388729&r2=1388730&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java (original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java Sat Sep 22 01:08:31 2012
@@ -109,7 +109,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;
@@ -339,8 +358,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