From f275f4e6e871ac577b9a0cd90d0746c2edcf8644 Mon Sep 17 00:00:00 2001 From: Sreenath Bodagala Date: Thu, 15 Jul 2021 16:52:38 +0000 Subject: [PATCH] - Fix bugs --- fdbclient/VersionVector.h | 31 ++++++++++++++++--------------- fdbserver/BackupWorker.actor.cpp | 1 + 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/fdbclient/VersionVector.h b/fdbclient/VersionVector.h index fea21bb333..467a2cf089 100644 --- a/fdbclient/VersionVector.h +++ b/fdbclient/VersionVector.h @@ -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> versionMap; - for (auto& iter : versions) { - if (iter.second > version) { - versionMap[iter.second].insert(iter.first); + std::map> 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> versionMap; // order the versions - for (auto& iter : delta.versions) { + std::map> 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); } } diff --git a/fdbserver/BackupWorker.actor.cpp b/fdbserver/BackupWorker.actor.cpp index b89f6d89f2..40bcb0dd1d 100644 --- a/fdbserver/BackupWorker.actor.cpp +++ b/fdbserver/BackupWorker.actor.cpp @@ -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())) {}