Interface change! Return TooOld after 2e9 versions

Event if setOldestVersion wasn't called
This commit is contained in:
2024-06-30 15:25:44 -07:00
parent 8e3eacb54f
commit a68ad5dd17
4 changed files with 34 additions and 4 deletions

View File

@@ -577,7 +577,8 @@ struct SkipListConflictSet {};
struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
Impl(int64_t oldestVersion)
: oldestVersion(oldestVersion), skipList(oldestVersion) {}
: oldestVersion(oldestVersion), newestVersion(oldestVersion),
skipList(oldestVersion) {}
void check(const ConflictSet::ReadRange *reads, ConflictSet::Result *results,
int count) const {
Arena arena;
@@ -592,7 +593,8 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
}
skipList.detectConflicts(ranges, count, results);
for (int i = 0; i < count; ++i) {
if (reads[i].readVersion < oldestVersion) {
if (reads[i].readVersion < oldestVersion ||
reads[i].readVersion < newestVersion - 2e9) {
results[i] = TooOld;
}
}
@@ -600,6 +602,8 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
void addWrites(const ConflictSet::WriteRange *writes, int count,
int64_t writeVersion) {
assert(writeVersion >= newestVersion);
newestVersion = writeVersion;
Arena arena;
const int stringCount = count * 2;
@@ -630,6 +634,7 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
}
void setOldestVersion(int64_t oldestVersion) {
assert(oldestVersion >= this->oldestVersion);
this->oldestVersion = oldestVersion;
SkipList::Finger finger;
int temp;
@@ -648,6 +653,7 @@ private:
Arena removalArena;
std::span<const uint8_t> removalKey;
int64_t oldestVersion;
int64_t newestVersion;
SkipList skipList;
};