db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
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 GMT
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 <em>does not</em> 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)";



Mime
View raw message