diff --git a/ConflictSet.cpp b/ConflictSet.cpp index c9df6a1..73b40b6 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -994,11 +994,6 @@ bool checkRangeRead(Node *n, const std::span begin, assert(left.n == iter.n); #endif -#if DEBUG_VERBOSE && !defined(NDEBUG) - fprintf(stderr, "firstGeq for `%s' got `%s'\n", printable(begin).c_str(), - getSearchPathPrintable(left.n).c_str()); -#endif - if (left.n == nullptr) { return true; } @@ -1025,6 +1020,10 @@ bool checkRangeRead(Node *n, const std::span begin, break; } +#if DEBUG_VERBOSE && !defined(NDEBUG) + fprintf(stderr, "Visit %s\n", printable(searchPath).c_str()); +#endif + if (iter->entryPresent) { if (!first && iter->entry.rangeVersion > readVersion) { return false; @@ -1035,10 +1034,6 @@ bool checkRangeRead(Node *n, const std::span begin, } assert(searchPath == getSearchPath(arena, iter)); -#if DEBUG_VERBOSE && !defined(NDEBUG) - fprintf(stderr, "Max version of keys starting with %s: %" PRId64 "\n", - printable(searchPath).c_str(), iter->maxVersion); -#endif if (lcp == depth) { // end starts with searchPath, so end < range if (iter->maxVersion <= readVersion) { @@ -1080,9 +1075,22 @@ bool checkRangeRead(Node *n, const std::span begin, } else { ascend(depth, lcp, iter, searchPath); iter = iter->parent; - iter = getChildExists(iter, next); - descend(depth, lcp, iter, end, searchPath); - break; + if (depth - iter->partialKeyLen - lcp > 1) { +#if DEBUG_VERBOSE && !defined(NDEBUG) + fprintf(stderr, "%s, right of %02x\n", + printable(searchPath).c_str(), next); +#endif + while (next >= 0) { + if (getChildExists(iter, next)->maxVersion > readVersion) { + return false; + } + next = getChildGeq(iter, next + 1); + } + } else { + iter = getChildExists(iter, next); + descend(depth, lcp, iter, end, searchPath); + break; + } } } }