Address review comments

Move transaction object outside of the loop and rename trace events.
This commit is contained in:
Jingyu Zhou 2020-03-24 18:22:20 -07:00
parent 7831bec2b0
commit edcbeb8992
2 changed files with 7 additions and 4 deletions

View File

@ -50,7 +50,7 @@ void BackupProgress::updateTagVersions(std::map<Tag, Version>* tagVersions, std:
tags->erase(tag);
if (savedVersion < endVersion - 1) {
tagVersions->insert({ tag, savedVersion + 1 });
TraceEvent("BW", dbgid)
TraceEvent("BackupRange", dbgid)
.detail("OldEpoch", epoch)
.detail("Tag", tag.toString())
.detail("BeginVersion", savedVersion + 1)
@ -95,7 +95,7 @@ std::map<std::tuple<LogEpoch, Version, int>, std::map<Tag, Version>> BackupProgr
for (const Tag tag : tags) { // tags without progress data
tagVersions.insert({ tag, info.epochBegin });
TraceEvent("BW", dbgid)
TraceEvent("BackupRange", dbgid)
.detail("OldEpoch", epoch)
.detail("Tag", tag.toString())
.detail("BeginVersion", info.epochBegin)

View File

@ -131,12 +131,13 @@ struct BackupData {
state bool firstWorker = info->self->tag.id == 0;
state bool allUpdated = false;
state Optional<std::vector<std::pair<int64_t, int64_t>>> workers;
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(self->cx));
loop {
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(self->cx));
try {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
tr->setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
Optional<std::vector<std::pair<int64_t, int64_t>>> tmp =
wait(config.startedBackupWorkers().get(tr));
@ -437,11 +438,13 @@ ACTOR Future<bool> monitorBackupStartedKeyChanges(BackupData* self, bool started
// Set "latestBackupWorkerSavedVersion" key for backups
ACTOR Future<Void> setBackupKeys(BackupData* self, std::map<UID, Version> savedLogVersions) {
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(self->cx));
loop {
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(self->cx));
try {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
tr->setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
state std::vector<Future<Optional<Version>>> prevVersions;
state std::vector<BackupConfig> versionConfigs;