db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r1526664 - in /db/derby/code/branches/10.10: ./ java/testing/org/apache/derbyTesting/functionTests/tests/store/IndexSplitDeadlockTest.java
Date Thu, 26 Sep 2013 20:06:07 GMT
Author: kmarsden
Date: Thu Sep 26 20:06:06 2013
New Revision: 1526664

URL: http://svn.apache.org/r1526664
Log:
DERBY-6146 testMultipleLastKeyWaitsInMaxScan(org.apache.derbyTesting.functionTests.tests.store.IndexSplitDeadlockTest)junit.framework.AssertionFailedError:
Column value mismatch @ column '1',

merge revision 1526569 from trunk


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

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

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/IndexSplitDeadlockTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/IndexSplitDeadlockTest.java?rev=1526664&r1=1526663&r2=1526664&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/IndexSplitDeadlockTest.java
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/IndexSplitDeadlockTest.java
Thu Sep 26 20:06:06 2013
@@ -649,9 +649,14 @@ public class IndexSplitDeadlockTest exte
         });
 
         // Give the other thread a little while to start and obtain the
-        // lock on the last record.
-        Thread.sleep(1000);
-
+        // lock on the last record. We expect two locks in the lock table
+        // when the other thread is ready. Don't wait more than a minute
+        // as something must have gone wrong.
+        int totalWait = 0;
+        do {
+            totalWait += 500;
+            Thread.sleep(500);
+        } while (numlocks() < 2 && totalWait < 60000);
         // The last record should be locked now, so this call will have to
         // wait initially. This statement used to cause an assert failure in
         // debug builds before DERBY-4193.
@@ -662,6 +667,20 @@ public class IndexSplitDeadlockTest exte
     }
 
     /**
+     * Get the number of locks in the lock table 
+     * @return number of locks
+     * @throws SQLException
+     */
+    private int numlocks() throws SQLException {
+        Statement s = createStatement();
+        ResultSet rs = s.executeQuery("SELECT count(*) from syscs_diag.lock_table");
+        rs.next();
+        int num = rs.getInt(1);
+        rs.close();
+        return num;
+    }
+    
+    /**
      * Test that a forward scan works even in the case that it has to wait
      * for the previous key lock more than once. This used to cause an assert
      * failure in sane builds before DERBY-4193.



Mime
View raw message