Compare commits
6 Commits
6a13c43a78
...
83c7f66d67
| Author | SHA1 | Date | |
|---|---|---|---|
| 83c7f66d67 | |||
| a5710b8282 | |||
| c31eebd5de | |||
| ddeb059968 | |||
| 5a0bcf9a5a | |||
| 97717cec86 |
+21
-26
@@ -1672,7 +1672,10 @@ Vector<uint8_t> getSearchPath(Arena &arena, Node *n) {
|
|||||||
} // GCOVR_EXCL_LINE
|
} // GCOVR_EXCL_LINE
|
||||||
|
|
||||||
// Return true if the max version among all keys that start with key + [child],
|
// Return true if the max version among all keys that start with key + [child],
|
||||||
// where begin < child < end, is <= readVersion
|
// where begin < child < end, is <= readVersion.
|
||||||
|
//
|
||||||
|
// Precondition: transitively, no child of n has a search path that's a longer
|
||||||
|
// prefix of key than n
|
||||||
bool checkRangeStartsWith(Node *n, std::span<const uint8_t> key, int begin,
|
bool checkRangeStartsWith(Node *n, std::span<const uint8_t> key, int begin,
|
||||||
int end, int64_t readVersion,
|
int end, int64_t readVersion,
|
||||||
ConflictSet::Impl *impl) {
|
ConflictSet::Impl *impl) {
|
||||||
@@ -1680,10 +1683,6 @@ bool checkRangeStartsWith(Node *n, std::span<const uint8_t> key, int begin,
|
|||||||
fprintf(stderr, "%s(%02x,%02x)*\n", printable(key).c_str(), begin, end);
|
fprintf(stderr, "%s(%02x,%02x)*\n", printable(key).c_str(), begin, end);
|
||||||
#endif
|
#endif
|
||||||
auto remaining = key;
|
auto remaining = key;
|
||||||
for (;;) {
|
|
||||||
if (maxVersion(n, impl) <= readVersion) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (remaining.size() == 0) {
|
if (remaining.size() == 0) {
|
||||||
return maxBetweenExclusive(n, begin, end) <= readVersion;
|
return maxBetweenExclusive(n, begin, end) <= readVersion;
|
||||||
}
|
}
|
||||||
@@ -1703,7 +1702,8 @@ bool checkRangeStartsWith(Node *n, std::span<const uint8_t> key, int begin,
|
|||||||
n = child;
|
n = child;
|
||||||
remaining = remaining.subspan(1, remaining.size() - 1);
|
remaining = remaining.subspan(1, remaining.size() - 1);
|
||||||
|
|
||||||
if (n->partialKeyLen > 0) {
|
assert(n->partialKeyLen > 0);
|
||||||
|
{
|
||||||
int commonLen = std::min<int>(n->partialKeyLen, remaining.size());
|
int commonLen = std::min<int>(n->partialKeyLen, remaining.size());
|
||||||
int i = longestCommonPrefix(n->partialKey(), remaining.data(), commonLen);
|
int i = longestCommonPrefix(n->partialKey(), remaining.data(), commonLen);
|
||||||
if (i < commonLen) {
|
if (i < commonLen) {
|
||||||
@@ -1715,10 +1715,7 @@ bool checkRangeStartsWith(Node *n, std::span<const uint8_t> key, int begin,
|
|||||||
goto downLeftSpine;
|
goto downLeftSpine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (commonLen == n->partialKeyLen) {
|
assert(n->partialKeyLen > int(remaining.size()));
|
||||||
// partial key matches
|
|
||||||
remaining = remaining.subspan(commonLen, remaining.size() - commonLen);
|
|
||||||
} else if (n->partialKeyLen > int(remaining.size())) {
|
|
||||||
if (begin < n->partialKey()[remaining.size()] &&
|
if (begin < n->partialKey()[remaining.size()] &&
|
||||||
n->partialKey()[remaining.size()] < end) {
|
n->partialKey()[remaining.size()] < end) {
|
||||||
if (n->entryPresent && n->entry.rangeVersion > readVersion) {
|
if (n->entryPresent && n->entry.rangeVersion > readVersion) {
|
||||||
@@ -1728,8 +1725,9 @@ bool checkRangeStartsWith(Node *n, std::span<const uint8_t> key, int begin,
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
|
|
||||||
downLeftSpine:
|
downLeftSpine:
|
||||||
if (n == nullptr) {
|
if (n == nullptr) {
|
||||||
return true;
|
return true;
|
||||||
@@ -1836,9 +1834,7 @@ struct CheckRangeLeftSide {
|
|||||||
remaining =
|
remaining =
|
||||||
remaining.subspan(commonLen, remaining.size() - commonLen);
|
remaining.subspan(commonLen, remaining.size() - commonLen);
|
||||||
} else if (n->partialKeyLen > int(remaining.size())) {
|
} else if (n->partialKeyLen > int(remaining.size())) {
|
||||||
if (searchPathLen < prefixLen) {
|
assert(searchPathLen >= prefixLen);
|
||||||
return downLeftSpine();
|
|
||||||
}
|
|
||||||
if (n->entryPresent && n->entry.rangeVersion > readVersion) {
|
if (n->entryPresent && n->entry.rangeVersion > readVersion) {
|
||||||
ok = false;
|
ok = false;
|
||||||
return true;
|
return true;
|
||||||
@@ -2017,10 +2013,7 @@ struct CheckRangeRightSide {
|
|||||||
|
|
||||||
bool downLeftSpine() {
|
bool downLeftSpine() {
|
||||||
phase = DownLeftSpine;
|
phase = DownLeftSpine;
|
||||||
if (n == nullptr) {
|
assert(n != nullptr);
|
||||||
ok = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -2356,6 +2349,9 @@ Iterator firstGeq(Node *n, const std::span<const uint8_t> key) {
|
|||||||
goto downLeftSpine;
|
goto downLeftSpine;
|
||||||
} else {
|
} else {
|
||||||
n = nextSibling(n);
|
n = nextSibling(n);
|
||||||
|
if (n == nullptr) {
|
||||||
|
return {nullptr, 1};
|
||||||
|
}
|
||||||
goto downLeftSpine;
|
goto downLeftSpine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2386,9 +2382,6 @@ Iterator firstGeq(Node *n, const std::span<const uint8_t> key) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
downLeftSpine:
|
downLeftSpine:
|
||||||
if (n == nullptr) {
|
|
||||||
return {nullptr, 1};
|
|
||||||
}
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (n->entryPresent) {
|
if (n->entryPresent) {
|
||||||
return {n, 1};
|
return {n, 1};
|
||||||
@@ -2438,9 +2431,14 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->oldestVersion = oldestVersion;
|
this->oldestVersion = oldestVersion;
|
||||||
|
#ifdef NDEBUG
|
||||||
|
// This is here for performance reasons, since we want to amortize the cost
|
||||||
|
// of storing the search path as a string. In tests, we want to exercise the
|
||||||
|
// rest of the code often.
|
||||||
if (keyUpdates < 100) {
|
if (keyUpdates < 100) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
Node *n = firstGeq(root, removalKey).n;
|
Node *n = firstGeq(root, removalKey).n;
|
||||||
// There's no way to erase removalKey without introducing a key after it
|
// There's no way to erase removalKey without introducing a key after it
|
||||||
assert(n != nullptr);
|
assert(n != nullptr);
|
||||||
@@ -2468,9 +2466,6 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
|
|||||||
removalKey = {};
|
removalKey = {};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (keyUpdates == 0) {
|
|
||||||
keyUpdates = 10;
|
|
||||||
}
|
|
||||||
removalKeyArena = Arena();
|
removalKeyArena = Arena();
|
||||||
removalKey = getSearchPath(removalKeyArena, n);
|
removalKey = getSearchPath(removalKeyArena, n);
|
||||||
}
|
}
|
||||||
@@ -2511,7 +2506,7 @@ int64_t &maxVersion(Node *n, ConflictSet::Impl *impl) {
|
|||||||
return impl->rootMaxVersion;
|
return impl->rootMaxVersion;
|
||||||
}
|
}
|
||||||
switch (n->getType()) {
|
switch (n->getType()) {
|
||||||
case Type_Node0:
|
case Type_Node0: // GCOVR_EXCL_LINE
|
||||||
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
case Type_Node3: {
|
case Type_Node3: {
|
||||||
auto *n3 = static_cast<Node3 *>(n);
|
auto *n3 = static_cast<Node3 *>(n);
|
||||||
|
|||||||
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user