sql: add per-statement retry loop for read committed transactions #100145
Labels
A-read-committed
Related to the introduction of Read Committed
A-sql-executor
SQL txn logic
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
T-sql-foundations
SQL Foundations Team (formerly SQL Schema + SQL Sessions)
CockroachDB's planned implementation of read committed isolation will use a per-statement read snapshot. A key property of this isolation level is that it can provide per-statement consistency without client-side intervention (e.g. retry errors are not returned to the client) through the use of a gateway-side per-statement retry loop. The use of a per-statement read snapshot means that the retry loop can catch isolation (WriteTooOld) and consistency (ReadWithinUncertainty) retry errors and retry just the current statement using a new read snapshot.
We'll need to build out this retry loop, likely with the use of internal transaction savepoints.
We'll also want to add a configurable retry limit for cases where per-statement consistency is getting starved on write-write conflicts.
For the case of implicit transactions (possibly only ones that are a single statement), it might be more expedient to simply use the existing retry logic, rather than adding overhead with savepoints.
Open questions:
Jira issue: CRDB-26568
Epic CRDB-26546
The text was updated successfully, but these errors were encountered: