Inline nextPhysical and nextSibling in checkRangeRead
This commit is contained in:
@@ -1010,13 +1010,51 @@ bool checkRangeRead(Node *n, const std::span<const uint8_t> begin,
|
||||
if (iter->maxVersion <= readVersion) {
|
||||
return true;
|
||||
}
|
||||
iter = nextPhysical(iter, searchPath);
|
||||
int index = -1;
|
||||
for (;;) {
|
||||
auto nextChild = getChildGeq(iter, index + 1);
|
||||
if (nextChild >= 0) {
|
||||
auto *result = getChildExists(iter, nextChild);
|
||||
searchPath.push_back(nextChild);
|
||||
searchPath.insert(searchPath.end(), result->partialKey,
|
||||
result->partialKey + result->partialKeyLen);
|
||||
iter = result;
|
||||
break;
|
||||
}
|
||||
if (iter->parent == nullptr) {
|
||||
iter = nullptr;
|
||||
break;
|
||||
}
|
||||
searchPath.resize(int(searchPath.size()) - 1 - iter->partialKeyLen);
|
||||
index = iter->parentsIndex;
|
||||
iter = iter->parent;
|
||||
}
|
||||
} else {
|
||||
// end does not start with searchPath, so range end <= end
|
||||
if (iter->maxVersion > readVersion) {
|
||||
return false;
|
||||
}
|
||||
iter = nextSibling(iter, searchPath);
|
||||
|
||||
for (;;) {
|
||||
if (iter->parent == nullptr) {
|
||||
assert(searchPath.size() == 0);
|
||||
iter = nullptr;
|
||||
break;
|
||||
}
|
||||
auto next = getChildGeq(iter->parent, iter->parentsIndex + 1);
|
||||
if (next < 0) {
|
||||
searchPath.resize(int(searchPath.size()) - (1 + iter->partialKeyLen));
|
||||
iter = iter->parent;
|
||||
} else {
|
||||
searchPath.resize(int(searchPath.size()) - (1 + iter->partialKeyLen));
|
||||
auto *result = getChildExists(iter->parent, next);
|
||||
searchPath.push_back(next);
|
||||
searchPath.insert(searchPath.end(), result->partialKey,
|
||||
result->partialKey + result->partialKeyLen);
|
||||
iter = result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user