Handle newly-created node partial key immediately
This commit is contained in:
@@ -2928,16 +2928,6 @@ checkMaxBetweenExclusiveImpl<true>(Node *n, int begin, int end,
|
|||||||
// up.
|
// up.
|
||||||
}
|
}
|
||||||
key = key.subspan(partialKeyIndex, key.size() - partialKeyIndex);
|
key = key.subspan(partialKeyIndex, key.size() - partialKeyIndex);
|
||||||
|
|
||||||
} else {
|
|
||||||
// Consider adding a partial key
|
|
||||||
if ((*self)->numChildren == 0 && !(*self)->entryPresent) {
|
|
||||||
assert((*self)->getCapacity() >= int(key.size()));
|
|
||||||
(*self)->partialKeyLen = key.size();
|
|
||||||
memcpy((*self)->partialKey(), key.data(), (*self)->partialKeyLen);
|
|
||||||
key = key.subspan((*self)->partialKeyLen,
|
|
||||||
key.size() - (*self)->partialKeyLen);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(maxVersion(*self, impl) <= writeVersion);
|
assert(maxVersion(*self, impl) <= writeVersion);
|
||||||
@@ -2952,10 +2942,12 @@ checkMaxBetweenExclusiveImpl<true>(Node *n, int begin, int end,
|
|||||||
child = tls->allocate<Node0>(key.size() - 1);
|
child = tls->allocate<Node0>(key.size() - 1);
|
||||||
child->numChildren = 0;
|
child->numChildren = 0;
|
||||||
child->entryPresent = false;
|
child->entryPresent = false;
|
||||||
child->partialKeyLen = 0;
|
child->partialKeyLen = key.size() - 1;
|
||||||
child->parent = *self;
|
child->parent = *self;
|
||||||
child->parentsIndex = key.front();
|
child->parentsIndex = key.front();
|
||||||
setMaxVersion(child, impl, tls->zero);
|
setMaxVersion(child, impl, writeVersion);
|
||||||
|
memcpy(child->partialKey(), key.data() + 1, child->partialKeyLen);
|
||||||
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
self = &child;
|
self = &child;
|
||||||
|
Reference in New Issue
Block a user