Drain all pending work in hashtable's setOldestVersion

This commit is contained in:
2024-03-05 17:18:58 -08:00
parent d81d02f11d
commit c8495b1695
2 changed files with 12 additions and 9 deletions

View File

@@ -60,7 +60,6 @@ void benchConflictSet() {
ConflictSet cs{0};
bench.batch(kOpsPerTx);
bench.minEpochIterations(10000);
int64_t version = 0;
@@ -239,6 +238,8 @@ void benchConflictSet() {
cs.setOldestVersion(version - kMvccWindow);
bench.minEpochIterations(1000000);
{
bench.run("monotonic increasing point writes", [&]() {
auto v = ++version;

View File

@@ -56,16 +56,18 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
return;
}
auto iter = map.find(removalKey);
while (keyUpdates > 0) {
if (iter == map.end()) {
iter = map.begin();
}
for (; keyUpdates > 0 && iter != map.end(); --keyUpdates) {
for (; iter != map.end(); --keyUpdates) {
if (iter->second <= oldestVersion) {
iter = map.erase(iter);
} else {
++iter;
}
}
}
if (iter == map.end()) {
removalKey.clear();
} else {