2 Commits

Author SHA1 Message Date
2646d5eaf1 Get back to 100% coverage
Some checks failed
Tests / Clang total: 1776, failed: 232, passed: 1544
Tests / SIMD fallback total: 1776, failed: 232, passed: 1544
Tests / 32-bit versions total: 1776, failed: 232, passed: 1544
Tests / Release [gcc] total: 1776, failed: 232, passed: 1544
Tests / Release [gcc,aarch64] total: 1327, failed: 116, passed: 1211
Tests / Coverage total: 1333, failed: 233, passed: 1100
weaselab/conflict-set/pipeline/head There was a failure building this commit
Closes #30

This is achieved by running libfuzzer with USE_32_BIT_VERSIONS={OFF,ON},
and then combining the corpora. I suspect that the problem earlier was
that we only had the 32 bit corpus but were measuring coverage for 64
bit in jenkins.
2024-06-30 21:15:42 -07:00
0367ba9856 Fast path for prefix reads 2024-06-30 20:33:54 -07:00
700 changed files with 85 additions and 7 deletions

View File

@@ -1708,6 +1708,83 @@ downLeftSpine:
}
}
// Logically this is the same as performing firstGeq and then checking against
// max version or range version if this prefix doesn't exist, but this version
// short circuits as soon as it can prove that there's no conflict.
bool checkPrefixRead(Node *n, const std::span<const uint8_t> key,
InternalVersionT readVersion, ConflictSet::Impl *impl) {
#if DEBUG_VERBOSE && !defined(NDEBUG)
fprintf(stderr, "Check prefix read: %s\n", printable(key).c_str());
#endif
auto remaining = key;
for (;;) {
auto m = maxVersion(n, impl);
if (remaining.size() == 0) {
return m <= readVersion;
}
if (m <= readVersion) {
return true;
}
auto *child = getChild(n, remaining[0]);
if (child == nullptr) {
int c = getChildGeq(n, remaining[0]);
if (c >= 0) {
n = getChildExists(n, c);
goto downLeftSpine;
} else {
n = nextSibling(n);
if (n == nullptr) {
return true;
}
goto downLeftSpine;
}
}
n = child;
remaining = remaining.subspan(1, remaining.size() - 1);
if (n->partialKeyLen > 0) {
int commonLen = std::min<int>(n->partialKeyLen, remaining.size());
int i = longestCommonPrefix(n->partialKey(), remaining.data(), commonLen);
if (i < commonLen) {
auto c = n->partialKey()[i] <=> remaining[i];
if (c > 0) {
goto downLeftSpine;
} else {
n = nextSibling(n);
if (n == nullptr) {
return true;
}
goto downLeftSpine;
}
}
if (commonLen == n->partialKeyLen) {
// partial key matches
remaining = remaining.subspan(commonLen, remaining.size() - commonLen);
} else if (n->partialKeyLen > int(remaining.size())) {
// n is the first physical node greater than remaining, and there's no
// eq node. All physical nodes that start with prefix are reachable from
// n.
if (maxVersion(n, impl) > readVersion) {
return false;
}
goto downLeftSpine;
}
}
}
downLeftSpine:
for (;;) {
if (n->entryPresent) {
return n->entry.rangeVersion <= readVersion;
}
int c = getChildGeq(n, 0);
assert(c >= 0);
n = getChildExists(n, c);
}
}
#ifdef HAS_AVX
uint32_t compare16_32bit(const InternalVersionT *vs, InternalVersionT rv) {
uint32_t compared = 0;
@@ -1890,7 +1967,7 @@ bool checkMaxBetweenExclusive(Node *n, int begin, int end,
InternalVersionT readVersion) {
assume(-1 <= begin);
assume(begin <= 256);
assume(-1 <= end);
assume(0 < end);
assume(end <= 256);
assume(begin < end);
@@ -1962,9 +2039,6 @@ bool checkMaxBetweenExclusive(Node *n, int begin, int end,
case Type_Node256: {
static_assert(Node256::kMaxOfMaxTotalPages == 16);
auto *self = static_cast<Node256 *>(n);
if (end <= 0) {
return true;
}
const int firstPage = begin >> Node256::kMaxOfMaxShift;
const int lastPage = (end - 1) >> Node256::kMaxOfMaxShift;
// Check the only page if there's only one
@@ -2367,6 +2441,10 @@ bool checkRangeReadImpl(Node *n, std::span<const uint8_t> begin,
end.back() == 0) {
return checkPointRead(n, begin, readVersion, impl);
}
if (lcp == int(begin.size() - 1) && end.size() == begin.size() &&
int(begin.back()) + 1 == int(end.back())) {
return checkPrefixRead(n, begin, readVersion, impl);
}
SearchStepWise search{n, begin.subspan(0, lcp)};
Arena arena;

3
Jenkinsfile vendored
View File

@@ -123,8 +123,7 @@ pipeline {
'''
recordCoverage qualityGates: [[criticality: 'NOTE', metric: 'MODULE']], tools: [[parser: 'COBERTURA', pattern: 'build/coverage.xml']]
sh '''
# Temporarily remove until we finish the transition to 32-bit versions
# gcovr -f ConflictSet.cpp --fail-under-line 100 > /dev/null
gcovr -f ConflictSet.cpp --fail-under-line 100 > /dev/null
'''
}
}

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.

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.

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.

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 B

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.

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.

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More