Minor backup code cleanup

This commit is contained in:
Bhaskar Muppana 2017-09-05 09:42:14 -07:00
parent e1a7e11347
commit 456ced2c65
1 changed files with 6 additions and 8 deletions

View File

@ -468,8 +468,8 @@ public:
} }
void startMutationLogs(Reference<ReadYourWritesTransaction> tr, KeyRangeRef backupRange) { void startMutationLogs(Reference<ReadYourWritesTransaction> tr, KeyRangeRef backupRange) {
Key mutationLogsDestKey = uidPrefixKey(backupLogKeys.begin, config.getUid()); Key mutationLogsDestKey = uidPrefixKey(backupLogKeys.begin, getUid());
tr->set(logRangesEncodeKey(backupRange.begin, config.getUid()), logRangesEncodeValue(backupRange.end, mutationLogsDestKey)); tr->set(logRangesEncodeKey(backupRange.begin, getUid()), logRangesEncodeValue(backupRange.end, mutationLogsDestKey));
} }
}; };
@ -2066,7 +2066,7 @@ namespace fileBackup {
// Start logging the mutations for the specified ranges of the tag // Start logging the mutations for the specified ranges of the tag
for (auto &backupRange : backupRanges) { for (auto &backupRange : backupRanges) {
config.startMutationLogs(); config.startMutationLogs(tr, backupRange);
} }
config.stateEnum().set(tr, EBackupState::STATE_BACKUP); config.stateEnum().set(tr, EBackupState::STATE_BACKUP);
@ -3718,7 +3718,6 @@ public:
tr->setOption(FDBTransactionOptions::LOCK_AWARE); tr->setOption(FDBTransactionOptions::LOCK_AWARE);
state KeyBackedTag tag; state KeyBackedTag tag;
state UID logUid;
state BackupConfig config; state BackupConfig config;
state EBackupState backupState; state EBackupState backupState;
@ -3726,8 +3725,7 @@ public:
tag = makeBackupTag(tagName); tag = makeBackupTag(tagName);
state Optional<UidAndAbortedFlagT> uidAndAbortedFlag = wait(tag.get(tr)); state Optional<UidAndAbortedFlagT> uidAndAbortedFlag = wait(tag.get(tr));
if (uidAndAbortedFlag.present()) { if (uidAndAbortedFlag.present()) {
logUid = uidAndAbortedFlag.get().first; config = BackupConfig(uidAndAbortedFlag.get().first);
config = BackupConfig(logUid);
state EBackupState status = wait(config.stateEnum().getD(tr, EBackupState::STATE_NEVERRAN)); state EBackupState status = wait(config.stateEnum().getD(tr, EBackupState::STATE_NEVERRAN));
backupState = status; backupState = status;
} }
@ -3736,7 +3734,7 @@ public:
statusText += "No previous backups found.\n"; statusText += "No previous backups found.\n";
} else { } else {
state std::string backupStatus(BackupAgentBase::getStateText(backupState)); state std::string backupStatus(BackupAgentBase::getStateText(backupState));
state std::string outContainer = wait(backupAgent->getLastBackupContainer(tr, logUid)); state std::string outContainer = wait(backupAgent->getLastBackupContainer(tr, config.getUid()));
state std::string tagNameDisplay = tagName.toString(); state std::string tagNameDisplay = tagName.toString();
state Version stopVersion = wait(config.stopVersion().getD(tr, -1)); state Version stopVersion = wait(config.stopVersion().getD(tr, -1));
@ -3761,7 +3759,7 @@ public:
// Append the errors, if requested // Append the errors, if requested
if (errorLimit > 0) { if (errorLimit > 0) {
Standalone<RangeResultRef> values = wait(tr->getRange(backupAgent->errors.get(BinaryWriter::toValue(logUid, Unversioned())).range(), errorLimit, false, true)); Standalone<RangeResultRef> values = wait(tr->getRange(backupAgent->errors.get(BinaryWriter::toValue(config.getUid(), Unversioned())).range(), errorLimit, false, true));
// Display the errors, if any // Display the errors, if any
if (values.size() > 0) { if (values.size() > 0) {