Add error when reading invalid snapshot version

This commit is contained in:
Lukas Joswiak 2022-11-21 15:07:47 -08:00
parent ecfb6e4f5d
commit 0fddd66492
1 changed files with 12 additions and 0 deletions

View File

@ -523,6 +523,18 @@ class ConfigNodeImpl {
ObjectReader::fromStringRef<KnobValue>(kv.value, IncludeVersion());
}
wait(store(reply.snapshotVersion, getLastCompactedVersion(self)));
if (req.mostRecentVersion < reply.snapshotVersion) {
// The version in the request can be less than the last compacted
// version in certain circumstances where the coordinators are
// being changed and the consumer reads the latest committed
// version from a majority of ConfigNodes before they have received
// up to date snapshots. This should be fine, it just means the
// consumer needs to fetch the latest version and retry its
// request.
CODE_PROBE(true, "ConfigNode ahead of consumer", probe::decoration::rare);
req.reply.sendError(version_already_compacted());
return Void();
}
wait(store(reply.changes, getMutations(self, reply.snapshotVersion + 1, req.mostRecentVersion)));
wait(store(reply.annotations, getAnnotations(self, reply.snapshotVersion + 1, req.mostRecentVersion)));
TraceEvent(SevInfo, "ConfigNodeGettingSnapshot", self->id)