Fix some bugs. Still buggy. Keep fuzzing

This commit is contained in:
2024-02-09 18:47:08 -08:00
parent ddca6e8511
commit 418bab61f5

View File

@@ -560,10 +560,10 @@ Node *nextSibling(Node *node, Vector<uint8_t> &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<const uint8_t> 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;