[Box Backup-dev] COMMIT r793 - box/trunk/bin/bbackupd

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sun Aug 20 00:43:58 BST 2006


Author: chris
Date: 2006-08-20 00:43:58 +0100 (Sun, 20 Aug 2006)
New Revision: 793

Modified:
   box/trunk/bin/bbackupd/BackupDaemon.cpp
Log:
* bin/bbackupd/BackupDaemon.cpp
- Use the return of SerializeStoreObjectInfo to determine whether we
  created a serialised file. If so, then we must delete it on the next 
  run, otherwise we should not try to delete it.


Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/trunk/bin/bbackupd/BackupDaemon.cpp	2006-08-19 23:41:19 UTC (rev 792)
+++ box/trunk/bin/bbackupd/BackupDaemon.cpp	2006-08-19 23:43:58 UTC (rev 793)
@@ -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)




More information about the Boxbackup-dev mailing list