Short circuit point reads based on maxVersion
All checks were successful
Tests / Release [gcc] total: 337, passed: 337
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Reference build: <a href="https://jenkins.weaselab.dev/job/weaselab/job/conflict-set/job/main/5//gcc">weaselab » conflict-set » main #5</a>
Tests / Coverage total: 335, passed: 335
weaselab/conflict-set/pipeline/head This commit looks good
All checks were successful
Tests / Release [gcc] total: 337, passed: 337
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Reference build: <a href="https://jenkins.weaselab.dev/job/weaselab/job/conflict-set/job/main/5//gcc">weaselab » conflict-set » main #5</a>
Tests / Coverage total: 335, passed: 335
weaselab/conflict-set/pipeline/head This commit looks good
This commit is contained in:
110
ConflictSet.cpp
110
ConflictSet.cpp
@@ -602,20 +602,6 @@ Node *prevPhysical(Node *node) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *nextSibling(Node *node) {
|
|
||||||
for (;;) {
|
|
||||||
if (node->parent == nullptr) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
auto next = getChildGeq(node->parent, node->parentsIndex + 1);
|
|
||||||
if (next < 0) {
|
|
||||||
node = node->parent;
|
|
||||||
} else {
|
|
||||||
return getChildExists(node->parent, next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Node *prevLogical(Node *node) {
|
Node *prevLogical(Node *node) {
|
||||||
for (node = prevPhysical(node); node != nullptr && !node->entryPresent;
|
for (node = prevPhysical(node); node != nullptr && !node->entryPresent;
|
||||||
node = prevPhysical(node))
|
node = prevPhysical(node))
|
||||||
@@ -724,6 +710,88 @@ downLeftSpine:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Logically this is the same as performing firstGeq and then checking against
|
||||||
|
// point or range version according to cmp, but this version short circuits if
|
||||||
|
// it can prove that both point and range versions of firstGeq are <=
|
||||||
|
// readVersion.
|
||||||
|
bool checkPointRead(Node *n, const std::span<const uint8_t> key,
|
||||||
|
int64_t readVersion) {
|
||||||
|
auto remaining = key;
|
||||||
|
Node *nextSib = nullptr;
|
||||||
|
for (;;) {
|
||||||
|
if (std::max(nextSib != nullptr ? nextSib->maxVersion
|
||||||
|
: std::numeric_limits<int64_t>::lowest(),
|
||||||
|
n->maxVersion) <= readVersion) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (n->partialKeyLen > 0) {
|
||||||
|
int commonLen = std::min<int>(n->partialKeyLen, remaining.size());
|
||||||
|
for (int i = 0; i < commonLen; ++i) {
|
||||||
|
auto c = n->partialKey[i] <=> remaining[i];
|
||||||
|
if (c == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c > 0) {
|
||||||
|
goto downLeftSpine;
|
||||||
|
} else {
|
||||||
|
n = nextSib;
|
||||||
|
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
|
||||||
|
goto downLeftSpine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (remaining.size() == 0) {
|
||||||
|
if (n->entryPresent) {
|
||||||
|
return n->entry.pointVersion <= readVersion;
|
||||||
|
}
|
||||||
|
int c = getChildGeq(n, 0);
|
||||||
|
assert(c >= 0);
|
||||||
|
n = getChildExists(n, c);
|
||||||
|
goto downLeftSpine;
|
||||||
|
} else {
|
||||||
|
int c = getChildGeq(n, remaining[0]);
|
||||||
|
int c2 = getChildGeq(n, int(remaining[0]) + 1);
|
||||||
|
if (c2 >= 0) {
|
||||||
|
nextSib = getChildExists(n, c2);
|
||||||
|
}
|
||||||
|
if (c == remaining[0]) {
|
||||||
|
n = getChildExists(n, c);
|
||||||
|
remaining = remaining.subspan(1, remaining.size() - 1);
|
||||||
|
} else {
|
||||||
|
if (c >= 0) {
|
||||||
|
n = getChildExists(n, c);
|
||||||
|
goto downLeftSpine;
|
||||||
|
} else {
|
||||||
|
n = nextSib;
|
||||||
|
goto downLeftSpine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
downLeftSpine:
|
||||||
|
if (n == nullptr) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (;;) {
|
||||||
|
if (n->maxVersion <= readVersion) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (n->entryPresent) {
|
||||||
|
return n->entry.rangeVersion <= readVersion;
|
||||||
|
}
|
||||||
|
int c = getChildGeq(n, 0);
|
||||||
|
assert(c >= 0);
|
||||||
|
n = getChildExists(n, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Returns a pointer to the newly inserted node. caller is reponsible for
|
// Returns a pointer to the newly inserted node. caller is reponsible for
|
||||||
// setting 'entry' fields on the result, which may have !entryPresent. The
|
// setting 'entry' fields on the result, which may have !entryPresent. The
|
||||||
// search path for `key` will have maxVersion at least `writeVersion` as a
|
// search path for `key` will have maxVersion at least `writeVersion` as a
|
||||||
@@ -852,14 +920,12 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto iter = firstGeq(root, std::span<const uint8_t>(
|
result[i] = checkPointRead(root,
|
||||||
reads[i].begin.p, reads[i].begin.len));
|
std::span<const uint8_t>(reads[i].begin.p,
|
||||||
result[i] = (iter.n == nullptr ? oldestVersion
|
reads[i].begin.len),
|
||||||
: iter.cmp == 0
|
reads[i].readVersion)
|
||||||
? iter.n->entry.pointVersion
|
? Commit
|
||||||
: iter.n->entry.rangeVersion) > reads[i].readVersion
|
: Conflict;
|
||||||
? Conflict
|
|
||||||
: Commit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
corpus/021b467a9fcdb9bc7781923a7405cc44228633d8
Normal file
BIN
corpus/021b467a9fcdb9bc7781923a7405cc44228633d8
Normal file
Binary file not shown.
BIN
corpus/0313b975b940a467065d2b45ba1bf0e5f6f52750
Normal file
BIN
corpus/0313b975b940a467065d2b45ba1bf0e5f6f52750
Normal file
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.
BIN
corpus/0a2a7c74b2104d0d84d2f5df8802b16a95ba7d4a
Normal file
BIN
corpus/0a2a7c74b2104d0d84d2f5df8802b16a95ba7d4a
Normal file
Binary file not shown.
Binary file not shown.
BIN
corpus/0ce15bb7dbb7e51cc1bf88359141a751b3e7c4a3
Normal file
BIN
corpus/0ce15bb7dbb7e51cc1bf88359141a751b3e7c4a3
Normal file
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
corpus/114e76f744aaf7953d8cdbdaff5c6440c3f39c95
Normal file
BIN
corpus/114e76f744aaf7953d8cdbdaff5c6440c3f39c95
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
corpus/1516a7473bf94e6c6f20e60a31c6b9c00ef36284
Normal file
BIN
corpus/1516a7473bf94e6c6f20e60a31c6b9c00ef36284
Normal file
Binary file not shown.
Binary file not shown.
BIN
corpus/15f0fa8c17dfba29ac30bd7be8bbda650ac2a108
Normal file
BIN
corpus/15f0fa8c17dfba29ac30bd7be8bbda650ac2a108
Normal file
Binary file not shown.
Binary file not shown.
BIN
corpus/1782a4b3d345d3c5950585d8bf3aa90ed4e2121f
Normal file
BIN
corpus/1782a4b3d345d3c5950585d8bf3aa90ed4e2121f
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
<01><><EFBFBD>
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
corpus/1b2be2e2f6eb12023bc9b57e77fa42ff7dfdc837
Normal file
BIN
corpus/1b2be2e2f6eb12023bc9b57e77fa42ff7dfdc837
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
corpus/1ef3d9ea81980b6ff0f4b5770e0d50f76c2e33ed
Normal file
BIN
corpus/1ef3d9ea81980b6ff0f4b5770e0d50f76c2e33ed
Normal file
Binary file not shown.
BIN
corpus/1f49a923687c7f0e77683617df33ae1fa9b98a3a
Normal file
BIN
corpus/1f49a923687c7f0e77683617df33ae1fa9b98a3a
Normal file
Binary file not shown.
Binary file not shown.
BIN
corpus/23514ea7b89afcd4bc781ac0f2860e2a60cbfe5d
Normal file
BIN
corpus/23514ea7b89afcd4bc781ac0f2860e2a60cbfe5d
Normal file
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
corpus/26da75f6d1d6e30f8970af97cb9e60224d266ae7
Normal file
BIN
corpus/26da75f6d1d6e30f8970af97cb9e60224d266ae7
Normal file
Binary file not shown.
Binary file not shown.
BIN
corpus/2abb4b9c1ec5e81b0214faa10a0bb84abd3dd1a3
Normal file
BIN
corpus/2abb4b9c1ec5e81b0214faa10a0bb84abd3dd1a3
Normal file
Binary file not shown.
BIN
corpus/2aed1356d1b6f3500255f8135b27f50fb12b7cd5
Normal file
BIN
corpus/2aed1356d1b6f3500255f8135b27f50fb12b7cd5
Normal file
Binary file not shown.
Binary file not shown.
BIN
corpus/2d35e1ee0547d95a30c4cd8463f19c5555538c48
Normal file
BIN
corpus/2d35e1ee0547d95a30c4cd8463f19c5555538c48
Normal file
Binary file not shown.
BIN
corpus/2e6ad700a45cf2e0703e4bcdbf3710adb0ddbcc4
Normal file
BIN
corpus/2e6ad700a45cf2e0703e4bcdbf3710adb0ddbcc4
Normal file
Binary file not shown.
Binary file not shown.
BIN
corpus/31474fbf301561fe55ad7a3101492e5e64a22df8
Normal file
BIN
corpus/31474fbf301561fe55ad7a3101492e5e64a22df8
Normal file
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
corpus/3695235f66fc3f16266b9e9f246b8b0289e9a0aa
Normal file
BIN
corpus/3695235f66fc3f16266b9e9f246b8b0289e9a0aa
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
corpus/38f703aec3ab40807b257cea8f9c1a40049ad0c3
Normal file
BIN
corpus/38f703aec3ab40807b257cea8f9c1a40049ad0c3
Normal file
Binary file not shown.
BIN
corpus/39b704e19676f8f8329dea0028da35f09c682607
Normal file
BIN
corpus/39b704e19676f8f8329dea0028da35f09c682607
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
corpus/3b73cb47921cbe4bfa0b300ed91f1a6a695e1405
Normal file
BIN
corpus/3b73cb47921cbe4bfa0b300ed91f1a6a695e1405
Normal file
Binary file not shown.
Binary file not shown.
BIN
corpus/3c3f59f82dd5827b9083d49f7b5cdf52603ae308
Normal file
BIN
corpus/3c3f59f82dd5827b9083d49f7b5cdf52603ae308
Normal file
Binary file not shown.
Binary file not shown.
BIN
corpus/3db157b9430cc72e701b13086b2dcbb1bc5eff1c
Normal file
BIN
corpus/3db157b9430cc72e701b13086b2dcbb1bc5eff1c
Normal file
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
corpus/405e4c72934fc460cc154a924b525bb1c68b1697
Normal file
BIN
corpus/405e4c72934fc460cc154a924b525bb1c68b1697
Normal file
Binary file not shown.
BIN
corpus/4070b686f9649f4dd91d9a948489feb3dd17931d
Normal file
BIN
corpus/4070b686f9649f4dd91d9a948489feb3dd17931d
Normal file
Binary file not shown.
Binary file not shown.
BIN
corpus/40a95f7cac852feedf544e1e1a392adfa030a04c
Normal file
BIN
corpus/40a95f7cac852feedf544e1e1a392adfa030a04c
Normal file
Binary file not shown.
BIN
corpus/41afe43d6a343dca7fbcecbad5c3a47beeb92b2e
Normal file
BIN
corpus/41afe43d6a343dca7fbcecbad5c3a47beeb92b2e
Normal file
Binary file not shown.
BIN
corpus/426ce973e77a43a16f219da6156e591f7945cd62
Normal file
BIN
corpus/426ce973e77a43a16f219da6156e591f7945cd62
Normal file
Binary file not shown.
BIN
corpus/427e88c874b77076056990026dfab3925d549cf8
Normal file
BIN
corpus/427e88c874b77076056990026dfab3925d549cf8
Normal file
Binary file not shown.
Binary file not shown.
BIN
corpus/43bcf4018c8def96d743e3637c6e429b7e02105c
Normal file
BIN
corpus/43bcf4018c8def96d743e3637c6e429b7e02105c
Normal file
Binary file not shown.
BIN
corpus/4430303a1e6131e7662f7e02ee960552222cc804
Normal file
BIN
corpus/4430303a1e6131e7662f7e02ee960552222cc804
Normal file
Binary file not shown.
BIN
corpus/45d4b763004623574e56fddec3f41fc9a51a7a78
Normal file
BIN
corpus/45d4b763004623574e56fddec3f41fc9a51a7a78
Normal file
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
Reference in New Issue
Block a user