• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tarantool / tarantool / 13266713350

11 Feb 2025 03:40PM UTC coverage: 87.395% (-0.02%) from 87.416%
13266713350

push

github

locker
txn: enable cross-engine transactions

Both memtx and vinyl support MVCC. Moreover, the Tarantool transaction
manager already allows to mix statements for more than one engine in one
transaction, see commit 09bfdd473ffd2 ("txn: first step towards
cross-engine transactions"). All we need to do to enable full support
for cross-engine transactions is to abort and send to read view memtx
and vinyl transaction parts synchronously. To achieve that, we add
two new engine callbacks - abort_with_conflict and send_to_read_view -
and make memtx and vinyl use them instead of their internal methods.
There's one more thing: since there are engines that don't support MVCC
(memtx without `box.cfg.memtx_use_mvcc_engine` and memcs), we add a new
engine flag - ENGINE_SUPPORTS_MVCC. The transaction manager will refuse
to begin a cross-engine transaction unless this flag is either set or
unset for all participating engines.

In particular, the patch allows to simplify the vinyl transaction
manager by removing various check that are now performed in the common
code (like disallowing to start a write statement in a transaction that
has been sent to a read view). Still, we don't drop vy_tx::state just
yet because vinyl may send a single-statement transaction, which doesn't
actually have a txn object, to a read view, see #11070.

Also note silent removal of the TODO in txn_prepare asking to add
engine_rollback. There's no need in calling engine_rollback there
because it'll be called by txn_rollback, which is called after a failed
txn_prepare anyway.

Closes #1803

@TarantoolBot document
Title: Document cross-engine transactions

Tarantool now supports mixing statements for different storage engines
in the same transaction, for example:

```lua
local memtx = box.schema.space.create('memtx', {engine = 'memtx'})
memtx:create_index('primary')
local vinyl = box.schema.space.create('vinyl', {engine = 'vinyl'})
vinyl:create_index('primary')

memtx:insert({1, 'a'})
vinyl:insert({2, '... (continued)

69769 of 123313 branches covered (56.58%)

139 of 144 new or added lines in 8 files covered. (96.53%)

337 existing lines in 23 files now uncovered.

102826 of 117657 relevant lines covered (87.39%)

2472490.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.22
/src/lua/fiber.c


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc