Rename incrementalBackupOnly to onlyAppyMutationLogs in all restore configs and functions.

This commit is contained in:
RenxuanW 2021-04-26 12:30:46 -07:00
parent d3600696ce
commit 719f810676
3 changed files with 27 additions and 26 deletions

View File

@ -2258,7 +2258,7 @@ ACTOR Future<Void> runRestore(Database db,
bool waitForDone,
std::string addPrefix,
std::string removePrefix,
bool incrementalBackupOnly,
bool onlyAppyMutationLogs,
bool inconsistentSnapshotOnly) {
if (ranges.empty()) {
ranges.push_back_deep(ranges.arena(), normalKeys);
@ -2305,7 +2305,7 @@ ACTOR Future<Void> runRestore(Database db,
BackupDescription desc = wait(bc->describeBackup());
if (incrementalBackupOnly && desc.contiguousLogEnd.present()) {
if (onlyAppyMutationLogs && desc.contiguousLogEnd.present()) {
targetVersion = desc.contiguousLogEnd.get() - 1;
} else if (desc.maxRestorableVersion.present()) {
targetVersion = desc.maxRestorableVersion.get();
@ -2330,7 +2330,7 @@ ACTOR Future<Void> runRestore(Database db,
KeyRef(addPrefix),
KeyRef(removePrefix),
true,
incrementalBackupOnly,
onlyAppyMutationLogs,
inconsistentSnapshotOnly,
beginVersion));
@ -3247,6 +3247,7 @@ int main(int argc, char* argv[]) {
bool stopWhenDone = true;
bool usePartitionedLog = false; // Set to true to use new backup system
bool incrementalBackupOnly = false;
bool onlyAppyMutationLogs = false;
bool inconsistentSnapshotOnly = false;
bool forceAction = false;
bool trace = false;
@ -3511,6 +3512,7 @@ int main(int argc, char* argv[]) {
break;
case OPT_INCREMENTALONLY:
incrementalBackupOnly = true;
onlyAppyMutationLogs = true;
break;
case OPT_RESTORECONTAINER:
restoreContainer = args->OptionArg();
@ -4032,7 +4034,7 @@ int main(int argc, char* argv[]) {
waitForDone,
addPrefix,
removePrefix,
incrementalBackupOnly,
onlyAppyMutationLogs,
inconsistentSnapshotOnly));
break;
case RestoreType::WAIT:

View File

@ -294,7 +294,7 @@ public:
Key addPrefix = Key(),
Key removePrefix = Key(),
bool lockDB = true,
bool incrementalBackupOnly = false,
bool onlyAppyMutationLogs = false,
bool inconsistentSnapshotOnly = false,
Version beginVersion = -1);
Future<Version> restore(Database cx,
@ -308,7 +308,7 @@ public:
Key addPrefix = Key(),
Key removePrefix = Key(),
bool lockDB = true,
bool incrementalBackupOnly = false,
bool onlyAppyMutationLogs = false,
bool inconsistentSnapshotOnly = false,
Version beginVersion = -1) {
Standalone<VectorRef<KeyRangeRef>> rangeRef;
@ -324,8 +324,8 @@ public:
addPrefix,
removePrefix,
lockDB,
incrementalBackupOnly,
inconsistentSnapshotOnly,
onlyAppyMutationLogs,
inconsistentSnapshotOnly,
beginVersion);
}
Future<Version> atomicRestore(Database cx,

View File

@ -141,7 +141,7 @@ public:
}
KeyBackedProperty<Key> addPrefix() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); }
KeyBackedProperty<Key> removePrefix() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); }
KeyBackedProperty<bool> incrementalBackupOnly() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); }
KeyBackedProperty<bool> onlyAppyMutationLogs() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); }
KeyBackedProperty<bool> inconsistentSnapshotOnly() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); }
// XXX: Remove restoreRange() once it is safe to remove. It has been changed to restoreRanges
KeyBackedProperty<KeyRange> restoreRange() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); }
@ -3574,9 +3574,9 @@ struct RestoreDispatchTaskFunc : RestoreTaskFuncBase {
state int64_t remainingInBatch = Params.remainingInBatch().get(task);
state bool addingToExistingBatch = remainingInBatch > 0;
state Version restoreVersion;
state Future<Optional<bool>> incrementalBackupOnly = restore.incrementalBackupOnly().get(tr);
state Future<Optional<bool>> onlyAppyMutationLogs = restore.onlyAppyMutationLogs().get(tr);
wait(store(restoreVersion, restore.restoreVersion().getOrThrow(tr)) && success(incrementalBackupOnly) &&
wait(store(restoreVersion, restore.restoreVersion().getOrThrow(tr)) && success(onlyAppyMutationLogs) &&
checkTaskVersion(tr->getDatabase(), task, name, version));
// If not adding to an existing batch then update the apply mutations end version so the mutations from the
@ -4101,8 +4101,7 @@ struct StartFullRestoreTaskFunc : RestoreTaskFuncBase {
}
}
Optional<bool> _incremental = wait(restore.incrementalBackupOnly().get(tr));
state bool incremental = _incremental.present() ? _incremental.get() : false;
state bool logsOnly = wait(restore.onlyAppyMutationLogs().getD(tr, false, false));
if (beginVersion == invalidVersion) {
beginVersion = 0;
}
@ -4111,8 +4110,8 @@ struct StartFullRestoreTaskFunc : RestoreTaskFuncBase {
keyRangesFilter.push_back_deep(keyRangesFilter.arena(), KeyRangeRef(r));
}
state Optional<RestorableFileSet> restorable =
wait(bc->getRestoreSet(restoreVersion, keyRangesFilter, incremental, beginVersion));
if (!incremental) {
wait(bc->getRestoreSet(restoreVersion, keyRangesFilter, logsOnly, beginVersion));
if (!logsOnly) {
beginVersion = restorable.get().snapshot.beginVersion;
}
@ -4226,7 +4225,7 @@ struct StartFullRestoreTaskFunc : RestoreTaskFuncBase {
tr, taskBucket, task, 0, "", 0, CLIENT_KNOBS->RESTORE_DISPATCH_BATCH_SIZE)));
wait(taskBucket->finish(tr, task));
state Future<Optional<bool>> logsOnly = restore.incrementalBackupOnly().get(tr);
state Future<Optional<bool>> logsOnly = restore.onlyAppyMutationLogs().get(tr);
wait(success(logsOnly));
if (logsOnly.get().present() && logsOnly.get().get()) {
// If this is an incremental restore, we need to set the applyMutationsMapPrefix
@ -4626,7 +4625,7 @@ public:
Key addPrefix,
Key removePrefix,
bool lockDB,
bool incrementalBackupOnly,
bool onlyAppyMutationLogs,
bool inconsistentSnapshotOnly,
Version beginVersion,
UID uid) {
@ -4679,7 +4678,7 @@ public:
.removePrefix(removePrefix)
.withPrefix(addPrefix);
Standalone<RangeResultRef> existingRows = wait(tr->getRange(restoreIntoRange, 1));
if (existingRows.size() > 0 && !incrementalBackupOnly) {
if (existingRows.size() > 0 && !onlyAppyMutationLogs) {
throw restore_destination_not_empty();
}
}
@ -4696,7 +4695,7 @@ public:
restore.sourceContainer().set(tr, bc);
restore.stateEnum().set(tr, ERestoreState::QUEUED);
restore.restoreVersion().set(tr, restoreVersion);
restore.incrementalBackupOnly().set(tr, incrementalBackupOnly);
restore.onlyAppyMutationLogs().set(tr, onlyAppyMutationLogs);
restore.inconsistentSnapshotOnly().set(tr, inconsistentSnapshotOnly);
restore.beginVersion().set(tr, beginVersion);
if (BUGGIFY && restoreRanges.size() == 1) {
@ -5271,7 +5270,7 @@ public:
// removePrefix: for each key to be restored, remove this prefix first.
// lockDB: if set lock the database with randomUid before performing restore;
// otherwise, check database is locked with the randomUid
// incrementalBackupOnly: only perform incremental restore, by only applying mutation logs
// onlyAppyMutationLogs: only perform incremental restore, by only applying mutation logs
// inconsistentSnapshotOnly: Ignore mutation log files during the restore to speedup the process.
// When set to true, gives an inconsistent snapshot, thus not recommended
// beginVersion: restore's begin version
@ -5288,7 +5287,7 @@ public:
Key addPrefix,
Key removePrefix,
bool lockDB,
bool incrementalBackupOnly,
bool onlyAppyMutationLogs,
bool inconsistentSnapshotOnly,
Version beginVersion,
UID randomUid) {
@ -5308,12 +5307,12 @@ public:
if (targetVersion == invalidVersion && desc.maxRestorableVersion.present())
targetVersion = desc.maxRestorableVersion.get();
if (targetVersion == invalidVersion && incrementalBackupOnly && desc.contiguousLogEnd.present()) {
if (targetVersion == invalidVersion && onlyAppyMutationLogs && desc.contiguousLogEnd.present()) {
targetVersion = desc.contiguousLogEnd.get() - 1;
}
Optional<RestorableFileSet> restoreSet =
wait(bc->getRestoreSet(targetVersion, ranges, incrementalBackupOnly, beginVersion));
wait(bc->getRestoreSet(targetVersion, ranges, onlyAppyMutationLogs, beginVersion));
if (!restoreSet.present()) {
TraceEvent(SevWarn, "FileBackupAgentRestoreNotPossible")
@ -5345,7 +5344,7 @@ public:
addPrefix,
removePrefix,
lockDB,
incrementalBackupOnly,
onlyAppyMutationLogs,
inconsistentSnapshotOnly,
beginVersion,
randomUid));
@ -5563,7 +5562,7 @@ Future<Version> FileBackupAgent::restore(Database cx,
Key addPrefix,
Key removePrefix,
bool lockDB,
bool incrementalBackupOnly,
bool onlyAppyMutationLogs,
bool inconsistentSnapshotOnly,
Version beginVersion) {
return FileBackupAgentImpl::restore(this,
@ -5578,7 +5577,7 @@ Future<Version> FileBackupAgent::restore(Database cx,
addPrefix,
removePrefix,
lockDB,
incrementalBackupOnly,
onlyAppyMutationLogs,
inconsistentSnapshotOnly,
beginVersion,
deterministicRandom()->randomUniqueID());