The bottommost node of a finger isn't necessarily the root for an
iterator's version. It could be "end"
This commit is contained in:
2024-06-03 12:56:17 -07:00
parent f5fdc3eaf1
commit fd618d0f07
2 changed files with 2 additions and 11 deletions

View File

@@ -406,10 +406,6 @@ struct Finger {
assert(searchPathSize_ > 0);
--searchPathSize_;
}
uint32_t root() const {
assert(searchPathSize_ > 0);
return searchPath[0];
}
uint32_t backNode() const {
assert(searchPathSize_ > 0);
return searchPath[searchPathSize_ - 1];
@@ -1241,18 +1237,14 @@ void VersionedMap::Impl::firstGeq(const weaselab::VersionedMap::Key *key,
weaselab::VersionedMap::Iterator *iterator;
void begin(RootSet::ThreadSafeHandle handle) {
uint32_t root;
if (iterator->impl != nullptr) {
root = iterator->impl->version == version
? iterator->impl->finger.root()
: handle.rootForVersion(version);
iterator->impl->~Impl();
new (iterator->impl) Iterator::Impl();
} else {
root = handle.rootForVersion(version);
iterator->impl =
new (safe_malloc(sizeof(Iterator::Impl))) Iterator::Impl();
}
uint32_t root = handle.rootForVersion(version);
Finger &finger = iterator->impl->finger;
finger.clear();
bool ignored = false;