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) {
|
if (iter->maxVersion <= readVersion) {
|
||||||
return true;
|
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 {
|
} else {
|
||||||
// end does not start with searchPath, so range end <= end
|
// end does not start with searchPath, so range end <= end
|
||||||
if (iter->maxVersion > readVersion) {
|
if (iter->maxVersion > readVersion) {
|
||||||
return false;
|
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;
|
return true;
|
||||||
|
Reference in New Issue
Block a user