From 4182d904c56e4ca14ddcb43fdcc7c227df8bfa63 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Thu, 11 Jul 2024 16:40:18 -0700 Subject: [PATCH] Fix an issue where gc wasn't outpacing writes --- ConflictSet.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index abfe6d2..600fe4a 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -3070,8 +3070,12 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl { rootMaxVersion = std::max(rootMaxVersion, oldestVersion); n = nextPhysical(n); } - for (; fuel > 0 && n != nullptr; --fuel) { + for (; fuel > 0 && n != nullptr;) { rezero(n, oldestVersion); + // The "make sure gc keeps up with writes" calculations assume that we're + // scanning key by key, not node by node. Make sure we only spend fuel + // when there's a logical entry. + fuel -= n->entryPresent; if (n->entryPresent && std::max(n->entry.pointVersion, n->entry.rangeVersion) <= oldestVersion) { // Any transaction n would have prevented from committing is