Increase trState->totalCost by one with each clear

This commit is contained in:
sfc-gh-tclinkenbeard 2022-10-18 14:05:46 -07:00
parent 6251e8be32
commit 92bbcebed9
2 changed files with 5 additions and 4 deletions

View File

@ -5816,6 +5816,10 @@ void Transaction::clear(const KeyRangeRef& range, AddConflictRange addConflictRa
return;
t.mutations.emplace_back(req.arena, MutationRef::ClearRange, r.begin, r.end);
// NOTE: The throttling cost of each clear is assumed to be one page.
// This makes compuation fast, but can be inaccurate and may
// underestimate the cost of large clears.
++trState->totalCost;
if (addConflictRange)
t.write_conflict_ranges.push_back(req.arena, r);

View File

@ -115,10 +115,7 @@ class TransactionCostWorkload : public TestWorkload {
return Void();
}
int64_t expectedFinalCost() const override {
// Clears are not measured in Transaction::getTotalCost
return 0;
}
int64_t expectedFinalCost() const override { return 1; }
};
class ReadRangeTest : public ITest {