MCPcopy Create free account
hub / github.com/apple/foundationdb / _execute

Method _execute

fdbclient/FileBackupAgent.actor.cpp:4038–4087  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4036 // Find all files needed for the restore and save them in the RestoreConfig for the task.
4037 // Update the total number of files and blocks and change state to starting.
4038 ACTOR static Future<Void> _execute(Database cx,
4039 Reference<TaskBucket> taskBucket,
4040 Reference<FutureBucket> futureBucket,
4041 Reference<Task> task) {
4042 state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
4043 state RestoreConfig restore(task);
4044 state Version restoreVersion;
4045 state Version beginVersion;
4046 state Reference<IBackupContainer> bc;
4047 state std::vector<KeyRange> ranges;
4048 state bool logsOnly;
4049 state bool inconsistentSnapshotOnly;
4050
4051 loop {
4052 try {
4053 tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
4054 tr->setOption(FDBTransactionOptions::LOCK_AWARE);
4055
4056 wait(checkTaskVersion(tr->getDatabase(), task, name, version));
4057 wait(store(beginVersion, restore.beginVersion().getD(tr, Snapshot::False, ::invalidVersion)));
4058
4059 wait(store(restoreVersion, restore.restoreVersion().getOrThrow(tr)));
4060 wait(store(ranges, restore.getRestoreRangesOrDefault(tr)));
4061 wait(store(logsOnly, restore.onlyApplyMutationLogs().getD(tr, Snapshot::False, false)));
4062 wait(store(inconsistentSnapshotOnly,
4063 restore.inconsistentSnapshotOnly().getD(tr, Snapshot::False, false)));
4064
4065 wait(taskBucket->keepRunning(tr, task));
4066
4067 ERestoreState oldState = wait(restore.stateEnum().getD(tr));
4068 if (oldState != ERestoreState::QUEUED && oldState != ERestoreState::STARTING) {
4069 wait(restore.logError(cx,
4070 restore_error(),
4071 format("StartFullRestore: Encountered unexpected state(%d)", oldState),
4072 THIS));
4073 return Void();
4074 }
4075 restore.stateEnum().set(tr, ERestoreState::STARTING);
4076 restore.fileSet().clear(tr);
4077 restore.fileBlockCount().clear(tr);
4078 restore.fileCount().clear(tr);
4079 Reference<IBackupContainer> _bc = wait(restore.sourceContainer().getOrThrow(tr));
4080 bc = _bc;
4081
4082 wait(tr->commit());
4083 break;
4084 } catch (Error& e) {
4085 wait(tr->onError(e));
4086 }
4087 }
4088
4089 tr->reset();
4090 loop {

Callers

nothing calls this directly

Calls 15

storeFunction · 0.85
onlyApplyMutationLogsMethod · 0.80
keepRunningMethod · 0.80
onErrorMethod · 0.65
setOptionMethod · 0.65
getDatabaseMethod · 0.65
setMethod · 0.65
clearMethod · 0.65
commitMethod · 0.65
formatFunction · 0.50
getDMethod · 0.45

Tested by

no test coverage detected