Move 'debug_advanceMaxCommittedVersion' to immediately after the new 'durableVersion' got written to SE's commit buffer because:

- Before the interleaving change, SE's commit buffer is empty after each commit. And thus when SS restores the durable state after a reboot, the durable version on disk won't change;
- After the interleaving change, however, the commit buffer is pre-populated with new data for next commit when the current one is done. As a result of that, SE could change the durable version on disk without advancing max committed version.
Note this is not fixing a real bug in storage server, just a fix to make sure the durability debug contract(always increase max committed version, then commit new durable version, then increase min committed version) is followed correctly.
This commit is contained in:
Xin Dong 2020-10-12 11:13:30 -07:00
parent 736f436712
commit 2a2d513c55

View File

@ -3099,7 +3099,6 @@ ACTOR Future<Void> updateStorage(StorageServer* data) {
data->durableInProgress = durableInProgress.getFuture();
durable = data->storage.commit(); // Commit data up to(inclusive) version pendingCommitVersion
durableMinDelay = delay(SERVER_KNOBS->STORAGE_COMMIT_INTERVAL, TaskPriority::UpdateStorage);
debug_advanceMaxCommittedVersion(data->thisServerID, pendingCommitVersion);
if (finalCommit) {
wait(durable && durableMinDelay);
done = true;
@ -3301,6 +3300,7 @@ ACTOR Future<bool> asyncPrepareVersionsForCommit_impl(StorageServerDisk* self, S
// Set the new durable version as part of the outstanding change set, before commit
data->storage.makeVersionDurable( newOldestVersion );
}
debug_advanceMaxCommittedVersion(data->thisServerID, newOldestVersion);
wait(forgetter.signal());
return finalCommit;