Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F3099D6C9 for ; Mon, 9 Jul 2012 11:05:38 +0000 (UTC) Received: (qmail 15145 invoked by uid 500); 9 Jul 2012 11:05:38 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 15112 invoked by uid 500); 9 Jul 2012 11:05:38 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 15105 invoked by uid 99); 9 Jul 2012 11:05:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Jul 2012 11:05:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Jul 2012 11:05:37 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id DFE522388962; Mon, 9 Jul 2012 11:05:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1359058 - in /db/derby/code/branches/10.9: ./ java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java Date: Mon, 09 Jul 2012 11:05:17 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120709110517.DFE522388962@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kahatlen Date: Mon Jul 9 11:05:17 2012 New Revision: 1359058 URL: http://svn.apache.org/viewvc?rev=1359058&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.9/ (props changed) db/derby/code/branches/10.9/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java Propchange: db/derby/code/branches/10.9/ ------------------------------------------------------------------------------ Merged /db/derby/code/trunk:r1354015 Modified: db/derby/code/branches/10.9/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java?rev=1359058&r1=1359057&r2=1359058&view=diff ============================================================================== --- db/derby/code/branches/10.9/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java (original) +++ db/derby/code/branches/10.9/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java Mon Jul 9 11:05:17 2012 @@ -142,7 +142,26 @@ public class TableDescriptor extends Tup String tableName; UUID oid; int tableType; - long heapConglomNumber = -1; + + /** + *

+ * 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. + *

+ * + *

+ * 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). + *

+ */ + 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