db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r1562544 - in /db/derby/code/branches/10.8: ./ java/client/org/apache/derby/client/net/NetCursor.java java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_derby715.java
Date Wed, 29 Jan 2014 18:44:47 GMT
Author: myrnavl
Date: Wed Jan 29 18:44:46 2014
New Revision: 1562544

URL: http://svn.apache.org/r1562544
Log:
DERBY-3624; testfailure in storetests/st_derby715 with ibm 1.5 on iseries machine; one deadlock
message missing
DERBY-5692; intermittent test failure in storetests/st_derby715.java
   merge of revision 1530796 from 10.10 branch

Modified:
    db/derby/code/branches/10.8/   (props changed)
    db/derby/code/branches/10.8/java/client/org/apache/derby/client/net/NetCursor.java   (props
changed)
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_derby715.java

Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1530696
  Merged /db/derby/code/branches/10.10:r1530796

Propchange: db/derby/code/branches/10.8/java/client/org/apache/derby/client/net/NetCursor.java
------------------------------------------------------------------------------
  Merged /db/derby/code/branches/10.10/java/client/org/apache/derby/client/net/NetCursor.java:r1530796

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_derby715.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_derby715.java?rev=1562544&r1=1562543&r2=1562544&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_derby715.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_derby715.java
Wed Jan 29 18:44:46 2014
@@ -40,7 +40,7 @@ import org.apache.derby.tools.ij;
 
 The purpose of this test is to reproduce JIRA DERBY-715:
 
-Sometimes a deadlock would be incorrectly reported as a deadlock.  The
+Sometimes a deadlock would be incorrectly reported as a timeout.  The
 bug seemed to always reproduce at least once if the following test
 was run (at least one of the iterations in the loop would get an
 incorrect timeout vs. a deadlock).
@@ -129,7 +129,7 @@ public class st_derby715 extends BaseTes
                     System.out.println("Thread 1 after all next.");
 
                 // give thread 2 a chance to catch up.
-                Thread.sleep(500);
+                waitForLocks(conn, 2);
 
                 if (verbose)
                     System.out.println("Thread 1 before inserting into a...");
@@ -204,10 +204,8 @@ public class st_derby715 extends BaseTes
 
                 if (verbose)
                     System.out.println("Thread 2 after all next.");
+                waitForLocks(conn,2);
 
-
-                Thread.sleep(500);
-                
                 if (verbose)
                     System.out.println("Thread 2 before inserting into b");
 
@@ -245,7 +243,34 @@ public class st_derby715 extends BaseTes
         }
     }
     
-
+    /**
+     * Wait for a specified number of locks before continuing
+     *
+     * @param conn Connection to use for lock query
+     * @param num  Number of locks to check for
+     */
+    private static void waitForLocks(Connection conn, int num) throws InterruptedException,
SQLException {
+        int totalWait = 0;
+        do {
+            totalWait += 500;
+            Thread.sleep(500);
+        } while (numlocks(conn) < num && totalWait < 60000);
+       
+    }
+    /**
+     * Get the number of locks in the lock table 
+     * @return number of locks
+     * @throws SQLException
+     */
+    private static int numlocks(Connection conn) throws SQLException {
+        Statement s = conn.createStatement();
+        ResultSet rs = s.executeQuery("SELECT count(*) from syscs_diag.lock_table");
+        rs.next();
+        int num = rs.getInt(1);
+        rs.close();
+        return num;
+    }
+    
     public void testList(Connection conn)
         throws SQLException
     {



Mime
View raw message