vinyl: do not use space_vtab::commit_alter for preparing new indexes
Currently, space_vtab::commit_alter is called before WAL write so we can use it for preparing new indexes in vinyl. However, this is going to change soon, because actually space_vtab::commit_alter should be called after WAL write, like index_vtab::commit_drop or commit_create. Calling it before WAL write may result in use-after-free in memtx (see #3289). Besides, using this function for iterating over space indexes just feels wrong, as we have index methods invoked by AlterSpaceOp descendants for this. So let's move all the operations performed by vinyl_space_commit_alter somewhere else. Fortunately, it's easy to do without damaging code readability or efficiency: - Update of vy_lsm::pk can be done by vinyl_space_swap_index and vinyl_build_secondary_key. - vy_lsm->check_is_unique can be computed by vinyl_engine_create_space and then set by vinyl_space_swap_index. - Call to key_def_update_optionality is implied by key_def_swap, which is already called by vinyl_space_swap_index, hence it can be removed. Needed for #3289
Loading
Please register or sign in to comment