Remove a branch in happy path in addWrites

This commit is contained in:
2024-08-01 10:28:50 -07:00
parent f21dde06d3
commit 4cdf6deb50

View File

@@ -3174,6 +3174,8 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
assert(writeVersion >= newestVersionFullPrecision);
if (oldestExtantVersion < writeVersion - kMaxCorrectVersionWindow)
[[unlikely]] {
if (writeVersion > newestVersionFullPrecision + kNominalVersionWindow) {
destroyTree(root);
init(writeVersion - kNominalVersionWindow);
@@ -3181,13 +3183,16 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
newestVersionFullPrecision = writeVersion;
newest_version.set(newestVersionFullPrecision);
setOldestVersion(
std::max(oldestVersionFullPrecision,
newestVersionFullPrecision - kNominalVersionWindow));
setOldestVersion(newestVersionFullPrecision - kNominalVersionWindow);
while (oldestExtantVersion <
newestVersionFullPrecision - kMaxCorrectVersionWindow) {
gcScanStep(1000);
}
} else {
newestVersionFullPrecision = writeVersion;
newest_version.set(newestVersionFullPrecision);
setOldestVersion(newestVersionFullPrecision - kNominalVersionWindow);
}
for (int i = 0; i < count; ++i) {
const auto &w = writes[i];