vinyl: fix crash on extending secondary key parts with primary
If a secondary index is altered in such a way that its key parts are extended with the primary key parts, rebuild isn't required because `cmp_def` doesn't change, see `vinyl_index_def_change_requires_rebuild`. In this case `vinyl_index_update_def` will try to update `key_def` and `cmp_def` in-place with `key_def_copy`. This will lead to a crash because the number of parts in the new `key_def` is greater. We can't use `key_def_dup` instead of `key_def_copy` there because there may be read iterators using the old `key_def` by pointer so there's no other option but to force rebuild in this case. The bug was introduced in commit 64817066 ("vinyl: use update_def index method to update vy_lsm on ddl"). Closes #10095 NO_DOC=bug fix (cherry picked from commit 9b817848)
Showing
- changelogs/unreleased/gh-10095-vy-index-update-def-fix.md 4 additions, 0 deletionschangelogs/unreleased/gh-10095-vy-index-update-def-fix.md
- src/box/vinyl.c 15 additions, 1 deletionsrc/box/vinyl.c
- test/vinyl-luatest/gh_10095_update_index_def_test.lua 35 additions, 0 deletionstest/vinyl-luatest/gh_10095_update_index_def_test.lua
Loading
Please register or sign in to comment