Skip to content
Snippets Groups Projects
Commit c8ac2d90 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Roman Tsisyk
Browse files

alter: commit old index drop and new index create on index rebuild

To rebuild an index when its key def changes, we effectively drop it and
create a new index instead. Skipping Index::commitDrop and commitCreate
stages at this point deprives Vinyl of an opportunity to log the change
in the metadata log and replace the index in the scheduler, which leads
to a crash. This patch adds the commit stage to RebuildIndex which calls
the above-mentioned commitDrop and commitCreate for the old and the new
indexes, respectively.

There is a nuance here. Memtx piggybacks Index::commitDrop to drop space
tuples when the primary index is dropped. This is actually wrong for
tuples belong to a space, not to an index. Besides, it prevents us from
just calling Index::commitDrop() from RebuildIndex::commit() as is,
because RebuildIndex does not modify space data, it just moves space
tuples to a new index. To circumvent this, let us remove commitDrop()
method from MemtxIndex and drop space tuples directly from MemtxSpace's
commitTruncateSpace() and commitAlterSpace().
parent 09cbbce6
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment