From e025f934d8680986f081b48135aeef4b5c04367f Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Sun, 27 Oct 2024 21:13:27 -0700 Subject: [PATCH] Fix gc-too-slow issue Previously, with a finite set of keys, latest_extant_version could fall all the way behind so that a call to addWrites would have to do O(n) work eventually. --- ConflictSet.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 10c84b1..cb2ec23 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -4412,6 +4412,9 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl { assert(writeContext.accum.entries_erased == 0); assert(writeContext.accum.entries_inserted == 0); + // Queue up some gc work just for (potentially) increasing the version + ++keyUpdates; + if (oldestExtantVersion < writeVersion - kMaxCorrectVersionWindow) [[unlikely]] { if (writeVersion > newestVersionFullPrecision + kNominalVersionWindow) {