Remove separate prefix write codepath for now
This commit is contained in:
@@ -800,7 +800,6 @@ struct WriteContext {
|
|||||||
int64_t nodes_allocated;
|
int64_t nodes_allocated;
|
||||||
int64_t nodes_released;
|
int64_t nodes_released;
|
||||||
int64_t point_writes;
|
int64_t point_writes;
|
||||||
int64_t prefix_writes;
|
|
||||||
int64_t range_writes;
|
int64_t range_writes;
|
||||||
int64_t write_bytes;
|
int64_t write_bytes;
|
||||||
} accum;
|
} accum;
|
||||||
@@ -3188,55 +3187,6 @@ void fixupMaxVersion(Node *node, ConflictSet::Impl *impl, WriteContext *tls) {
|
|||||||
setMaxVersion(node, impl, max);
|
setMaxVersion(node, impl, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPrefixWrite(Node *&root, std::span<const uint8_t> begin,
|
|
||||||
std::span<const uint8_t> end, InternalVersionT writeVersion,
|
|
||||||
WriteContext *tls, ConflictSet::Impl *impl) {
|
|
||||||
++tls->accum.prefix_writes;
|
|
||||||
int lcp = begin.size() - 1;
|
|
||||||
|
|
||||||
Node **useAsRoot =
|
|
||||||
insert(&root, begin.subspan(0, lcp), writeVersion, tls, impl);
|
|
||||||
|
|
||||||
auto *beginNode =
|
|
||||||
*insert(useAsRoot, begin.subspan(lcp, 1), writeVersion, tls, impl);
|
|
||||||
|
|
||||||
const bool insertedBegin = !beginNode->entryPresent;
|
|
||||||
|
|
||||||
addKey(beginNode);
|
|
||||||
beginNode->entryPresent = true;
|
|
||||||
|
|
||||||
if (insertedBegin) {
|
|
||||||
++tls->accum.entries_inserted;
|
|
||||||
auto *p = nextLogical(beginNode);
|
|
||||||
beginNode->entry.rangeVersion =
|
|
||||||
p == nullptr ? tls->zero : std::max(p->entry.rangeVersion, tls->zero);
|
|
||||||
beginNode->entry.pointVersion = writeVersion;
|
|
||||||
}
|
|
||||||
assert(writeVersion >= beginNode->entry.pointVersion);
|
|
||||||
beginNode->entry.pointVersion = writeVersion;
|
|
||||||
|
|
||||||
auto *endNode =
|
|
||||||
*insert(useAsRoot, end.subspan(lcp, 1), writeVersion, tls, impl);
|
|
||||||
|
|
||||||
const bool insertedEnd = !endNode->entryPresent;
|
|
||||||
|
|
||||||
addKey(endNode);
|
|
||||||
endNode->entryPresent = true;
|
|
||||||
|
|
||||||
if (insertedEnd) {
|
|
||||||
++tls->accum.entries_inserted;
|
|
||||||
auto *p = nextLogical(endNode);
|
|
||||||
endNode->entry.pointVersion =
|
|
||||||
p == nullptr ? tls->zero : std::max(p->entry.rangeVersion, tls->zero);
|
|
||||||
}
|
|
||||||
endNode->entry.rangeVersion = writeVersion;
|
|
||||||
|
|
||||||
eraseBetween(getInTree(beginNode, impl), 0, 256, tls);
|
|
||||||
|
|
||||||
// Inserting end trashed endNode's maxVersion. Fix that
|
|
||||||
fixupMaxVersion(endNode, impl, tls);
|
|
||||||
}
|
|
||||||
|
|
||||||
void addWriteRange(Node *&root, std::span<const uint8_t> begin,
|
void addWriteRange(Node *&root, std::span<const uint8_t> begin,
|
||||||
std::span<const uint8_t> end, InternalVersionT writeVersion,
|
std::span<const uint8_t> end, InternalVersionT writeVersion,
|
||||||
WriteContext *tls, ConflictSet::Impl *impl) {
|
WriteContext *tls, ConflictSet::Impl *impl) {
|
||||||
@@ -3247,10 +3197,6 @@ void addWriteRange(Node *&root, std::span<const uint8_t> begin,
|
|||||||
end.back() == 0) {
|
end.back() == 0) {
|
||||||
return addPointWrite(root, begin, writeVersion, tls, impl);
|
return addPointWrite(root, begin, writeVersion, tls, impl);
|
||||||
}
|
}
|
||||||
if (lcp == int(begin.size() - 1) && end.size() == begin.size() &&
|
|
||||||
int(begin.back()) + 1 == int(end.back())) {
|
|
||||||
return addPrefixWrite(root, begin, end, writeVersion, tls, impl);
|
|
||||||
}
|
|
||||||
++tls->accum.range_writes;
|
++tls->accum.range_writes;
|
||||||
const bool beginIsPrefix = lcp == int(begin.size());
|
const bool beginIsPrefix = lcp == int(begin.size());
|
||||||
|
|
||||||
@@ -3457,7 +3403,6 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
|
|||||||
|
|
||||||
memory_bytes.set(totalBytes);
|
memory_bytes.set(totalBytes);
|
||||||
point_writes_total.add(tls.accum.point_writes);
|
point_writes_total.add(tls.accum.point_writes);
|
||||||
prefix_writes_total.add(tls.accum.prefix_writes);
|
|
||||||
range_writes_total.add(tls.accum.range_writes);
|
range_writes_total.add(tls.accum.range_writes);
|
||||||
nodes_allocated_total.add(tls.accum.nodes_allocated);
|
nodes_allocated_total.add(tls.accum.nodes_allocated);
|
||||||
nodes_released_total.add(tls.accum.nodes_released);
|
nodes_released_total.add(tls.accum.nodes_released);
|
||||||
@@ -3656,7 +3601,6 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
|
|||||||
"Total number of checks where the result is \"too old\"");
|
"Total number of checks where the result is \"too old\"");
|
||||||
COUNTER(check_bytes_total, "Total number of key bytes checked");
|
COUNTER(check_bytes_total, "Total number of key bytes checked");
|
||||||
COUNTER(point_writes_total, "Total number of point writes");
|
COUNTER(point_writes_total, "Total number of point writes");
|
||||||
COUNTER(prefix_writes_total, "Total number of prefix writes");
|
|
||||||
COUNTER(range_writes_total, "Total number of range writes");
|
COUNTER(range_writes_total, "Total number of range writes");
|
||||||
GAUGE(memory_bytes, "Total number of bytes in use");
|
GAUGE(memory_bytes, "Total number of bytes in use");
|
||||||
COUNTER(nodes_allocated_total,
|
COUNTER(nodes_allocated_total,
|
||||||
|
Reference in New Issue
Block a user