Prepare to skip right of c in "left side of pyramid"

This commit is contained in:
2024-02-13 18:49:24 -08:00
parent 2793edf07d
commit 0d9e184bac

View File

@@ -994,11 +994,6 @@ bool checkRangeRead(Node *n, const std::span<const uint8_t> 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<const uint8_t> 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<const uint8_t> 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<const uint8_t> 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;
}
}
}
}