memtx: fix TREE index get check for part count#7686
Merged
alyapunov merged 2 commits intotarantool:masterfrom Sep 23, 2022
Merged
Conversation
2953409 to
3266074
Compare
drewdzzz
reviewed
Sep 20, 2022
test/box-luatest/gh_7685_memtx_tree_idx_get_with_nullable_field_phantom_read_test.lua
Show resolved
Hide resolved
668daa5 to
8a8bfd1
Compare
If TREE index `get` result is empty, the key part count is incorrectly compared to the tree's `cmp_def->part_count`, though it should be compared with `cmp_def->unique_part_count`. But we can actually assume that by the time we get to the index's `get` method the part count is equal to the unique part count (partial keys are rejected and `get` is not supported for non-unique indexes): change check to correct assertion. Closes tarantool#7685 NO_DOC=<bugfix>
Since `key_def_merge` sets the merged key definition's unique part count equal to the new part count, the extra assignment in case the index is not unique is redundant: remove it. NO_CHANGELOG=<refactoring> NO_DOC=<refactoring> NO_TEST=<refactoring>
8a8bfd1 to
444e7a3
Compare
alyapunov
approved these changes
Sep 22, 2022
drewdzzz
approved these changes
Sep 22, 2022
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.
memtx: fix TREE index
getcheck for part countIf TREE index
getresult is empty, the key part count is incorrectlycompared to the tree's
cmp_def->part_count, though it should be comparedwith
cmp_def->unique_part_count. But we can actually assume that by thetime we get to the index's
getmethod the part count is equal to theunique part count (partial keys are rejected and
getis notsupported for non-unique indexes): change check to correct assertion.
Closes #7685
memtx: refactor
index_def_newSince
key_def_mergesets the merged key definition's unique part countequal to the new part count, the extra assignment in case the index is not
unique is redundant: remove it.