Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 85B8210859 for ; Wed, 9 Oct 2013 21:17:19 +0000 (UTC) Received: (qmail 12142 invoked by uid 500); 9 Oct 2013 21:17:18 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 12093 invoked by uid 500); 9 Oct 2013 21:17:17 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 12080 invoked by uid 99); 9 Oct 2013 21:17:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Oct 2013 21:17:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Oct 2013 21:17:15 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 288E423888E4; Wed, 9 Oct 2013 21:16:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1530796 - in /db/derby/code/branches/10.10: ./ java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_derby715.java Date: Wed, 09 Oct 2013 21:16:55 -0000 To: derby-commits@db.apache.org From: kmarsden@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131009211655.288E423888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kmarsden Date: Wed Oct 9 21:16:54 2013 New Revision: 1530796 URL: http://svn.apache.org/r1530796 Log: DERBY-3624 testfailure in storetests/st_derby715 with ibm 1.5 on iseries machine; one deadlock message missing merge revision 1530696 from trunk Modified: db/derby/code/branches/10.10/ (props changed) db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_derby715.java Propchange: db/derby/code/branches/10.10/ ------------------------------------------------------------------------------ Merged /db/derby/code/trunk:r1530696 Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_derby715.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_derby715.java?rev=1530796&r1=1530795&r2=1530796&view=diff ============================================================================== --- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_derby715.java (original) +++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_derby715.java Wed Oct 9 21:16:54 2013 @@ -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 {