In try commit, wait for the read version future before waiting for the commit cost estimate. This allows us to give precedence to the database_locked error over errors thrown by the commit cost estimation.

This commit is contained in:
A.J. Beamon 2022-11-02 14:47:24 -07:00
parent ccfef328af
commit 93142e2c29
1 changed files with 5 additions and 2 deletions

View File

@ -6384,8 +6384,11 @@ ACTOR static Future<Void> tryCommit(Reference<TransactionState> trState,
}
if (req.tagSet.present() && trState->options.priority < TransactionPriority::IMMEDIATE) {
wait(store(req.transaction.read_snapshot, readVersion) &&
store(req.commitCostEstimation, estimateCommitCosts(trState, &req.transaction)));
state Future<Optional<ClientTrCommitCostEstimation>> commitCostFuture =
estimateCommitCosts(trState, &req.transaction);
// We need to wait for the read version first so that we can be notified if the database is locked
wait(store(req.transaction.read_snapshot, readVersion));
wait(store(req.commitCostEstimation, commitCostFuture));
} else {
wait(store(req.transaction.read_snapshot, readVersion));
}