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 BC972924D for ; Thu, 26 Jan 2012 20:00:09 +0000 (UTC) Received: (qmail 39002 invoked by uid 500); 26 Jan 2012 20:00:09 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 38945 invoked by uid 500); 26 Jan 2012 20:00:09 -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 38937 invoked by uid 99); 26 Jan 2012 20:00:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jan 2012 20:00:08 +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; Thu, 26 Jan 2012 20:00:06 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id CFD1323888FE; Thu, 26 Jan 2012 19:59:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1236370 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/io/DirFile.java Date: Thu, 26 Jan 2012 19:59:44 -0000 To: derby-commits@db.apache.org From: mikem@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120126195944.CFD1323888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mikem Date: Thu Jan 26 19:59:44 2012 New Revision: 1236370 URL: http://svn.apache.org/viewvc?rev=1236370&view=rev Log: DERBY-5574 encryption test in encryption nightly suite test fails with ERROR XBM0S: Unable to rename file error Catch errors on rename, and retry hoping that error is caused by some temporary file system resource issue. Similar methodology that other parts of the system uses on read and write errors. Worst case system retries 5 times and still throws the error, best case a subsequent retry succeeds and user application is never aware an error was encountered. Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/io/DirFile.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/io/DirFile.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/io/DirFile.java?rev=1236370&r1=1236369&r2=1236370&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/io/DirFile.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/io/DirFile.java Thu Jan 26 19:59:44 2012 @@ -39,6 +39,7 @@ import java.net.URL; import java.security.AccessControlException; import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.services.io.FileUtil; +import org.apache.derby.iapi.util.InterruptStatus; import org.apache.derby.shared.common.reference.SQLState; /** @@ -230,12 +231,16 @@ class DirFile extends File implements St } // end of getRandomAccessFile /** - * Rename the file denoted by this name. Note that StorageFile objects are immutable. This method - * renames the underlying file, it does not change this StorageFile object. The StorageFile object denotes the - * same name as before, however the exists() method will return false after the renameTo method - * executes successfully. + * Rename the file denoted by this name. * - *

It is not specified whether this method will succeed if a file already exists under the new name. + * Note that StorageFile objects are immutable. This method renames the + * underlying file, it does not change this StorageFile object. The + * StorageFile object denotes the same name as before, however the exists() + * method will return false after the renameTo method executes successfully. + * + *

+ * It is not specified whether this method will succeed if a file + * already exists under the new name. * * @param newName the new name. * @@ -243,7 +248,30 @@ class DirFile extends File implements St */ public boolean renameTo( StorageFile newName) { - return super.renameTo( (File) newName); + boolean rename_status = super.renameTo( (File) newName); + int retry_count = 1; + + while (!rename_status && (retry_count <= 5)) + { + // retry operation, hoping a temporary I/O resource issue is + // causing the failure. + + try + { + Thread.sleep(1000 * retry_count); + } + catch (InterruptedException ie) + { + // This thread received an interrupt as well, make a note. + InterruptStatus.setInterrupted(); + } + + rename_status = super.renameTo((File) newName); + + retry_count++; + } + + return(rename_status); } /**