txm: store pointers to indexes in story
There was a tricky problem in TX manager that could lead to a crash after deletion of a space. When a space is deleted, TX manager uses a special callback to remove dirty tuples from indexes. It is necessary for correct destruction of space and indexes. The problem is that actual space drop works in several steps, deletings secondary indexes and then deleting primary indexes. Each step is an independend alter. And alters are tricky. For example we had a struct space instance, namely S1, with two indexes I1 and I2. At the first step we have to delete the second index. By design, for that purpose a new instance of space is created, namely S2, with one empty index I3. Then the spaces exchanges their indexes, and S1 becomes with I3 and I2, and S2 owns I1. After that S1 is deleted. That is good until we try to make story cleanup - all the dirty tuples remain in S2.I1, while we try to clean empty S1.I3. The only way to fix it - story index pointer right in story to make sure we are cleaning the right index. Part of #6234 Closes #6274
Showing
- changelogs/unreleased/gh-6274-mvcc-crash-after-space-drop.md 3 additions, 0 deletionschangelogs/unreleased/gh-6274-mvcc-crash-after-space-drop.md
- src/box/memtx_tx.c 15 additions, 1 deletionsrc/box/memtx_tx.c
- src/box/memtx_tx.h 5 additions, 0 deletionssrc/box/memtx_tx.h
- test/box/tx_man.result 38 additions, 9 deletionstest/box/tx_man.result
- test/box/tx_man.test.lua 16 additions, 4 deletionstest/box/tx_man.test.lua
Loading
Please register or sign in to comment