Introduce Version Vector.

This commit is contained in:
Sreenath Bodagala 2021-06-28 19:50:09 +00:00
parent 63e530fc44
commit fc0373c2d6
2 changed files with 26 additions and 0 deletions

View File

@ -1126,4 +1126,27 @@ inline const char* transactionPriorityToString(TransactionPriority priority, boo
throw internal_error();
}
struct VersionVector {
std::map<Tag, Version> versions;
VersionVector() {}
void setVersion(const Tag& tag, Version version) {
versions[tag] = version;
}
bool hasVersion(const Tag& tag) const {
return versions.find(tag) != versions.end();
}
Version getVersion(const Tag& tag) const {
return versions.at(tag);
}
template <class Ar>
void serialize(Ar& ar) {
serializer(ar, versions);
}
};
#endif

View File

@ -246,6 +246,9 @@ struct MasterData : NonCopyable, ReferenceCounted<MasterData> {
std::vector<WorkerInterface> backupWorkers; // Recruited backup workers from cluster controller.
// Captures the latest commit version for each storage server in the cluster.
VersionVector ssVersionVector;
CounterCollection cc;
Counter changeCoordinatorsRequests;
Counter getCommitVersionRequests;