[Box Backup-dev] COMMIT r747 - box/chris/merge/bin/bbackupd
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Wed, 9 Aug 2006 18:16:28 +0000 (GMT)
Author: chris
Date: 2006-08-09 18:16:21 +0000 (Wed, 09 Aug 2006)
New Revision: 747
Modified:
box/chris/merge/bin/bbackupd/BackupDaemon.cpp
Log:
* bin/bbackupd/BackupDaemon.cpp
- Use the result of SerializeStoreObjectInfo, if we failed to serialise
(when no file existed) then no need to delete the file on the next run.
Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-09 17:59:53 UTC (rev 746)
+++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-09 18:16:21 UTC (rev 747)
@@ -504,8 +504,8 @@
BackupClientContext::ClientStoreMarker_NotKnown;
// haven't contacted the store yet
- bool deserialised = DeserializeStoreObjectInfo(clientStoreMarker,
- lastSyncTime, nextSyncTime);
+ bool deleteStoreObjectInfoFile = DeserializeStoreObjectInfo(
+ clientStoreMarker, lastSyncTime, nextSyncTime);
// --------------------------------------------------------------------------------------------
@@ -611,7 +611,8 @@
// Delete the serialised store object file,
// so that we don't try to reload it after a
// partially completed backup
- if(deserialised && !DeleteStoreObjectInfo())
+ if(deleteStoreObjectInfoFile &&
+ !DeleteStoreObjectInfo())
{
::syslog(LOG_ERR, "Failed to delete the "
"StoreObjectInfoFile, backup cannot "
@@ -621,6 +622,11 @@
::sleep(60);
continue;
}
+
+ // In case the backup throws an exception,
+ // we should not try to delete the store info
+ // object file again.
+ deleteStoreObjectInfoFile = false;
// Do sync
bool errorOccurred = false;
@@ -729,9 +735,15 @@
// --------------------------------------------------------------------------------------------
- // We had a successful backup, save the store info
- SerializeStoreObjectInfo(clientStoreMarker, lastSyncTime, nextSyncTime);
+ // We had a successful backup, save the store
+ // info. If we save successfully, we must
+ // delete the file next time we start a backup
+ deleteStoreObjectInfoFile =
+ SerializeStoreObjectInfo(
+ clientStoreMarker,
+ lastSyncTime, nextSyncTime);
+
// --------------------------------------------------------------------------------------------
}
catch(BoxException &e)