Remove Node::endOfRange
This should simplify storing leaves directly
This commit is contained in:
@@ -291,8 +291,6 @@ struct Node {
|
|||||||
int32_t partialKeyLen;
|
int32_t partialKeyLen;
|
||||||
int16_t numChildren;
|
int16_t numChildren;
|
||||||
bool entryPresent;
|
bool entryPresent;
|
||||||
// Temp variable used to signal the end of the range during addWriteRange
|
|
||||||
bool endOfRange;
|
|
||||||
uint8_t parentsIndex;
|
uint8_t parentsIndex;
|
||||||
/* end section that's copied to the next node */
|
/* end section that's copied to the next node */
|
||||||
|
|
||||||
@@ -699,7 +697,6 @@ template <class T> struct NodeAllocator {
|
|||||||
|
|
||||||
T *allocate(int capacity) {
|
T *allocate(int capacity) {
|
||||||
T *result = allocate_helper(capacity);
|
T *result = allocate_helper(capacity);
|
||||||
result->endOfRange = false;
|
|
||||||
result->releaseDeferred = false;
|
result->releaseDeferred = false;
|
||||||
if constexpr (!std::is_same_v<T, Node0>) {
|
if constexpr (!std::is_same_v<T, Node0>) {
|
||||||
const auto z = InternalVersionT::zero;
|
const auto z = InternalVersionT::zero;
|
||||||
@@ -2976,18 +2973,19 @@ AddedWriteRange addWriteRange(Node *beginRoot, TrivialSpan begin, Node *endRoot,
|
|||||||
|
|
||||||
void eraseInRange(Node *beginNode, Node *endNode, WriteContext *writeContext,
|
void eraseInRange(Node *beginNode, Node *endNode, WriteContext *writeContext,
|
||||||
ConflictSet::Impl *impl) {
|
ConflictSet::Impl *impl) {
|
||||||
|
auto checkNodesEq = [](Node *lhs, Node *&rhs) {
|
||||||
|
assert(!lhs->releaseDeferred);
|
||||||
|
while (rhs->releaseDeferred) [[unlikely]] {
|
||||||
|
rhs = rhs->forwardTo;
|
||||||
|
}
|
||||||
|
return lhs == rhs;
|
||||||
|
};
|
||||||
|
|
||||||
// Erase nodes in range
|
// Erase nodes in range
|
||||||
assert(!beginNode->endOfRange);
|
Node *iter = nextLogical(beginNode);
|
||||||
assert(!endNode->endOfRange);
|
for (; !checkNodesEq(iter, endNode);
|
||||||
endNode->endOfRange = true;
|
|
||||||
Node *iter = beginNode;
|
|
||||||
for (iter = nextLogical(iter); !iter->endOfRange;
|
|
||||||
iter = erase(iter, writeContext, impl, /*logical*/ true)) {
|
iter = erase(iter, writeContext, impl, /*logical*/ true)) {
|
||||||
assert(!iter->endOfRange);
|
|
||||||
assert(!iter->releaseDeferred);
|
|
||||||
}
|
}
|
||||||
assert(iter->endOfRange);
|
|
||||||
iter->endOfRange = false;
|
|
||||||
|
|
||||||
// Inserting end trashed the last node's maxVersion. Fix that. Safe to call
|
// Inserting end trashed the last node's maxVersion. Fix that. Safe to call
|
||||||
// since the end key always has non-zero size.
|
// since the end key always has non-zero size.
|
||||||
|
Reference in New Issue
Block a user