Merge pull request #2685 from jzhou77/backup-fix
Fix key_not_found error due to deleted BackupConfig
This commit is contained in:
commit
b81e2e0e1d
|
@ -89,7 +89,7 @@ struct BackupData {
|
||||||
BackupData* self = nullptr;
|
BackupData* self = nullptr;
|
||||||
Version startVersion = invalidVersion;
|
Version startVersion = invalidVersion;
|
||||||
Version lastSavedVersion = invalidVersion;
|
Version lastSavedVersion = invalidVersion;
|
||||||
Future<Reference<IBackupContainer>> container;
|
Future<Optional<Reference<IBackupContainer>>> container;
|
||||||
Future<Optional<std::vector<KeyRange>>> ranges; // Key ranges of this backup
|
Future<Optional<std::vector<KeyRange>>> ranges; // Key ranges of this backup
|
||||||
bool allWorkerStarted = false; // Only worker with Tag(-2,0) uses & sets this field
|
bool allWorkerStarted = false; // Only worker with Tag(-2,0) uses & sets this field
|
||||||
bool stopped = false; // Is the backup stopped?
|
bool stopped = false; // Is the backup stopped?
|
||||||
|
@ -188,7 +188,7 @@ struct BackupData {
|
||||||
|
|
||||||
// Open the container and get key ranges
|
// Open the container and get key ranges
|
||||||
BackupConfig config(uid);
|
BackupConfig config(uid);
|
||||||
inserted.first->second.container = config.backupContainer().getOrThrow(cx);
|
inserted.first->second.container = config.backupContainer().get(cx);
|
||||||
inserted.first->second.ranges = config.backupRanges().get(cx);
|
inserted.first->second.ranges = config.backupRanges().get(cx);
|
||||||
} else {
|
} else {
|
||||||
stopList.erase(uid);
|
stopList.erase(uid);
|
||||||
|
@ -395,19 +395,25 @@ ACTOR Future<Void> saveMutationsToFile(BackupData* self, Version popVersion, int
|
||||||
for (auto it = self->backups.begin(); it != self->backups.end();) {
|
for (auto it = self->backups.begin(); it != self->backups.end();) {
|
||||||
if (!it->second.isRunning()) {
|
if (!it->second.isRunning()) {
|
||||||
if (it->second.stopped) {
|
if (it->second.stopped) {
|
||||||
|
TraceEvent("BackupWorkerRemoveStoppedContainer", self->myId).detail("BackupId", it->first);
|
||||||
it = self->backups.erase(it);
|
it = self->backups.erase(it);
|
||||||
} else {
|
} else {
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!it->second.container.get().present()) {
|
||||||
|
TraceEvent("BackupWorkerNoContainer", self->myId).detail("BackupId", it->first);
|
||||||
|
it = self->backups.erase(it);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const int index = logFileFutures.size();
|
const int index = logFileFutures.size();
|
||||||
activeUids.insert(it->first);
|
activeUids.insert(it->first);
|
||||||
self->insertRanges(keyRangeMap, it->second.ranges.get(), index);
|
self->insertRanges(keyRangeMap, it->second.ranges.get(), index);
|
||||||
if (it->second.lastSavedVersion == invalidVersion) {
|
if (it->second.lastSavedVersion == invalidVersion) {
|
||||||
it->second.lastSavedVersion = self->messages[0].getVersion();
|
it->second.lastSavedVersion = self->messages[0].getVersion();
|
||||||
}
|
}
|
||||||
logFileFutures.push_back(it->second.container.get()->writeTaggedLogFile(
|
logFileFutures.push_back(it->second.container.get().get()->writeTaggedLogFile(
|
||||||
it->second.lastSavedVersion, popVersion + 1, blockSize, self->tag.id));
|
it->second.lastSavedVersion, popVersion + 1, blockSize, self->tag.id));
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue