vinyl: fix crash on extending secondary key parts with primary#10101
Merged
locker merged 1 commit intotarantool:masterfrom Jun 7, 2024
Merged
vinyl: fix crash on extending secondary key parts with primary#10101locker merged 1 commit intotarantool:masterfrom
locker merged 1 commit intotarantool:masterfrom
Conversation
lenkis
approved these changes
Jun 7, 2024
nshy
approved these changes
Jun 7, 2024
09e18ba to
346661a
Compare
Member
Author
|
Using |
346661a to
6d4fb9f
Compare
nshy
reviewed
Jun 7, 2024
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 6481706 ("vinyl: use update_def index method to update vy_lsm on ddl"). Closes tarantool#10095 NO_DOC=bug fix
6d4fb9f to
e3c433f
Compare
Member
Author
|
Cherry-picked to 2.11 and 3.1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_defdoesn't change, seevinyl_index_def_change_requires_rebuild. In this casevinyl_index_update_defwill try to updatekey_defandcmp_defin-place withkey_def_copy. This will lead to a crash because the number of parts in the newkey_defis greater.We can't use
key_def_dupinstead ofkey_def_copythere because there may be read iterators using the oldkey_defby pointer so there's no other option but to force rebuild in this case.The bug was introduced in commit 6481706.
Closes #10095