db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r1592630 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java
Date Mon, 05 May 2014 21:01:53 GMT
Author: myrnavl
Date: Mon May  5 21:01:52 2014
New Revision: 1592630

URL: http://svn.apache.org/r1592630
Log:
DERBY-6502; Failure in OnlineCompressTest
   adding calls to wait for post commit tasks in the hope of addressing instability in OnlineCompressTest.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java?rev=1592630&r1=1592629&r2=1592630&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java
Mon May  5 21:01:52 2014
@@ -523,6 +523,8 @@ public class OnlineCompressTest extends 
         ret_before = getSpaceInfo(conn, "APP", table_name, true);
         executeQuery(conn, "delete from " + table_name, true);
 
+        callWaitForPostCommit(conn);
+
         if (verbose)
             testProgress("deleted all rows, now calling compress.");
 
@@ -598,6 +600,8 @@ public class OnlineCompressTest extends 
         ret_before = getSpaceInfo(conn, "APP", table_name, true);
         executeQuery(conn, "delete from " + table_name, true);
 
+        callWaitForPostCommit(conn);
+
         if (verbose)
             testProgress("deleted all rows, now calling compress.");
 
@@ -768,6 +772,8 @@ public class OnlineCompressTest extends 
         // delete all rows and commit.
         executeQuery(conn, "delete from " + table_name, true);
 
+        callWaitForPostCommit(conn);
+
         // compress all space and commit.
         callCompress(conn, "APP", table_name, true, true, true, true);
 
@@ -827,6 +833,8 @@ public class OnlineCompressTest extends 
         // results.
         conn.commit();
 
+        callWaitForPostCommit(conn);
+
         // check the table.  Note that this will accumulate locks and
         // will commit the transaction.
         if (!checkConsistency(conn, schemaName, table_name))
@@ -1161,6 +1169,8 @@ public class OnlineCompressTest extends 
         executeQuery(
             conn, "delete from " + table_name + " where onehalf = 0", true);
 
+        callWaitForPostCommit(conn);
+
         if (verbose)
             testProgress("deleted every other row, now calling compress.");
 
@@ -1195,6 +1205,8 @@ public class OnlineCompressTest extends 
         executeQuery(
             conn, "delete from " + table_name + " where onethird = 0", true);
 
+        callWaitForPostCommit(conn);
+
         if (verbose)
             testProgress("deleted every third row, now calling compress.");
 
@@ -1229,6 +1241,8 @@ public class OnlineCompressTest extends 
             conn, "delete from " + table_name + " where keycol > " + 
             (num_rows / 2), true);
 
+        callWaitForPostCommit(conn);
+
         if (verbose)
             testProgress("deleted top half of the rows, now calling compress.");
 
@@ -1273,6 +1287,8 @@ public class OnlineCompressTest extends 
         executeQuery(
             conn, "delete from " + table_name + " where keycol < 500 ", true);
 
+        callWaitForPostCommit(conn);
+
         if (verbose)
             testProgress("deleted keys < 500, now calling compress.");
 
@@ -1405,6 +1421,9 @@ public class OnlineCompressTest extends 
         // delete all the rows.
         ret_before = getSpaceInfo(conn, "APP", table_name, true);
         executeQuery(conn, "delete from " + table_name, true);
+
+        callWaitForPostCommit(conn);
+
         conn.commit();
 
         if (verbose)
@@ -1478,6 +1497,8 @@ public class OnlineCompressTest extends 
         executeQuery(
             conn, "delete from " + table_name + " where keycol < 1000", true);
 
+        callWaitForPostCommit(conn);
+
         conn.commit();
 
         if (verbose)
@@ -1504,6 +1525,15 @@ public class OnlineCompressTest extends 
         test7(conn, "test7", "TEST7");
     }
 
+    public static void callWaitForPostCommit(Connection conn) 
+            throws SQLException {
+        CallableStatement cstmt = 
+                conn.prepareCall(
+                    "call wait_for_post_commit()");
+        cstmt.execute();
+        cstmt.close();
+    }
+    
     public static void main(String[] argv) 
         throws Throwable
     {
@@ -1511,7 +1541,19 @@ public class OnlineCompressTest extends 
 
    		ij.getPropertyArg(argv); 
         Connection conn = ij.startJBMS();
+        
+        Statement stmt = conn.createStatement();
+        // Create a procedure to be called before checking on contents
+        // to ensure that the background worker thread has completed 
+        // all the post-commit work.
+        stmt.execute(
+            "CREATE PROCEDURE WAIT_FOR_POST_COMMIT() " +
+            "LANGUAGE JAVA EXTERNAL NAME " +
+            "'org.apache.derbyTesting.functionTests.util." +
+            "T_Access.waitForPostCommitToFinish' " +
+            "PARAMETER STYLE JAVA");
         conn.setAutoCommit(false);
+        stmt.close();
 
         try
         {



Mime
View raw message