diff --git a/ConflictSet.cpp b/ConflictSet.cpp index e2cfceb..91e9459 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -3166,6 +3166,7 @@ void eraseInRange(Node *beginNode, Node *endNode, WriteContext *writeContext, for (iter = nextLogical(iter); !iter->endOfRange; iter = erase(iter, writeContext, impl, /*logical*/ true)) { assert(!iter->endOfRange); + assert(!iter->releaseDeferred); } assert(iter->endOfRange); iter->endOfRange = false; @@ -4892,18 +4893,29 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl { // Phase 2: Perform insertions. Nodes may be upsized during this phase, but // old nodes get forwarding pointers installed and are released after - // phase 2. + // phase 2. The search path of a node does not change in this phase. for (int i = 0; i < count; ++i) { #if DEBUG_VERBOSE && !defined(NDEBUG) - fprintf(stderr, "search path: %s, begin: %s\n", - getSearchPathPrintable(context.results[i].insertionPoint).c_str(), - printable(writes[i].begin).c_str()); - fprintf( - stderr, "search path: %s, end: %s\n", - getSearchPathPrintable(context.results[i].endInsertionPoint).c_str(), - printable(writes[i].end).c_str()); + { + Node *b = context.results[i].insertionPoint; + Node *e = context.results[i].endInsertionPoint; + while (b->releaseDeferred) { + b = b->forwardTo; + } + if (e != nullptr) { + while (e->releaseDeferred) { + e = b->forwardTo; + } + } + fprintf(stderr, "search path: %s, begin: %s\n", + getSearchPathPrintable(b).c_str(), + printable(context.results[i].remaining).c_str()); + fprintf(stderr, "search path: %s, end: %s\n", + getSearchPathPrintable(e).c_str(), + printable(context.results[i].endRemaining).c_str()); + } #endif while (context.results[i].insertionPoint->releaseDeferred) { diff --git a/Internal.h b/Internal.h index dfc3d70..8116f01 100644 --- a/Internal.h +++ b/Internal.h @@ -609,7 +609,7 @@ inline std::string printable(const Key &key) { return printable(std::string_view((const char *)key.p, key.len)); } -inline std::string printable(std::span key) { +inline std::string printable(TrivialSpan key) { return printable(std::string_view((const char *)key.data(), key.size())); }