[Box Backup-commit] COMMIT r1023 - box/chris/general/bin/bbackupd
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Sat, 14 Oct 2006 15:10:51 +0100
Author: chris
Date: 2006-10-14 15:10:51 +0100 (Sat, 14 Oct 2006)
New Revision: 1023
Modified:
box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp
Log:
* Allow creation of directory records (and recursive descent into them)
even when the store is full, to allow the user (client) to fix the problem
by excluding some files and having bbackupd delete them from the store.
Modified: box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp
===================================================================
--- box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-10-14 14:07:37 UTC (rev 1022)
+++ box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-10-14 14:10:51 UTC (rev 1023)
@@ -959,11 +959,15 @@
// In the list, just use this pointer
psubDirRecord = e->second;
}
- else if(!rParams.mrContext.StorageLimitExceeded()) // know we've got a connection if we get this far, as dir will have been modified.
+ else
{
- // Note: only think about adding directory records if there's space left on the server.
- // If there isn't, this step will be repeated when there is some available.
-
+ // Note: if we have exceeded our storage limit, then
+ // we should not upload any more data, nor create any
+ // DirectoryRecord representing data that would have
+ // been uploaded. This step will be repeated when
+ // there is some space available.
+ bool doCreateDirectoryRecord = true;
+
// Need to create the record. But do we need to create the directory on the server?
int64_t subDirObjectID = 0;
if(en != 0)
@@ -971,6 +975,12 @@
// No. Exists on the server, and we know about it from the listing.
subDirObjectID = en->GetObjectID();
}
+ else if(rParams.mrContext.StorageLimitExceeded())
+ // know we've got a connection if we get this far,
+ // as dir will have been modified.
+ {
+ doCreateDirectoryRecord = false;
+ }
else
{
// Yes, creation required!
@@ -1053,21 +1063,24 @@
haveJustCreatedDirOnServer = true;
}
}
-
- // New an object for this
- psubDirRecord = new BackupClientDirectoryRecord(subDirObjectID, *d);
-
- // Store in list
- try
- {
- mSubDirectories[*d] = psubDirRecord;
+
+ if (doCreateDirectoryRecord)
+ {
+ // New an object for this
+ psubDirRecord = new BackupClientDirectoryRecord(subDirObjectID, *d);
+
+ // Store in list
+ try
+ {
+ mSubDirectories[*d] = psubDirRecord;
+ }
+ catch(...)
+ {
+ delete psubDirRecord;
+ psubDirRecord = 0;
+ throw;
+ }
}
- catch(...)
- {
- delete psubDirRecord;
- psubDirRecord = 0;
- throw;
- }
}
ASSERT(psubDirRecord != 0 || rParams.mrContext.StorageLimitExceeded());