summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2011-10-25 22:57:35 +0000
committerChris Wilson <chris+github@qwirx.com>2011-10-25 22:57:35 +0000
commitaf8deff0fff573f750ffad4bef7ed8bb4988dba9 (patch)
treeea768fd497910af0c726e0ae06fbdcda5b9f1b90
parent3991c6075ba5b6eb74ac8ca7aab34aaae22336a5 (diff)
Delete any incomplete ID map database that we find, so that we can start
afresh with a new one, should solve most corrupt database errors such as the ones reported by Achim.
-rw-r--r--bin/bbackupd/BackupDaemon.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/bin/bbackupd/BackupDaemon.cpp b/bin/bbackupd/BackupDaemon.cpp
index 0c2f6b97..d5ccae06 100644
--- a/bin/bbackupd/BackupDaemon.cpp
+++ b/bin/bbackupd/BackupDaemon.cpp
@@ -2514,6 +2514,24 @@ void BackupDaemon::FillIDMapVector(std::vector<BackupClientInodeToIDMap *> &rVec
filename += ".n";
}
+ // The new map file should not exist yet. If there's
+ // one left over from a previous failed run, it's not
+ // useful to us because we never read from it and will
+ // overwrite the entries of all files that still
+ // exist, so we should just delete it and start afresh.
+ if(NewMaps && FileExists(filename.c_str()))
+ {
+ BOX_NOTICE("Found an incomplete ID map "
+ "database, deleting it to start "
+ "afresh: " << filename);
+ if(unlink(filename.c_str()) != 0)
+ {
+ BOX_LOG_NATIVE_ERROR(BOX_FILE_MESSAGE(
+ filename, "Failed to delete "
+ "incomplete ID map database"));
+ }
+ }
+
// If it's not a new map, it may not exist in which case an empty map should be created
if(!NewMaps && !FileExists(filename.c_str()))
{