Early return if common prefix isn't a prefix of an entry
Some checks failed
Tests / Clang total: 1479, passed: 1479
Clang |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Debug total: 1477, passed: 1477
Tests / SIMD fallback total: 1479, passed: 1479
Tests / Release [gcc] total: 1479, passed: 1479
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 1102, passed: 1102
Tests / Coverage total: 1111, passed: 1111
Code Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 98.00% (1812/1849)
* Branch Coverage: 64.20% (1521/2369)
* Complexity Density: 0.00
* Lines of Code: 1849
#### Quality Gates Summary
Output truncated.
weaselab/conflict-set/pipeline/head There was a failure building this commit
Some checks failed
Tests / Clang total: 1479, passed: 1479
Clang |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Debug total: 1477, passed: 1477
Tests / SIMD fallback total: 1479, passed: 1479
Tests / Release [gcc] total: 1479, passed: 1479
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 1102, passed: 1102
Tests / Coverage total: 1111, passed: 1111
Code Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 98.00% (1812/1849)
* Branch Coverage: 64.20% (1521/2369)
* Complexity Density: 0.00
* Lines of Code: 1849
#### Quality Gates Summary
Output truncated.
weaselab/conflict-set/pipeline/head There was a failure building this commit
For range reads
This commit is contained in:
@@ -2785,6 +2785,8 @@ bool checkRangeRead(Node *n, std::span<const uint8_t> begin,
|
|||||||
|
|
||||||
auto remaining = begin.subspan(0, lcp);
|
auto remaining = begin.subspan(0, lcp);
|
||||||
Arena arena;
|
Arena arena;
|
||||||
|
// If the common prefix isn't a prefix of any physical entry in the tree, we
|
||||||
|
// can go to "downLeftSpine"
|
||||||
for (;; ++tls->range_read_iterations_accum) {
|
for (;; ++tls->range_read_iterations_accum) {
|
||||||
assert(getSearchPath(arena, n) <=>
|
assert(getSearchPath(arena, n) <=>
|
||||||
begin.subspan(0, lcp - remaining.size()) ==
|
begin.subspan(0, lcp - remaining.size()) ==
|
||||||
@@ -2794,12 +2796,38 @@ bool checkRangeRead(Node *n, std::span<const uint8_t> begin,
|
|||||||
}
|
}
|
||||||
auto [child, v] = getChildAndMaxVersion(n, remaining[0]);
|
auto [child, v] = getChildAndMaxVersion(n, remaining[0]);
|
||||||
if (child == nullptr) {
|
if (child == nullptr) {
|
||||||
break;
|
auto c = getChildGeq(n, remaining[0]);
|
||||||
|
if (c != nullptr) {
|
||||||
|
n = c;
|
||||||
|
goto downLeftSpine;
|
||||||
|
} else {
|
||||||
|
n = nextSibling(n);
|
||||||
|
if (n == nullptr) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
goto downLeftSpine;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child->partialKeyLen > 0) {
|
if (child->partialKeyLen > 0) {
|
||||||
int cl = std::min<int>(child->partialKeyLen, remaining.size() - 1);
|
int cl = std::min<int>(child->partialKeyLen, remaining.size() - 1);
|
||||||
int i =
|
int i =
|
||||||
longestCommonPrefix(child->partialKey(), remaining.data() + 1, cl);
|
longestCommonPrefix(child->partialKey(), remaining.data() + 1, cl);
|
||||||
|
if (i < cl) {
|
||||||
|
auto c = child->partialKey()[i] <=> remaining[1 + i];
|
||||||
|
if (c > 0) {
|
||||||
|
n = child;
|
||||||
|
goto downLeftSpine;
|
||||||
|
} else {
|
||||||
|
n = nextSibling(child);
|
||||||
|
if (n == nullptr) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
goto downLeftSpine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If the partial key is longer than the common prefix (remaining), we
|
||||||
|
// still need to keep searching
|
||||||
if (i != child->partialKeyLen) {
|
if (i != child->partialKeyLen) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2815,6 +2843,12 @@ bool checkRangeRead(Node *n, std::span<const uint8_t> begin,
|
|||||||
}
|
}
|
||||||
assert(getSearchPath(arena, n) <=> begin.subspan(0, lcp - remaining.size()) ==
|
assert(getSearchPath(arena, n) <=> begin.subspan(0, lcp - remaining.size()) ==
|
||||||
0);
|
0);
|
||||||
|
if (0) {
|
||||||
|
downLeftSpine:
|
||||||
|
for (; !n->entryPresent; n = getFirstChildExists(n)) {
|
||||||
|
}
|
||||||
|
return n->entry.rangeVersion <= readVersion;
|
||||||
|
}
|
||||||
|
|
||||||
const int consumed = lcp - remaining.size();
|
const int consumed = lcp - remaining.size();
|
||||||
assume(consumed >= 0);
|
assume(consumed >= 0);
|
||||||
|
Reference in New Issue
Block a user