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 my...@apache.org on 2014/10/07 19:04:34 UTC

svn commit: r1629929 - in /db/derby/code/branches/10.10: ./ java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java

Author: myrnavl
Date: Tue Oct  7 17:04:34 2014
New Revision: 1629929

URL: http://svn.apache.org/r1629929
Log:
DERBY-6502; Failure in OnlineCompressTest
  merge of revision 1592630 from trunk; adding wait for post commit calls

Modified:
    db/derby/code/branches/10.10/   (props changed)
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java

Propchange: db/derby/code/branches/10.10/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1592630

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java?rev=1629929&r1=1629928&r2=1629929&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java (original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java Tue Oct  7 17:04:34 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
         {