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 DC0FE9A24 for ; Mon, 18 Jun 2012 06:47:53 +0000 (UTC) Received: (qmail 30084 invoked by uid 500); 18 Jun 2012 06:47:53 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 30007 invoked by uid 500); 18 Jun 2012 06:47:53 -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 29985 invoked by uid 99); 18 Jun 2012 06:47:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jun 2012 06:47:52 +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, 18 Jun 2012 06:47:51 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0D865238896F; Mon, 18 Jun 2012 06:47:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1351215 - in /db/derby/code/branches/10.9: ./ java/testing/org/apache/derbyTesting/functionTests/tests/lang/ java/testing/org/apache/derbyTesting/functionTests/tests/memorydb/ java/testing/org/apache/derbyTesting/junit/ Date: Mon, 18 Jun 2012 06:47:30 -0000 To: derby-commits@db.apache.org From: kristwaa@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120618064731.0D865238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kristwaa Date: Mon Jun 18 06:47:30 2012 New Revision: 1351215 URL: http://svn.apache.org/viewvc?rev=1351215&view=rev Log: DERBY-5797: AssertionFailedError in functionTests.tests.lang.UpdateStatisticsTest.testDisposableStatsEagerness Merged fix from trunk (revision 1347888). Modified: db/derby/code/branches/10.9/ (props changed) db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.java db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/memorydb/DropWhileConnectingTest.java db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Propchange: db/derby/code/branches/10.9/ ------------------------------------------------------------------------------ Merged /db/derby/code/trunk:r1347888 Modified: db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.java?rev=1351215&r1=1351214&r2=1351215&view=diff ============================================================================== --- db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.java (original) +++ db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.java Mon Jun 18 06:47:30 2012 @@ -332,15 +332,6 @@ public class SecurityPolicyReloadingTest } /** - * A handy method for debugging. - */ - public static void sleep( long numberOfSeconds ) - throws Exception - { - Thread.currentThread().sleep( numberOfSeconds * (1000L) ); - } - - /** * Try to change the policy file. */ private void changePolicyFile( Connection conn, String newPolicyFileName, boolean shouldSucceed, String expectedSQLState ) Modified: db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java?rev=1351215&r1=1351214&r2=1351215&view=diff ============================================================================== --- db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java (original) +++ db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java Mon Jun 18 06:47:30 2012 @@ -559,14 +559,10 @@ public class UpdateStatisticsTest extend stats.assertNoStatsTable(tbl_fk); stats.assertTableStats(tbl, 4); IndexStatsUtil.IdxStats[] tbl_stats_0 = stats.getStatsTable(tbl); - // Avoid timestamp comparison problems on super-fast machines... - try { - Thread.sleep(10); - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - } // Run the update statistics procedure. + // Sleep at least one tick to ensure the timestamps differ. + sleepAtLeastOneTick(); ps = prepareStatement( "call syscs_util.syscs_update_statistics('APP', ?, ?)"); ps.setNull(2, Types.VARCHAR); @@ -586,6 +582,7 @@ public class UpdateStatisticsTest extend } // Now make sure updating one index doesn't modify the others' stats. + sleepAtLeastOneTick(); ps.setString(1, tbl); ps.setString(2, nuIdx); ps.execute(); Modified: db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/memorydb/DropWhileConnectingTest.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/memorydb/DropWhileConnectingTest.java?rev=1351215&r1=1351214&r2=1351215&view=diff ============================================================================== --- db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/memorydb/DropWhileConnectingTest.java (original) +++ db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/memorydb/DropWhileConnectingTest.java Mon Jun 18 06:47:30 2012 @@ -103,21 +103,6 @@ public class DropWhileConnectingTest println(report.toString()); } - /** - * Puts the current thread to sleep, but does not guarantee - * that the thread sleeps for the specified amount of time (interrupts are - * not handled). - * - * @param millis number of milliseconds to sleep - */ - private static void sleep(long millis) { - try { - Thread.sleep(millis); - } catch (InterruptedException ie) { - alarm("sleep call interrupted"); - } - } - public static Test suite() { return new TestSuite(DropWhileConnectingTest.class); } Modified: db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1351215&r1=1351214&r2=1351215&view=diff ============================================================================== --- db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original) +++ db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Mon Jun 18 06:47:30 2012 @@ -915,6 +915,24 @@ public abstract class BaseTestCase assertExecJavaCmdAsExpected(new String[] { "OK (1 test)" }, cmd, 0); } + /** Returns once the system timer has advanced at least one tick. */ + public static void sleepAtLeastOneTick() { + long currentTime = System.currentTimeMillis(); + while (System.currentTimeMillis() == currentTime) { + sleep(1); + } + } + + /** Makes the current thread sleep up to {@code ms} milliseconds. */ + public static void sleep(long ms) { + try { + Thread.sleep(ms); + } catch (InterruptedException ie) { + // For now we just print a warning if we are interrupted. + alarm("sleep interrupted"); + } + } + private static String traceClientType() { if (TestConfiguration.getCurrent().getJDBCClient().isEmbedded()) { return "(emb)";