Rename fastRestoreAgent to fastRestoreTool
This commit is contained in:
parent
acddb68aba
commit
ab3de8700e
|
@ -50,11 +50,11 @@ if(NOT OPEN_FOR_IDE)
|
|||
symlink_files(
|
||||
LOCATION packages/bin
|
||||
SOURCE fdbbackup
|
||||
TARGETS fdbdr dr_agent backup_agent fdbrestore fastrestore_agent)
|
||||
TARGETS fdbdr dr_agent backup_agent fdbrestore fastrestore_tool)
|
||||
symlink_files(
|
||||
LOCATION bin
|
||||
SOURCE fdbbackup
|
||||
TARGETS fdbdr dr_agent backup_agent fdbrestore fastrestore_agent)
|
||||
TARGETS fdbdr dr_agent backup_agent fdbrestore fastrestore_tool)
|
||||
endif()
|
||||
|
||||
if (GPERFTOOLS_FOUND)
|
||||
|
|
|
@ -74,7 +74,7 @@ enum enumProgramExe {
|
|||
EXE_AGENT,
|
||||
EXE_BACKUP,
|
||||
EXE_RESTORE,
|
||||
EXE_FASTRESTORE_AGENT,
|
||||
EXE_FASTRESTORE_TOOL,
|
||||
EXE_DR_AGENT,
|
||||
EXE_DB_BACKUP,
|
||||
EXE_UNDEFINED
|
||||
|
@ -824,7 +824,7 @@ CSimpleOpt::SOption g_rgDBPauseOptions[] = {
|
|||
const KeyRef exeAgent = LiteralStringRef("backup_agent");
|
||||
const KeyRef exeBackup = LiteralStringRef("fdbbackup");
|
||||
const KeyRef exeRestore = LiteralStringRef("fdbrestore");
|
||||
const KeyRef exeFastRestoreAgent = LiteralStringRef("fastrestore_agent"); // must be lower case
|
||||
const KeyRef exeFastRestoreTool = LiteralStringRef("fastrestore_tool"); // must be lower case
|
||||
const KeyRef exeDatabaseAgent = LiteralStringRef("dr_agent");
|
||||
const KeyRef exeDatabaseBackup = LiteralStringRef("fdbdr");
|
||||
|
||||
|
@ -1191,7 +1191,7 @@ static void printUsage(enumProgramExe programExe, bool devhelp)
|
|||
case EXE_RESTORE:
|
||||
printRestoreUsage(devhelp);
|
||||
break;
|
||||
case EXE_FASTRESTORE_AGENT:
|
||||
case EXE_FASTRESTORE_TOOL:
|
||||
printFastRestoreUsage(devhelp);
|
||||
break;
|
||||
case EXE_DR_AGENT:
|
||||
|
@ -1258,10 +1258,10 @@ enumProgramExe getProgramType(std::string programExe)
|
|||
}
|
||||
|
||||
// Check if restore
|
||||
else if ((programExe.length() >= exeFastRestoreAgent.size()) &&
|
||||
(programExe.compare(programExe.length() - exeFastRestoreAgent.size(), exeFastRestoreAgent.size(),
|
||||
(const char*)exeFastRestoreAgent.begin()) == 0)) {
|
||||
enProgramExe = EXE_FASTRESTORE_AGENT;
|
||||
else if ((programExe.length() >= exeFastRestoreTool.size()) &&
|
||||
(programExe.compare(programExe.length() - exeFastRestoreTool.size(), exeFastRestoreTool.size(),
|
||||
(const char*)exeFastRestoreTool.begin()) == 0)) {
|
||||
enProgramExe = EXE_FASTRESTORE_TOOL;
|
||||
}
|
||||
|
||||
// Check if db agent
|
||||
|
@ -1591,7 +1591,7 @@ ACTOR Future<Void> updateAgentPollRate(Database src, std::string rootKey, std::s
|
|||
}
|
||||
}
|
||||
|
||||
ACTOR Future<Void> statusUpdateActor(Database statusUpdateDest, std::string name, enumProgramExe exe, double *pollDelay, Database taskDest = Database(),
|
||||
ACTOR Future<Void> statusUpdateActor(Database statusUpdateDest, std::string name, enumProgramExe exe, double *pollDelay, Database taskDest = Database(),
|
||||
std::string id = nondeterministicRandom()->randomUniqueID().toString()) {
|
||||
state std::string metaKey = layerStatusMetaPrefixRange.begin.toString() + "json/" + name;
|
||||
state std::string rootKey = backupStatusPrefixRange.begin.toString() + name + "/json";
|
||||
|
@ -2189,7 +2189,7 @@ ACTOR Future<Void> runRestore(Database db, std::string originalClusterFile, std:
|
|||
}
|
||||
|
||||
// Fast restore agent that kicks off the restore: send restore requests to restore workers.
|
||||
ACTOR Future<Void> runFastRestoreAgent(Database db, std::string tagName, std::string container,
|
||||
ACTOR Future<Void> runFastRestoreTool(Database db, std::string tagName, std::string container,
|
||||
Standalone<VectorRef<KeyRangeRef>> ranges, Version dbVersion,
|
||||
bool performRestore, bool verbose, bool waitForDone) {
|
||||
try {
|
||||
|
@ -2204,12 +2204,12 @@ ACTOR Future<Void> runFastRestoreAgent(Database db, std::string tagName, std::st
|
|||
ranges.push_back(ranges.arena(), normalKeys);
|
||||
}
|
||||
|
||||
printf("[INFO] runFastRestoreAgent: restore_ranges:%d first range:%s\n", ranges.size(),
|
||||
printf("[INFO] runFastRestoreTool: restore_ranges:%d first range:%s\n", ranges.size(),
|
||||
ranges.front().toString().c_str());
|
||||
|
||||
if (performRestore) {
|
||||
if (dbVersion == invalidVersion) {
|
||||
TraceEvent("FastRestoreAgent").detail("TargetRestoreVersion", "Largest restorable version");
|
||||
TraceEvent("FastRestoreTool").detail("TargetRestoreVersion", "Largest restorable version");
|
||||
BackupDescription desc = wait(IBackupContainer::openContainer(container)->describeBackup());
|
||||
if (!desc.maxRestorableVersion.present()) {
|
||||
fprintf(stderr, "The specified backup is not restorable to any version.\n");
|
||||
|
@ -2217,10 +2217,10 @@ ACTOR Future<Void> runFastRestoreAgent(Database db, std::string tagName, std::st
|
|||
}
|
||||
|
||||
dbVersion = desc.maxRestorableVersion.get();
|
||||
TraceEvent("FastRestoreAgent").detail("TargetRestoreVersion", dbVersion);
|
||||
TraceEvent("FastRestoreTool").detail("TargetRestoreVersion", dbVersion);
|
||||
}
|
||||
state UID randomUID = deterministicRandom()->randomUniqueID();
|
||||
TraceEvent("FastRestoreAgent")
|
||||
TraceEvent("FastRestoreTool")
|
||||
.detail("SubmitRestoreRequests", ranges.size())
|
||||
.detail("RestoreUID", randomUID);
|
||||
wait(backupAgent.submitParallelRestore(db, KeyRef(tagName), ranges, KeyRef(container), dbVersion, true,
|
||||
|
@ -2228,11 +2228,11 @@ ACTOR Future<Void> runFastRestoreAgent(Database db, std::string tagName, std::st
|
|||
// TODO: Support addPrefix and removePrefix
|
||||
if (waitForDone) {
|
||||
// Wait for parallel restore to finish and unlock DB after that
|
||||
TraceEvent("FastRestoreAgent").detail("BackupAndParallelRestore", "WaitForRestoreToFinish");
|
||||
TraceEvent("FastRestoreTool").detail("BackupAndParallelRestore", "WaitForRestoreToFinish");
|
||||
wait(backupAgent.parallelRestoreFinish(db, randomUID));
|
||||
TraceEvent("FastRestoreAgent").detail("BackupAndParallelRestore", "RestoreFinished");
|
||||
TraceEvent("FastRestoreTool").detail("BackupAndParallelRestore", "RestoreFinished");
|
||||
} else {
|
||||
TraceEvent("FastRestoreAgent")
|
||||
TraceEvent("FastRestoreTool")
|
||||
.detail("RestoreUID", randomUID)
|
||||
.detail("OperationGuide", "Manually unlock DB when restore finishes");
|
||||
printf("WARNING: DB will be in locked state after restore. Need UID:%s to unlock DB\n",
|
||||
|
@ -2473,7 +2473,7 @@ ACTOR Future<Void> modifyBackup(Database db, std::string tagName, BackupModifyOp
|
|||
throw backup_error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(db));
|
||||
loop {
|
||||
try {
|
||||
|
@ -2886,7 +2886,7 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
args = new CSimpleOpt(argc - 1, argv + 1, g_rgRestoreOptions, SO_O_EXACT);
|
||||
break;
|
||||
case EXE_FASTRESTORE_AGENT:
|
||||
case EXE_FASTRESTORE_TOOL:
|
||||
if (argc < 2) {
|
||||
printFastRestoreUsage(false);
|
||||
return FDB_EXIT_ERROR;
|
||||
|
@ -3326,7 +3326,7 @@ int main(int argc, char* argv[]) {
|
|||
return FDB_EXIT_ERROR;
|
||||
break;
|
||||
|
||||
case EXE_FASTRESTORE_AGENT:
|
||||
case EXE_FASTRESTORE_TOOL:
|
||||
fprintf(stderr, "ERROR: FDB Fast Restore Agent does not support argument value `%s'\n",
|
||||
args->File(argLoop));
|
||||
printHelpTeaser(argv[0]);
|
||||
|
@ -3752,12 +3752,12 @@ int main(int argc, char* argv[]) {
|
|||
throw restore_error();
|
||||
}
|
||||
break;
|
||||
case EXE_FASTRESTORE_AGENT:
|
||||
case EXE_FASTRESTORE_TOOL:
|
||||
// TODO: We have not implmented the code commented out in this case
|
||||
if (!initCluster()) return FDB_EXIT_ERROR;
|
||||
switch (restoreType) {
|
||||
case RESTORE_START:
|
||||
f = stopAfter(runFastRestoreAgent(db, tagName, restoreContainer, backupKeys, restoreVersion, !dryRun,
|
||||
f = stopAfter(runFastRestoreTool(db, tagName, restoreContainer, backupKeys, restoreVersion, !dryRun,
|
||||
!quietDisplay, waitForDone));
|
||||
break;
|
||||
case RESTORE_WAIT:
|
||||
|
|
|
@ -3584,7 +3584,7 @@ public:
|
|||
ACTOR static Future<Void> parallelRestoreFinish(Database cx, UID randomUID, bool unlockDB = true) {
|
||||
state ReadYourWritesTransaction tr(cx);
|
||||
state Optional<Value> restoreRequestDoneKeyValue;
|
||||
TraceEvent("FastRestoreAgentWaitForRestoreToFinish").detail("DBLock", randomUID);
|
||||
TraceEvent("FastRestoreToolWaitForRestoreToFinish").detail("DBLock", randomUID);
|
||||
// TODO: register watch first and then check if the key exist
|
||||
loop {
|
||||
try {
|
||||
|
@ -3592,7 +3592,7 @@ public:
|
|||
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
|
||||
Optional<Value> _restoreRequestDoneKeyValue = wait(tr.get(restoreRequestDoneKey));
|
||||
restoreRequestDoneKeyValue = _restoreRequestDoneKeyValue;
|
||||
// Restore may finish before restoreAgent waits on the restore finish event.
|
||||
// Restore may finish before restoreTool waits on the restore finish event.
|
||||
if (restoreRequestDoneKeyValue.present()) {
|
||||
break;
|
||||
} else {
|
||||
|
@ -3606,7 +3606,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
TraceEvent("FastRestoreAgentRestoreFinished")
|
||||
TraceEvent("FastRestoreToolRestoreFinished")
|
||||
.detail("ClearRestoreRequestDoneKey", restoreRequestDoneKeyValue.present());
|
||||
// Only this agent can clear the restoreRequestDoneKey
|
||||
wait(runRYWTransaction(cx, [](Reference<ReadYourWritesTransaction> tr) -> Future<Void> {
|
||||
|
@ -3617,11 +3617,11 @@ public:
|
|||
}));
|
||||
|
||||
if (unlockDB) {
|
||||
TraceEvent("FastRestoreAgentRestoreFinished").detail("UnlockDBStart", randomUID);
|
||||
TraceEvent("FastRestoreToolRestoreFinished").detail("UnlockDBStart", randomUID);
|
||||
wait(unlockDatabase(cx, randomUID));
|
||||
TraceEvent("FastRestoreAgentRestoreFinished").detail("UnlockDBFinish", randomUID);
|
||||
TraceEvent("FastRestoreToolRestoreFinished").detail("UnlockDBFinish", randomUID);
|
||||
} else {
|
||||
TraceEvent("FastRestoreAgentRestoreFinished").detail("DBLeftLockedAfterRestore", randomUID);
|
||||
TraceEvent("FastRestoreToolRestoreFinished").detail("DBLeftLockedAfterRestore", randomUID);
|
||||
}
|
||||
|
||||
return Void();
|
||||
|
@ -3666,10 +3666,10 @@ public:
|
|||
}
|
||||
wait(checkDatabaseLock(tr, randomUID));
|
||||
|
||||
TraceEvent("FastRestoreAgentSubmitRestoreRequests").detail("DBIsLocked", randomUID);
|
||||
TraceEvent("FastRestoreToolSubmitRestoreRequests").detail("DBIsLocked", randomUID);
|
||||
break;
|
||||
} catch (Error& e) {
|
||||
TraceEvent(numTries > 50 ? SevError : SevInfo, "FastRestoreAgentSubmitRestoreRequestsMayFail")
|
||||
TraceEvent(numTries > 50 ? SevError : SevInfo, "FastRestoreToolSubmitRestoreRequestsMayFail")
|
||||
.detail("Reason", "DB is not properly locked")
|
||||
.detail("ExpectedLockID", randomUID)
|
||||
.error(e);
|
||||
|
@ -3700,7 +3700,7 @@ public:
|
|||
wait(tr->commit()); // Trigger restore
|
||||
break;
|
||||
} catch (Error& e) {
|
||||
TraceEvent(numTries > 50 ? SevError : SevInfo, "FastRestoreAgentSubmitRestoreRequestsRetry")
|
||||
TraceEvent(numTries > 50 ? SevError : SevInfo, "FastRestoreToolSubmitRestoreRequestsRetry")
|
||||
.detail("RestoreIndex", restoreIndex)
|
||||
.error(e);
|
||||
numTries++;
|
||||
|
|
|
@ -185,7 +185,7 @@ ACTOR Future<Void> distributeRestoreSysInfo(Reference<RestoreMasterData> masterD
|
|||
|
||||
// The server of the restore master. It drives the restore progress with the following steps:
|
||||
// 1) Lock database and clear the normal keyspace
|
||||
// 2) Wait on each RestoreRequest, which is sent by RestoreAgent operated by DBA
|
||||
// 2) Wait on each RestoreRequest, which is sent by RestoreTool operated by DBA
|
||||
// 3) Process each restore request in actor processRestoreRequest;
|
||||
// 3.1) Sample workload to decide the key range for each applier, which is implemented as a dummy sampling;
|
||||
// 3.2) Send each loader the map of key-range to applier interface;
|
||||
|
|
|
@ -150,7 +150,7 @@ struct AtomicSwitchoverWorkload : TestWorkload {
|
|||
|
||||
ACTOR static Future<Void> _start(Database cx, AtomicSwitchoverWorkload* self) {
|
||||
state DatabaseBackupAgent backupAgent(cx);
|
||||
state DatabaseBackupAgent restoreAgent(self->extraDB);
|
||||
state DatabaseBackupAgent restoreTool(self->extraDB);
|
||||
|
||||
TraceEvent("AS_Wait1");
|
||||
wait(success( backupAgent.waitBackup(self->extraDB, BackupAgentBase::getDefaultTag(), false) ));
|
||||
|
@ -159,11 +159,11 @@ struct AtomicSwitchoverWorkload : TestWorkload {
|
|||
TraceEvent("AS_Switch1");
|
||||
wait( backupAgent.atomicSwitchover(self->extraDB, BackupAgentBase::getDefaultTag(), self->backupRanges, StringRef(), StringRef()) );
|
||||
TraceEvent("AS_Wait2");
|
||||
wait(success( restoreAgent.waitBackup(cx, BackupAgentBase::getDefaultTag(), false) ));
|
||||
wait(success( restoreTool.waitBackup(cx, BackupAgentBase::getDefaultTag(), false) ));
|
||||
TraceEvent("AS_Ready2");
|
||||
wait( delay(deterministicRandom()->random01()*self->switch2delay) );
|
||||
TraceEvent("AS_Switch2");
|
||||
wait( restoreAgent.atomicSwitchover(cx, BackupAgentBase::getDefaultTag(), self->backupRanges, StringRef(), StringRef()) );
|
||||
wait( restoreTool.atomicSwitchover(cx, BackupAgentBase::getDefaultTag(), self->backupRanges, StringRef(), StringRef()) );
|
||||
TraceEvent("AS_Wait3");
|
||||
wait(success( backupAgent.waitBackup(self->extraDB, BackupAgentBase::getDefaultTag(), false) ));
|
||||
TraceEvent("AS_Ready3");
|
||||
|
|
|
@ -435,7 +435,7 @@ struct BackupToDBCorrectnessWorkload : TestWorkload {
|
|||
|
||||
ACTOR static Future<Void> _start(Database cx, BackupToDBCorrectnessWorkload* self) {
|
||||
state DatabaseBackupAgent backupAgent(cx);
|
||||
state DatabaseBackupAgent restoreAgent(self->extraDB);
|
||||
state DatabaseBackupAgent restoreTool(self->extraDB);
|
||||
state Future<Void> extraBackup;
|
||||
state bool extraTasks = false;
|
||||
TraceEvent("BARW_Arguments").detail("BackupTag", printable(self->backupTag)).detail("BackupAfter", self->backupAfter)
|
||||
|
@ -515,7 +515,7 @@ struct BackupToDBCorrectnessWorkload : TestWorkload {
|
|||
}
|
||||
|
||||
try {
|
||||
wait(restoreAgent.submitBackup(cx, self->restoreTag, restoreRange, true, StringRef(), self->backupPrefix, self->locked));
|
||||
wait(restoreTool.submitBackup(cx, self->restoreTag, restoreRange, true, StringRef(), self->backupPrefix, self->locked));
|
||||
}
|
||||
catch (Error& e) {
|
||||
TraceEvent("BARW_DoBackupSubmitBackupException", randomID).error(e).detail("Tag", printable(self->restoreTag));
|
||||
|
@ -523,8 +523,8 @@ struct BackupToDBCorrectnessWorkload : TestWorkload {
|
|||
throw;
|
||||
}
|
||||
|
||||
wait(success(restoreAgent.waitBackup(cx, self->restoreTag)));
|
||||
wait(restoreAgent.unlockBackup(cx, self->restoreTag));
|
||||
wait(success(restoreTool.waitBackup(cx, self->restoreTag)));
|
||||
wait(restoreTool.unlockBackup(cx, self->restoreTag));
|
||||
}
|
||||
|
||||
if (extraBackup.isValid()) {
|
||||
|
@ -554,7 +554,7 @@ struct BackupToDBCorrectnessWorkload : TestWorkload {
|
|||
|
||||
if (self->performRestore) {
|
||||
state UID restoreUid = wait(backupAgent.getLogUid(self->extraDB, self->restoreTag));
|
||||
wait( checkData(cx, restoreUid, restoreUid, randomID, self->restoreTag, &restoreAgent, self->shareLogRange) );
|
||||
wait( checkData(cx, restoreUid, restoreUid, randomID, self->restoreTag, &restoreTool, self->shareLogRange) );
|
||||
}
|
||||
|
||||
TraceEvent("BARW_Complete", randomID).detail("BackupTag", printable(self->backupTag));
|
||||
|
|
|
@ -340,7 +340,7 @@ struct BackupToDBUpgradeWorkload : TestWorkload {
|
|||
|
||||
ACTOR static Future<Void> _start(Database cx, BackupToDBUpgradeWorkload* self) {
|
||||
state DatabaseBackupAgent backupAgent(cx);
|
||||
state DatabaseBackupAgent restoreAgent(self->extraDB);
|
||||
state DatabaseBackupAgent restoreTool(self->extraDB);
|
||||
state Standalone<VectorRef<KeyRangeRef>> prevBackupRanges;
|
||||
state UID logUid;
|
||||
state Version commitVersion;
|
||||
|
@ -436,7 +436,7 @@ struct BackupToDBUpgradeWorkload : TestWorkload {
|
|||
// start restoring db
|
||||
try {
|
||||
TraceEvent("DRU_RestoreDb").detail("RestoreTag", printable(self->restoreTag));
|
||||
wait(restoreAgent.submitBackup(cx, self->restoreTag, restoreRanges, true, StringRef(), self->backupPrefix));
|
||||
wait(restoreTool.submitBackup(cx, self->restoreTag, restoreRanges, true, StringRef(), self->backupPrefix));
|
||||
}
|
||||
catch (Error& e) {
|
||||
TraceEvent("DRU_RestoreSubmitBackupError").error(e).detail("Tag", printable(self->restoreTag));
|
||||
|
@ -444,12 +444,12 @@ struct BackupToDBUpgradeWorkload : TestWorkload {
|
|||
throw;
|
||||
}
|
||||
|
||||
wait(success(restoreAgent.waitBackup(cx, self->restoreTag)));
|
||||
wait(restoreAgent.unlockBackup(cx, self->restoreTag));
|
||||
wait(success(restoreTool.waitBackup(cx, self->restoreTag)));
|
||||
wait(restoreTool.unlockBackup(cx, self->restoreTag));
|
||||
wait(checkData(self->extraDB, logUid, logUid, self->backupTag, &backupAgent));
|
||||
|
||||
state UID restoreUid = wait(restoreAgent.getLogUid(cx, self->restoreTag));
|
||||
wait(checkData(cx, restoreUid, restoreUid, self->restoreTag, &restoreAgent));
|
||||
state UID restoreUid = wait(restoreTool.getLogUid(cx, self->restoreTag));
|
||||
wait(checkData(cx, restoreUid, restoreUid, self->restoreTag, &restoreTool));
|
||||
|
||||
TraceEvent("DRU_Complete").detail("BackupTag", printable(self->backupTag));
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ struct RunRestoreWorkerWorkload : TestWorkload {
|
|||
|
||||
virtual Future<Void> start(Database const& cx) {
|
||||
int num_myWorkers = SERVER_KNOBS->FASTRESTORE_NUM_APPLIERS + SERVER_KNOBS->FASTRESTORE_NUM_LOADERS + 1;
|
||||
TraceEvent("RunParallelRestoreWorkerWorkload").detail("Start", "RestoreAgentDB").detail("Workers", num_myWorkers);
|
||||
TraceEvent("RunParallelRestoreWorkerWorkload").detail("Start", "RestoreToolDB").detail("Workers", num_myWorkers);
|
||||
printf("RunParallelRestoreWorkerWorkload, we will start %d restore workers\n", num_myWorkers);
|
||||
std::vector<Future<Void>> myWorkers;
|
||||
for (int i = 0; i < num_myWorkers; ++i) {
|
||||
|
|
Loading…
Reference in New Issue