Skip to content

memtx: fix TREE index get check for part count#7686

Merged
alyapunov merged 2 commits intotarantool:masterfrom
CuriousGeorgiy:memtx-tree-idx-get-change-part-count-check-to-assertion
Sep 23, 2022
Merged

memtx: fix TREE index get check for part count#7686
alyapunov merged 2 commits intotarantool:masterfrom
CuriousGeorgiy:memtx-tree-idx-get-change-part-count-check-to-assertion

Conversation

@CuriousGeorgiy
Copy link
Member

memtx: fix TREE index get check for part count
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 #7685

memtx: refactor index_def_new

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.

@CuriousGeorgiy CuriousGeorgiy added bug Something isn't working memtx teamC mvcc labels Sep 14, 2022
@CuriousGeorgiy CuriousGeorgiy self-assigned this Sep 14, 2022
@CuriousGeorgiy CuriousGeorgiy force-pushed the memtx-tree-idx-get-change-part-count-check-to-assertion branch from 2953409 to 3266074 Compare September 14, 2022 16:50
@drewdzzz drewdzzz assigned CuriousGeorgiy and unassigned drewdzzz Sep 21, 2022
@CuriousGeorgiy CuriousGeorgiy force-pushed the memtx-tree-idx-get-change-part-count-check-to-assertion branch 2 times, most recently from 668daa5 to 8a8bfd1 Compare September 22, 2022 08:36
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>
@CuriousGeorgiy CuriousGeorgiy force-pushed the memtx-tree-idx-get-change-part-count-check-to-assertion branch from 8a8bfd1 to 444e7a3 Compare September 22, 2022 10:19
@drewdzzz drewdzzz removed their assignment Sep 22, 2022
@CuriousGeorgiy CuriousGeorgiy added the full-ci Enables all tests for a pull request label Sep 22, 2022
@coveralls
Copy link

Coverage Status

Coverage increased (+0.0007%) to 84.296% when pulling 444e7a3 on CuriousGeorgiy:memtx-tree-idx-get-change-part-count-check-to-assertion into 8ee0e43 on tarantool:master.

@alyapunov alyapunov merged commit 1d6c92e into tarantool:master Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working full-ci Enables all tests for a pull request memtx mvcc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

memtx nullable TREE index get transaction management phantom reads

4 participants