From b721bc80a94a886a40df3c3419584226d8a61118 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Mon, 11 Mar 2024 22:47:48 -0700 Subject: [PATCH] Document that erase may invalidate search path It doesn't yet, but it will when we downsize nodes. --- ConflictSet.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index f469124..c69d3a3 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -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 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 [[nodiscard]] Node *insert(Node **self, std::span key, int64_t writeVersion, NodeAllocators *allocators,