Bug fix
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:
@@ -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;
|
||||
|
@@ -152,8 +152,7 @@ struct __attribute__((__visibility__("default"))) VersionedMap {
|
||||
* and <= `getVersion()`.
|
||||
*
|
||||
* Thread-safe as long as a version is not concurrently invalidated by
|
||||
* `setOldestVersion`. There's a performance benefit if you pass iterator[i]
|
||||
* previously obtained at version[i]. */
|
||||
* `setOldestVersion`. */
|
||||
void firstGeq(const Key *key, const int64_t *version, Iterator *iterator,
|
||||
int count) const;
|
||||
|
||||
|
Reference in New Issue
Block a user