Permalink
Browse files

Improve logging for failed read-only store swap.

  • Loading branch information...
1 parent 9739693 commit bc91ded25eda6031ecb592f8bc138609a64c8d3f @jkreps jkreps committed Jun 20, 2009
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/java/voldemort/store/readonly/ReadOnlyStorageEngine.java
@@ -178,7 +178,8 @@ public void swapFiles(String newStoreDirectory) {
// copy in new files
logger.info("Setting primary files for store '" + getName() + "' to "
+ newStoreDirectory);
- success = newDataDir.renameTo(new File(storeDir, "version-0"));
+ File destDir = new File(storeDir, "version-0");
+ success = newDataDir.renameTo(destDir);
// open the new store
if(success) {
@@ -188,6 +189,9 @@ public void swapFiles(String newStoreDirectory) {
logger.error(e);
success = false;
}
+ } else {
+ logger.error("Renaming " + newDataDir.getAbsolutePath() + " to "
+ + destDir.getAbsolutePath() + " failed!");
}
} finally {
try {
@@ -196,7 +200,11 @@ public void swapFiles(String newStoreDirectory) {
rollback();
} finally {
fileModificationLock.writeLock().unlock();
- logger.info("Swap operation completed on '" + getName() + "', releasing lock.");
+ if(success)
+ logger.info("Swap operation completed successfully on store " + getName()
+ + ", releasing lock.");
+ else
+ logger.error("Swap operation failed.");
}
}
// okay we have released the lock and the store is now open again, it is

0 comments on commit bc91ded

Please sign in to comment.