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 2013/07/17 00:01:47 UTC
svn commit: r1503919 - in /db/derby/code/branches/10.8: ./
java/testing/org/apache/derbyTesting/functionTests/tests/lang/
java/testing/org/apache/derbyTesting/functionTests/tests/memorydb/
java/testing/org/apache/derbyTesting/junit/
Author: mamta
Date: Tue Jul 16 22:01:46 2013
New Revision: 1503919
URL: http://svn.apache.org/r1503919
Log:
DERBY-5797: AssertionFailedError in functionTests.tests.lang.UpdateStatisticsTest.testDisposableStatsEagerness
Backporting from trunk(revision 1347888) into 10.8. The fix was contributed by Knut.
Modified:
db/derby/code/branches/10.8/ (props changed)
db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.java
db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java
db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/memorydb/DropWhileConnectingTest.java
db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
Merged /db/derby/code/trunk:r1347888
Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.java?rev=1503919&r1=1503918&r2=1503919&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.java (original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.java Tue Jul 16 22:01:46 2013
@@ -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.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java?rev=1503919&r1=1503918&r2=1503919&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java (original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java Tue Jul 16 22:01:46 2013
@@ -444,14 +444,10 @@ public class UpdateStatisticsTest extend
IndexStatsUtil.IdxStats tbl_fk_pk_0 = stats.getStatsTable(tbl_fk)[0];
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);
@@ -473,6 +469,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.8/java/testing/org/apache/derbyTesting/functionTests/tests/memorydb/DropWhileConnectingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/memorydb/DropWhileConnectingTest.java?rev=1503919&r1=1503918&r2=1503919&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/memorydb/DropWhileConnectingTest.java (original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/memorydb/DropWhileConnectingTest.java Tue Jul 16 22:01:46 2013
@@ -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.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1503919&r1=1503918&r2=1503919&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Tue Jul 16 22:01:46 2013
@@ -834,6 +834,24 @@ public abstract class BaseTestCase
throw ae;
}
+ /** 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)";