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

tarantool / tarantool / 12293889946

12 Dec 2024 09:50AM CUT coverage: 87.354% (+0.008%) from 87.346%
12293889946

push

github

locker
vinyl: fix abort of writers on DDL

When a DDL statement is committed, all transactions writing to the space
must be aborted so that they don't access the stale `txn_stmt::space`
pointer on commit. In Vinyl we abort all writers from the special
`space_invalidate` engine callback, where we iterate over all writing
transactions and abort those of them that have a write set entry
pointing to the primary key of the invalidated space, see commit
d3e1236956515 ("vinyl: abort affected transactions when space is removed
from cache"). We also abort transactions that haven't yet created
a write set entry because they need to read the disk first, for example,
to perform a tuple update, see commit 4f62ec2102f4 ("vinyl: make
tx_manager_abort_writers_for_ddl more thorough").

However, as spotted by @drewdzzz, this code doesn't always work as
expected. The problem is, unless dropped, the primary index is moved to
the new space container so using the primary index stored in the old
space container to abort transactions is wrong: there can't possibly be
any transactions associated with it. We don't get a crash because we
have an extra check in `vy_lsm_set` that aborts the transaction if
the space format was updated (it is updated on every space change),
see commit e3c5fde4b57cd ("vinyl: fix DDL with active transactions").

Another problem with `space_invalidate` is that it doesn't abort
transactions that turned out to be no-op, such as an update of
a non-existing key because such transactions don't add any entries
to the write set. Still, they must be aborted because they have
a `txn_stmt` pointing to the old space. Letting them proceed to commit
would result in a use-after-free bug, see #10707.

Let's fix `space_invalidate` by making it iterate over all statements
of writing transactions instead of checking their Vinyl write sets.
To achieve that, we store a pointer to `struct txn` in `struct vy_tx`.
This lets us drop `vy_tx::last_stmt_space` and `vy_tx::isolation`
b... (continued)

69676 of 123524 branches covered (56.41%)

15 of 15 new or added lines in 4 files covered. (100.0%)

15 existing lines in 7 files now uncovered.

102617 of 117473 relevant lines covered (87.35%)

3212481.6 hits per line

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

95.69
/src/lib/msgpuck/msgpuck.h


Source Not Available

The file "src/lib/msgpuck/msgpuck.h" isn't available on github. Either it's been removed, or the repo root directory needs to be updated.

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

© 2025 Coveralls, Inc