You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by mi...@apache.org on 2012/01/26 20:59:44 UTC
svn commit: r1236370 -
/db/derby/code/trunk/java/engine/org/apache/derby/impl/io/DirFile.java
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.
*
- *<p>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.
+ *
+ * <p>
+ * 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);
}
/**