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

tarantool / tarantool / 9288777436
86%
master: 88%

Build:
Build:
LAST BUILD BRANCH: ninarodicova/grants
DEFAULT BRANCH: master
Ran 29 May 2024 03:34PM UTC
Jobs 1
Files 479
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 May 2024 03:19PM UTC coverage: 85.777% (-0.03%) from 85.805%
9288777436

push

github

sergepetrenko
txn: run statement `on_rollback` triggers before rolling back statement

Logically, we call triggers after running statements. These triggers can
make significant changes (for instance, DDL triggers), so, for consistency,
we should call the statement's `on_rollback` triggers before rolling back
the statement. This also adheres to the logic that transaction
`on_rollback` triggers are called before rolling back individual
transaction statements.

One particular bug that this patch fixes is rolling back of DDL on the
`_space` space. DDL is essentially a replace operation on the `_space`
space, which also invokes the `on_replace_dd_space` trigger. In this
trigger, among other things, we swap the indexes of the original space,
`alter->old_space`, which is equal to the corresponding transaction
`stmt->space`, with the indexes of the newly created space,
`alter->new_space`:
https://github.com/tarantool/tarantool/blob/<a class=hub.com/tarantool/tarantool/commit/<a class="double-link" href="https://git"><a class=hub.com/tarantool/tarantool/commit/de80e0264f7deb58ea86ef85b37b92653a803430">de80e0264/src/box/alter.cc#L1036-L1047

If then a rollback happens, we first rollback the replace operation, using
`stmt->space`, and only after that do we swap back the indexes in
`alter_space_rollback`:
https://github.com/tarantool/tarantool/blob/de80e0264f7deb58ea86ef85b37b92653a803430/src/box/memtx_engine.cc#L659-L669
https://github.com/tarantool/tarantool/blob/de80e0264f7deb58ea86ef85b37b92653a803430/src/box/alter.cc#L916-L925

For DDL on the _space space, the replace operation and DDL occur on the
same space. This means that during rollback of the replace, we will try to
do a replace in the empty indexes that were created for `alter->new_space`.
Not only does this break the replace operation, but also the newly inserted
tuple, which remains in the index, gets deleted, and access to it causes
undefined behavior (heap-use-after-free).

As part of the work on this patch, tests of rollback of DDL on system
spaces which use `on_rollback` triggers were enumerated:
* `_sequence` — box/sequence.test.lua;
* `_sequence... (continued)

62608 of 113874 branches covered (54.98%)

2 of 2 new or added lines in 1 file covered. (100.0%)

306 existing lines in 20 files now uncovered.

93482 of 108983 relevant lines covered (85.78%)

2449307.02 hits per line

Jobs
ID Job ID Ran Files Coverage
1 9288777436.1 29 May 2024 03:34PM UTC 0
85.78
GitHub Action Run
Source Files on build 9288777436
Detailed source file information is not available for this build.
  • Back to Repo
  • 41af99a2 on github
  • Prev Build on release/2.11 (#9286403500)
  • Next Build on release/2.11 (#9301425677)
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