cockroachdb / cockroachdb/cockroach

kv: PREPARED transactions cannot be pushed, regardless of isolation level

Open
#137,549 0 comments 0 reactions 0 assignees View on GitHub
A-kv-transactions A-sql-pgcompat C-enhancement T-kv
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

As of https://github.com/cockroachdb/cockroach/pull/137409, a transaction that has been PREPARED as part of the XA transaction functionality cannot have its timestamp pushed, regardless of isolation level. This means that locks held by these transactions will be blocking to readers, regardless of their own isolation level. It also means that these locks will be blocking to backups.

From that PR in `txnwait.CanPushWithPriority`:
> // If the pushee transaction is prepared, never let a PUSH_TIMESTAMP through
// either. Even for isolation levels which tolerate write skew, this could
// prevent the transaction from committing due to schema-imposed commit
// deadlines. A prepared transaction must be guaranteed to succeed if it
// decides to commit.
// TODO(nvanbenschoten): if we did want to allow prepared transactions at
// weak isolation levels to be pushed, we would need to do something about
// commit deadlines. Instead of leasing schema objects and placing deadlines
// on the transactions that use those leases, we would probably need to lock
// schema objects (for share) and continue to hold those locks while a
// transaction is prepared. This would prevent schema changes that would
// invalidate the prepared transactions.

This is different than Postgres, where these prepared transactions are non-blocking to readers.

Jira issue: CRDB-45646

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.