db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1006332 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LargeDataLocksTest.java
Date Sun, 10 Oct 2010 18:24:47 GMT
Author: kahatlen
Date: Sun Oct 10 18:24:47 2010
New Revision: 1006332

URL: http://svn.apache.org/viewvc?rev=1006332&view=rev
Log:
DERBY-4825: Assert failure in LargeDataLocksTest.testGetCharacterStream()
because of wrong number of locks

Wait for background thread to complete post-commit work before
counting the locks, so that the locks it obtains don't intermittently
show up in the lock table.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LargeDataLocksTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LargeDataLocksTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LargeDataLocksTest.java?rev=1006332&r1=1006331&r2=1006332&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LargeDataLocksTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LargeDataLocksTest.java
Sun Oct 10 18:24:47 2010
@@ -150,6 +150,11 @@ public class LargeDataLocksTest extends 
         // make the default connection auto-commit and release locks.
         Connection conn = openDefaultConnection();
         Statement stmt = conn.createStatement();
+
+        // First wait for post-commit work to complete so that we don't count
+        // locks held by the background worker thread.
+        stmt.execute("call wait_for_post_commit()");
+
         ResultSet rs = stmt.executeQuery("select * from syscs_diag.lock_table");
         ResultSetMetaData meta = rs.getMetaData();
 
@@ -210,6 +215,16 @@ public class LargeDataLocksTest extends 
                 ps.setInt(3, 38000);
                 ps.executeUpdate();
                 ps.close();
+
+                // Create a procedure for use by assertLockCount() to ensure
+                // that the background worker thread has completed all the
+                // post-commit work.
+                s.execute("CREATE PROCEDURE WAIT_FOR_POST_COMMIT() "
+                        + "LANGUAGE JAVA EXTERNAL NAME "
+                        + "'org.apache.derbyTesting.functionTests.util."
+                        + "T_Access.waitForPostCommitToFinish' "
+                        + "PARAMETER STYLE JAVA");
+
                 conn.commit();
             }
         };



Mime
View raw message