box: fix transaction "read-view" and "conflicted" states
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 only be determined at preparation stage: https://github.com/tarantool/tarantool/blob/79245573dabf3c1eb4eb904fd80ee84270360476/src/box/txn.c#L1006-L1013 Fix this inconsistency by the following changes: 1. Conflict "read-view" transactions on attempt to perform DML statements immediately — guarantee this with an assertion at preparation stage. 2. Make conflicted transactions unconditionally throw "Transaction has been aborted by conflict" error on any CRUD operations (including read-only ones) until they are either rolled back (which will return no error) or committed (which will return the same error). Closes #7238 Closes #7239 Closes #7240 @TarantoolBot document Title: new behaviour of "conflicted" transactions "Conflicted" transactions now return "Transaction aborted by conflicted" error on any CRUD operations (including read-only ones), until they are either rolled back (which will return no error) or committed (which will return the same error).
Showing
- changelogs/unreleased/gh-7238-fix-conflicted-txs-in-memtx-ro-operations.md 4 additions, 0 deletions...ased/gh-7238-fix-conflicted-txs-in-memtx-ro-operations.md
- changelogs/unreleased/gh-7240-conflicted-transactions-error-on-all-crud-operations.md 10 additions, 0 deletions...0-conflicted-transactions-error-on-all-crud-operations.md
- src/box/txn.c 8 additions, 4 deletionssrc/box/txn.c
- src/box/txn.h 4 additions, 0 deletionssrc/box/txn.h
- src/box/vy_tx.c 11 additions, 14 deletionssrc/box/vy_tx.c
- test/box-luatest/gh_6246_mvcc_different_select_behavior_test.lua 6 additions, 2 deletions...x-luatest/gh_6246_mvcc_different_select_behavior_test.lua
- test/box-luatest/gh_6930_mvcc_isolation_levels_test.lua 3 additions, 1 deletiontest/box-luatest/gh_6930_mvcc_isolation_levels_test.lua
- test/box-luatest/gh_6930_mvcc_net_box_iso_test.lua 3 additions, 1 deletiontest/box-luatest/gh_6930_mvcc_net_box_iso_test.lua
- test/box-luatest/gh_7025_mvcc_dirty_range_test.lua 12 additions, 6 deletionstest/box-luatest/gh_7025_mvcc_dirty_range_test.lua
- test/box/tx_man.result 7 additions, 6 deletionstest/box/tx_man.result
- test/engine-luatest/gh_7238_memtx_fix_conflicted_txs_ro_operations_test.lua 53 additions, 0 deletions...t/gh_7238_memtx_fix_conflicted_txs_ro_operations_test.lua
- test/engine-luatest/gh_7239_rv_txs_conflict_on_dml_test.lua 74 additions, 0 deletionstest/engine-luatest/gh_7239_rv_txs_conflict_on_dml_test.lua
- test/vinyl/deferred_delete.result 1 addition, 1 deletiontest/vinyl/deferred_delete.result
- test/vinyl/hermitage.result 5 additions, 5 deletionstest/vinyl/hermitage.result
- test/vinyl/iterator.result 3 additions, 2 deletionstest/vinyl/iterator.result
Loading
Please register or sign in to comment