- Fix bugs

This commit is contained in:
Sreenath Bodagala 2021-07-15 16:52:38 +00:00
parent 81001edb2e
commit f275f4e6e8
2 changed files with 17 additions and 15 deletions

View File

@ -53,6 +53,7 @@ struct VersionVector {
ASSERT(tag != invalidTag);
versions[tag] = version;
}
maxVersion = version;
}
bool hasVersion(const Tag& tag) const {
@ -73,24 +74,24 @@ struct VersionVector {
maxVersion = invalidVersion;
}
void getDelta(Version version, VersionVector& delta) const {
ASSERT(version <= maxVersion);
void getDelta(Version refVersion, VersionVector& delta) const {
ASSERT(refVersion <= maxVersion);
delta.clear();
if (version == maxVersion) {
if (refVersion == maxVersion) {
return; // rerurn an invalid version vector
}
std::map<Version, std::set<Tag>> versionMap;
for (auto& iter : versions) {
if (iter.second > version) {
versionMap[iter.second].insert(iter.first);
std::map<Version, std::set<Tag>> versionMap; // order versions
for (const auto& [tag, version] : versions) {
if (version > refVersion) {
versionMap[version].insert(tag);
}
}
for (auto& iter : versionMap) {
delta.setVersion(iter.second, iter.first);
for (auto& [version, tags] : versionMap) {
delta.setVersion(tags, version);
}
}
@ -101,15 +102,15 @@ struct VersionVector {
ASSERT(maxVersion < delta.maxVersion);
std::map<Version, std::set<Tag>> versionMap; // order the versions
for (auto& iter : delta.versions) {
std::map<Version, std::set<Tag>> versionMap; // order versions
for (const auto& [tag, version] : delta.versions) {
// @todo remove this assert later
ASSERT(iter.second > maxVersion);
versionMap[iter.second].insert(iter.first);
ASSERT(version > maxVersion);
versionMap[version].insert(tag);
}
for (auto& iter : versionMap) {
setVersion(iter.second, iter.first);
for (auto& [version, tags] : versionMap) {
setVersion(tags, version);
}
}

View File

@ -431,6 +431,7 @@ struct BackupData {
GetReadVersionRequest request(span.context,
0,
TransactionPriority::DEFAULT,
invalidVersion,
GetReadVersionRequest::FLAG_USE_MIN_KNOWN_COMMITTED_VERSION);
choose {
when(wait(self->cx->onProxiesChanged())) {}