Stop consistency scanner while restore is in progress

This commit is contained in:
Jefferson Zhong 2023-05-23 16:00:20 -07:00
parent 5d3f923177
commit da11dbdbd9
1 changed files with 20 additions and 1 deletions

View File

@ -2368,6 +2368,23 @@ ACTOR Future<int64_t> getNextBMEpoch(ClusterControllerData* self) {
}
}
ACTOR Future<Void> stopConsistencyScan(Database db) {
state ConsistencyScanState cs = ConsistencyScanState();
state Reference<ReadYourWritesTransaction> tr = makeReference<ReadYourWritesTransaction>(db);
loop {
try {
SystemDBWriteLockedNow(db.getReference())->setOptions(tr);
state ConsistencyScanState::Config config = wait(ConsistencyScanState().config().getD(tr));
config.enabled = false;
cs.config().set(tr, config);
wait(tr->commit());
return Void();
} catch (Error& e) {
wait(tr->onError(e));
}
}
}
ACTOR Future<Void> watchBlobRestoreCommand(ClusterControllerData* self) {
state Reference<BlobRestoreController> restoreController =
makeReference<BlobRestoreController>(self->cx, normalKeys);
@ -2393,7 +2410,9 @@ ACTOR Future<Void> watchBlobRestoreCommand(ClusterControllerData* self) {
}
}
self->db.blobRestoreEnabled.set(phase > BlobRestorePhase::UNINIT && phase < BlobRestorePhase::DONE);
if (self->db.blobRestoreEnabled.get()) {
wait(stopConsistencyScan(self->cx));
}
wait(BlobRestoreController::onPhaseChange(restoreController, BlobRestorePhase::INIT));
} catch (Error& e) {
TraceEvent("WatchBlobRestoreCommand", self->id).error(e);