From 418bab61f575474ca7c065c623876cdcd3cd6539 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Fri, 9 Feb 2024 18:47:08 -0800 Subject: [PATCH] Fix some bugs. Still buggy. Keep fuzzing --- ConflictSet.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 4994e6b..dadec44 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -560,10 +560,10 @@ Node *nextSibling(Node *node, Vector &searchPath) { } auto next = getChildGeq(node->parent, node->parentsIndex + 1); if (next < 0) { + searchPath.resize(int(searchPath.size()) - (1 + node->partialKeyLen)); node = node->parent; - searchPath.resize(int(searchPath.size()) - 1 - node->partialKeyLen); } else { - searchPath.resize(int(searchPath.size()) - 1 - node->partialKeyLen); + searchPath.resize(int(searchPath.size()) - (1 + node->partialKeyLen)); auto *result = getChildExists(node->parent, next); searchPath.push_back(next); searchPath.insert(searchPath.end(), result->partialKey, @@ -828,7 +828,14 @@ bool checkRangeRead(Node *n, const std::span begin, for (auto *iter = nextPhysical(left.n, searchPath); iter != right.n;) { assert(searchPath == getSearchPath(arena, iter)); + if (iter->entryPresent && iter->entry.rangeVersion > readVersion) { + return false; + } bool ok = true; +#if DEBUG_VERBOSE && !defined(NDEBUG) + fprintf(stderr, "Max version of keys starting with %s: %" PRId64 "\n", + printable(searchPath).c_str(), iter->maxVersion); +#endif auto rangeEnd = strincMutate(searchPath, ok); if (!ok) { return iter->maxVersion <= readVersion;