Skip to content

Fix transaction 'read-view' and 'conflicted' states #7240

@CuriousGeorgiy

Description

@CuriousGeorgiy

Description

Currently, there is a fundamental logical inconsistency with read-view and conflicted states of transactions.

conflicted transactions see all prepared changes (e.g., #7238), because they are handled differently than read-view ones. At the same time, one does not know the state of the transaction until box.commit is called.

A similar problem arises with read-view transactions: if such transactions do any DML statements, they are de-facto conflicted, but this will be determined only on preparation stage

tarantool/src/box/txn.c

Lines 1006 to 1013 in 7924557

/*
* Somebody else has written some value that we have read.
* The RW transaction is not possible.
*/
if (txn->status == TXN_IN_READ_VIEW && !stailq_empty(&txn->stmts)) {
diag_set(ClientError, ER_TRANSACTION_CONFLICT);
return -1;
}

— at the same time, if a read-view transaction does DML statements, they will nevertheless be tracked, which is impossible without violating our tuple story invariants (see #7239).

Proposal

  1. Conflict read-view transactions on attempt to perform DML statements immediately.
  2. Make conflicted transactions unconditionally throw Aborted by conflict error on any CRUD operations until they are either rolled back or committed.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions