[Box Backup-commit] COMMIT r1863 - in box/trunk: bin/bbackupd lib/backupclient
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Tue, 09 Oct 2007 00:23:59 +0100
Author: chris
Date: 2007-10-09 00:23:59 +0100 (Tue, 09 Oct 2007)
New Revision: 1863
Modified:
box/trunk/bin/bbackupd/BackupDaemon.cpp
box/trunk/bin/bbackupd/BackupDaemon.h
box/trunk/lib/backupclient/BackupDaemonConfigVerify.cpp
box/trunk/lib/backupclient/BackupStoreConstants.h
Log:
Allow configuration of the time to delete redundant store locations.
Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/trunk/bin/bbackupd/BackupDaemon.cpp 2007-10-08 23:21:48 UTC (rev 1862)
+++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2007-10-08 23:23:59 UTC (rev 1863)
@@ -876,6 +876,9 @@
SecondsToBoxTime(
conf.GetKeyValueInt(
"MaxFileTimeInFuture"));
+ mDeleteRedundantLocationsAfter =
+ conf.GetKeyValueInt(
+ "DeleteRedundantLocationsAfter");
clientContext.SetMaximumDiffingTime(maximumDiffingTime);
clientContext.SetKeepAliveTime(keepAliveTime);
@@ -1659,7 +1662,7 @@
for(std::list<std::pair<std::string, Configuration> >::const_iterator i = rLocationsConf.mSubConfigurations.begin();
i != rLocationsConf.mSubConfigurations.end(); ++i)
{
- BOX_TRACE("new location");
+ BOX_TRACE("new location: " << i->first);
// Create a record for it
Location *ploc = new Location;
try
@@ -1821,12 +1824,12 @@
}
catch (std::exception &e)
{
- delete ploc;
- ploc = 0;
BOX_ERROR("Failed to configure location '"
<< ploc->mName << "' path '"
<< ploc->mPath << "': " << e.what() <<
": please check for previous errors");
+ delete ploc;
+ ploc = 0;
throw;
}
catch(...)
@@ -1857,8 +1860,7 @@
mDeleteUnusedRootDirEntriesAfter == 0)
{
mDeleteUnusedRootDirEntriesAfter = now +
- SecondsToBoxTime(
- BACKUP_DELETE_UNUSED_ROOT_ENTRIES_AFTER);
+ SecondsToBoxTime(mDeleteRedundantLocationsAfter);
}
int secs = BoxTimeToSeconds(mDeleteUnusedRootDirEntriesAfter
Modified: box/trunk/bin/bbackupd/BackupDaemon.h
===================================================================
--- box/trunk/bin/bbackupd/BackupDaemon.h 2007-10-08 23:21:48 UTC (rev 1862)
+++ box/trunk/bin/bbackupd/BackupDaemon.h 2007-10-08 23:23:59 UTC (rev 1863)
@@ -158,6 +158,8 @@
std::vector<BackupClientInodeToIDMap *> mCurrentIDMaps;
std::vector<BackupClientInodeToIDMap *> mNewIDMaps;
+ int mDeleteRedundantLocationsAfter;
+
// For the command socket
class CommandSocketInfo
{
Modified: box/trunk/lib/backupclient/BackupDaemonConfigVerify.cpp
===================================================================
--- box/trunk/lib/backupclient/BackupDaemonConfigVerify.cpp 2007-10-08 23:21:48 UTC (rev 1862)
+++ box/trunk/lib/backupclient/BackupDaemonConfigVerify.cpp 2007-10-08 23:23:59 UTC (rev 1863)
@@ -77,6 +77,7 @@
// return "now" if it's allowed, or a number of seconds if it's not
{"MaximumDiffingTime", 0, ConfigTest_IsInt, 0},
+ {"DeleteRedundantLocationsAfter", "172800", ConfigTest_IsInt, 0},
{"FileTrackingSizeThreshold", 0, ConfigTest_Exists | ConfigTest_IsInt, 0},
{"DiffingUploadSizeThreshold", 0, ConfigTest_Exists | ConfigTest_IsInt, 0},
Modified: box/trunk/lib/backupclient/BackupStoreConstants.h
===================================================================
--- box/trunk/lib/backupclient/BackupStoreConstants.h 2007-10-08 23:21:48 UTC (rev 1862)
+++ box/trunk/lib/backupclient/BackupStoreConstants.h 2007-10-08 23:23:59 UTC (rev 1863)
@@ -40,14 +40,5 @@
// This is a multiple of the number of blocks in the diff from file.
#define BACKUP_FILE_DIFF_MAX_BLOCK_FIND_MULTIPLE 4096
-// How many seconds to wait before deleting unused root directory entries?
-#ifndef NDEBUG
- // Debug: 30 seconds (easier to test)
- #define BACKUP_DELETE_UNUSED_ROOT_ENTRIES_AFTER 30
-#else
- // Release: 2 days (plenty of time for sysadmins to notice, or change their mind)
- #define BACKUP_DELETE_UNUSED_ROOT_ENTRIES_AFTER 172800
-#endif
-
#endif // BACKUPSTORECONSTANTS__H