Address some missing coverage

cc #3
This commit is contained in:
2024-03-18 13:36:35 -07:00
parent 5b0c3c2428
commit 7d4f832b43
5 changed files with 604 additions and 25 deletions

View File

@@ -472,7 +472,8 @@ inline void Node256::copyChildrenAndKeyFrom(const Node256 &other) {
namespace {
std::string getSearchPathPrintable(Node *n);
}
std::string getSearchPath(Node *n);
} // namespace
// Bound memory usage following the analysis in the ART paper
@@ -1224,28 +1225,11 @@ Node *erase(Node *self, NodeAllocators *allocators, ConflictSet::Impl *impl,
return result;
}
switch (self->getType()) {
case Type_Node0:
allocators->node0.release((Node0 *)self);
break;
case Type_Node3:
allocators->node3.release((Node3 *)self);
break;
case Type_Node16:
allocators->node16.release((Node16 *)self);
break;
case Type_Node48:
allocators->node48.release((Node48 *)self);
break;
case Type_Node256:
allocators->node256.release((Node256 *)self);
break;
default: // GCOVR_EXCL_LINE
__builtin_unreachable(); // GCOVR_EXCL_LINE
}
assert(self->getType() == Type_Node0);
allocators->node0.release((Node0 *)self);
switch (parent->getType()) {
case Type_Node0:
case Type_Node0: // GCOVR_EXCL_LINE
__builtin_unreachable(); // GCOVR_EXCL_LINE
case Type_Node3: {
auto *parent3 = static_cast<Node3 *>(parent);
@@ -2480,11 +2464,13 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
assert(n != nullptr);
// Don't erase the root
if (n == root) {
n = nextLogical(n);
n = nextPhysical(n);
}
for (; keyUpdates > 0 && n != nullptr; --keyUpdates) {
if (std::max(n->entry.pointVersion, n->entry.rangeVersion) <=
oldestVersion) {
printf("len: %d, cap: %d, type: %d %s\n", n->partialKeyLen,
n->getCapacity(), n->getType(), getSearchPath(n).c_str());
if (n->entryPresent && std::max(n->entry.pointVersion,
n->entry.rangeVersion) <= oldestVersion) {
// Any transaction n would have prevented from committing is
// going to fail with TooOld anyway.
@@ -2495,7 +2481,7 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
n = erase(n, &allocators, this, dummy);
} else {
maybeDecreaseCapacity(n, &allocators, this);
n = nextLogical(n);
n = nextPhysical(n);
}
}
if (n == nullptr) {