cockroachdb / cockroachdb/cockroach

kv: PUSH_TIMESTAMP with sufficient priority can starve transaction commit

Open
#95,227 5 comments 0 reactions 0 assignees View on GitHub
A-kv-transactions A-non-blocking-reads C-bug O-support P-3 T-kv
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

In cases where one class of txns has sufficient priority to repeatedly push the intent of another class of txn, the lower priority transactions can be starved from committing. When the low-priority txns start to commit, they will notice that they have had their write timestamp pushed. They will refresh, which may take 10-100ms. By the time this completes, they may have been pushed again so they still won't be able to commit. Eventually this retry loop will bottom out and hit `maxTxnRefreshAttempts`, and the retry errors will be thrown back to the client.

I don't think this form of starvation is desirable or the intended behavior of transaction priorities. Instead, a higher-priority transaction should only be able to push the timestamp of a lower-priority transaction up to the point that the lower-priority transaction starts to commit. After that point, it should be allowed to refresh and then commit.

To resolve this, we'll want to introduce a "committing" state on the transaction record to indicate to pushers that they should wait for the commit to complete.

Jira issue: CRDB-23409

gz#19331

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.