Document that erase may invalidate search path

It doesn't yet, but it will when we downsize nodes.
This commit is contained in:
2024-03-11 22:47:48 -07:00
parent 5e4eab55fb
commit b721bc80a9

View File

@@ -727,7 +727,8 @@ Node *nextLogical(Node *node) {
return node;
}
// Precondition: self is not the root
// Precondition: self is not the root. May invalidate nodes along the search
// path to self.
Node *erase(Node *self, NodeAllocators *allocators, ConflictSet::Impl *impl) {
assert(self->parent != nullptr);
@@ -1577,7 +1578,7 @@ bool checkRangeRead(Node *n, std::span<const uint8_t> begin,
// Returns a pointer to the newly inserted node. Caller must set
// `entryPresent`, `entry` fields and `maxVersion` on the result. The search
// path of the result's parent will have `maxVersion` at least `writeVersion` as
// a postcondition. Nodes along the search path may be invalidated.
// a postcondition. Nodes along the search path to `key` may be invalidated.
template <bool kBegin>
[[nodiscard]] Node *insert(Node **self, std::span<const uint8_t> key,
int64_t writeVersion, NodeAllocators *allocators,