From 3db3d975fc4442b21bec4c3f601e9d448a25e1cc Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Wed, 3 Jul 2024 10:31:57 -0700 Subject: [PATCH] Interface change! Allow decreasing setOldestVersion --- ConflictSet.cpp | 10 +++------- SkipList.cpp | 4 +++- include/ConflictSet.h | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index d033735..a4fdb09 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -3204,11 +3204,7 @@ Iterator firstGeqLogical(Node *n, const std::span key) { } else { n = nextSibling(n); if (n == nullptr) { - // This line is genuinely unreachable from any entry point of the - // final library, since we can't remove a key without introducing a - // key after it, and the only production caller of firstGeq is for - // resuming the setOldestVersion scan. - return {nullptr, 1}; // GCOVR_EXCL_LINE + return {nullptr, 1}; } goto downLeftSpine; } @@ -3489,8 +3485,8 @@ void checkVersionsGeqOldestExtant(Node *n, assert(m >= oldestExtantVersion); } } break; - default: // GCOVR_EXCL_LINE - __builtin_unreachable(); // GCOVR_EXCL_LINE + default: + abort(); } } diff --git a/SkipList.cpp b/SkipList.cpp index 86ee9b5..7b7d22a 100644 --- a/SkipList.cpp +++ b/SkipList.cpp @@ -634,7 +634,9 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl { } void setOldestVersion(int64_t oldestVersion) { - assert(oldestVersion >= this->oldestVersion); + if (oldestVersion < this->oldestVersion) { + return; + } this->oldestVersion = oldestVersion; SkipList::Finger finger; int temp; diff --git a/include/ConflictSet.h b/include/ConflictSet.h index 3a5c3c5..0bff23b 100644 --- a/include/ConflictSet.h +++ b/include/ConflictSet.h @@ -77,8 +77,8 @@ struct __attribute__((__visibility__("default"))) ConflictSet { * versions. */ void addWrites(const WriteRange *writes, int count, int64_t writeVersion); - /** Reads where readVersion < oldestVersion will result in `TooOld`. Must be - * greater than or equal to all previous oldest versions. */ + /** Reads where readVersion < oldestVersion will result in `TooOld`. Ignored + * if not greater than or equal to all previous oldest versions. */ void setOldestVersion(int64_t oldestVersion); /** Reads where readVersion < oldestVersion will result in `TooOld`. There are