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

tarantool / tarantool / 9286409758
88%

Build:
DEFAULT BRANCH: master
Ran 29 May 2024 01:22PM UTC
Jobs 1
Files 513
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 12:50PM UTC coverage: 87.103% (-0.01%) from 87.116%
9286409758

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)

67551 of 119997 branches covered (56.29%)

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

196 existing lines in 18 files now uncovered.

100274 of 115121 relevant lines covered (87.1%)

2443851.41 hits per line

Jobs
ID Job ID Ran Files Coverage
1 9286409758.1 29 May 2024 01:22PM UTC 0
87.1
GitHub Action Run
Source Files on build 9286409758
Detailed source file information is not available for this build.
  • Back to Repo
  • d529082f on github
  • Prev Build on master (#9284991953)
  • Next Build on master (#9287124784)
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