db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1334313 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
Date Sat, 05 May 2012 04:22:03 GMT
Author: kristwaa
Date: Sat May  5 04:22:01 2012
New Revision: 1334313

URL: http://svn.apache.org/viewvc?rev=1334313&view=rev
Log:
DERBY-5686: multiple intermittent errors in nightly tests during DriverMgrAuthenticationTest
test. reason: An SQL data change is not permitted for a read-only connection, user or database.

Make assertDirectoryDeleted accept if the root directory disappears under it
even if it couldn't delete all the files inside. The prime example is when
db.lck is the only file that can't be deleted. The reason is that Derby hasn't
shut down before the deletion of the database directory starts. Depending on
timing, assertDirectoryDeleted may be able to delete all files (including the
root directory) except the lock file, and the lock file is deleted by Derby
itself.

This patch doesn't fix this JIRA issue, it's a general improvement to the
deletion logic only.

Patch file: DERBY-5686_3.diff

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java?rev=1334313&r1=1334312&r2=1334313&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java Sat
May  5 04:22:01 2012
@@ -1525,8 +1525,16 @@ public abstract class BaseJDBCTestCase
                 fl = PrivilegedFileOpsForTests.persistentRecursiveDelete(dir);
                 attempts++;
             } catch (FileNotFoundException fnfe) {
-                fail("directory doesn't exist: " +
+                if (attempts == 0) {
+                    fail("directory doesn't exist: " +
                         PrivilegedFileOpsForTests.getAbsolutePath(dir));
+                } else {
+                    // In the previous iteration we saw remaining files, but
+                    // now the root directory is gone. Not what we expected...
+                    System.out.println("<assertDirectoryDeleted> root " +
+                            "directory unexpectedly gone - delayed, " +
+                            "external or concurrent delete?");
+                }
             }
             if (fl.length == 0) {
                 return;



Mime
View raw message