Skip to content
Snippets Groups Projects
Commit a0299db8 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Konstantin Osipov
Browse files

vinyl: allow to modify key definition if it does not require rebuild

To allow extending key definition for non-empty vinyl spaces, this patch
performs the following steps:

 - Revert commit c31dd19a ("vinyl: forbid vinyl index key definition
   alter") that forbade any key def alter. It isn't needed anymore.

 - Update key_def and cmp_def in vinyl_space_swap_index(). We simply
   swap the definitions between the old and new indexes in memory.
   Since all vinyl objects reference either vy_lsm::key_def or
   vy_lsm::cmp_def or both, and the change is compatible (does not
   change the order for existing tuples), this should work just fine.

 - Update key definition in vylog on ALTER. For this, we introduce a new
   vylog record type, VY_LOG_MODIFY_LSM, which updates key definition.
   To be able to replay it on recovery in case we failed to flush it
   before restart, we also store the LSN of the WAL record that
   triggered the ALTER.

It also adds the following test cases:

 - Modify key definition of primary and secondary indexes of a non-empty
   space (engine/ddl).

 - Modify key definition before snapshot and relay it to a newly joined
   replica (engine/replica_join).

 - Make sure key definition is updated in vylog on ALTER (vinyl/layout).
parent 48e97cd3
No related branches found
No related tags found
Loading
Showing with 402 additions and 155 deletions
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