Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 82976 invoked from network); 4 Apr 2011 08:01:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Apr 2011 08:01:23 -0000 Received: (qmail 15416 invoked by uid 500); 4 Apr 2011 08:01:23 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 15393 invoked by uid 500); 4 Apr 2011 08:01:23 -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 15386 invoked by uid 99); 4 Apr 2011 08:01:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Apr 2011 08:01:22 +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, 04 Apr 2011 08:01:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2B6D12388A36; Mon, 4 Apr 2011 08:01:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1088495 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java Date: Mon, 04 Apr 2011 08:01:00 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110404080100.2B6D12388A36@eris.apache.org> Author: kahatlen Date: Mon Apr 4 08:00:59 2011 New Revision: 1088495 URL: http://svn.apache.org/viewvc?rev=1088495&view=rev Log: DERBY-5153: Intermittent ASSERT FAILED Internal Error-- statistics not found in selectivityForConglomerate when running InterruptResilienceTest Removed the failing asserts and enabled the test case that exercises the code. Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java?rev=1088495&r1=1088494&r2=1088495&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java Mon Apr 4 08:00:59 2011 @@ -1396,6 +1396,9 @@ public class TableDescriptor extends Tup * numKeys. This basically returns the reciprocal of the number of unique * values in the leading numKey columns of the index. It is assumed that * statistics exist for the conglomerate if this function is called. + * However, no locks are held to prevent the statistics from being dropped, + * so the method also handles the case of missing statistics by using a + * heuristic to estimate the selectivity. * * @param cd ConglomerateDescriptor (Index) whose * cardinality we are interested in. @@ -1407,22 +1410,6 @@ public class TableDescriptor extends Tup int numKeys) throws StandardException { - if (!statisticsExist(cd)) - { - if (SanityManager.DEBUG) - { - SanityManager.THROWASSERT("no statistics exist for conglomerate" - + cd); - } - else - { - double selectivity = 0.1; - for (int i = 0; i < numKeys; i++) - selectivity *= 0.1; - return selectivity; - } - } - UUID referenceUUID = cd.getUUID(); List sdl = getStatistics(); @@ -1438,10 +1425,10 @@ public class TableDescriptor extends Tup return statDesc.getStatistic().selectivity((Object[])null); } - - if (SanityManager.DEBUG) - SanityManager.THROWASSERT("Internal Error-- statistics not found in selectivityForConglomerate.\n cd = " + cd + "\nnumKeys = " + numKeys); - return 0.1; // shouldn't come here. + + // Didn't find statistics for these columns. Assume uniform 10% + // selectivity for each column in the key. + return Math.pow(0.1, numKeys); } /** @see TupleDescriptor#getDescriptorName */ Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java?rev=1088495&r1=1088494&r2=1088495&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java Mon Apr 4 08:00:59 2011 @@ -214,10 +214,8 @@ public class UpdateStatisticsTest extend /** * Regression test case for DERBY-5153. Compilation in parallel with * update of statistics sometimes failed on debug builds. - * - * The test case should be disabled until the bug is fixed. */ - public void disabled_testParallelCompilationAndUpdate() throws Exception { + public void testParallelCompilationAndUpdate() throws Exception { setAutoCommit(false); // Create and populate a test table with a multi-column index.