Skip to content

memtx secondary index uniqueness violation#7767

Merged
alyapunov merged 1 commit intotarantool:masterfrom
CuriousGeorgiy:gh-7761-memtx-unique-sk-index-violation
Nov 9, 2022
Merged

memtx secondary index uniqueness violation#7767
alyapunov merged 1 commit intotarantool:masterfrom
CuriousGeorgiy:gh-7761-memtx-unique-sk-index-violation

Conversation

@CuriousGeorgiy
Copy link
Member

@CuriousGeorgiy CuriousGeorgiy commented Oct 3, 2022

memtx: fix conflict handling of stories in secondary indexes

If we find a newer story in the secondary index, the statement of which
deletes a story added in the same transaction, there can be two cases: if
the secondary index is not unique, this is impossible (since it's cmp_def
is extended with the primary index's key_def and there can only be story
chains in the primary index). Otherwise, the prepared story conflicts the
newer one: remove the incorrect check.

Closes #7761

@CuriousGeorgiy CuriousGeorgiy force-pushed the gh-7761-memtx-unique-sk-index-violation branch from c9bc623 to ceda851 Compare October 3, 2022 14:18
@CuriousGeorgiy CuriousGeorgiy marked this pull request as ready for review October 3, 2022 14:30
Copy link
Contributor

@drewdzzz drewdzzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there can only be story chains in the primary index

Story chains are present in every index. Please elaborate.

@drewdzzz drewdzzz removed their assignment Oct 12, 2022
If we find a newer story in the secondary index, the statement of which
deletes a story added in the same transaction, there can be two cases: if
the secondary index is not unique, then it is conflicted by primary index
(since it's `cmp_def` is extended with the primary index's
`key_def`, every history chain in the secondary index has a corresponding
chain in the primary index). Otherwise, the prepared story must also
conflict the newer one.

Summarizing the above: remove the unnecessary check.

Closes tarantool#7761

NO_DOC=bugfix
@CuriousGeorgiy CuriousGeorgiy force-pushed the gh-7761-memtx-unique-sk-index-violation branch from ceda851 to 24ba249 Compare October 12, 2022 16:03
@CuriousGeorgiy
Copy link
Member Author

CuriousGeorgiy commented Oct 12, 2022

there can only be story chains in the primary index

Story chains are present in every index. Please elaborate.

I had a wrong picture in my head: I thought there couldn't be any history chains in a secondary non-unique index (since there are no collisions), but actually every story chain in there has a corresponding story chain in the primary index (since a secondary non-unique index is basically the primary index extended by the parts of the secondary index).

Reworded the commit message accordingly.

@alyapunov alyapunov added the full-ci Enables all tests for a pull request label Nov 8, 2022
@coveralls
Copy link

Coverage Status

Coverage increased (+0.8%) to 85.127% when pulling 24ba249 on CuriousGeorgiy:gh-7761-memtx-unique-sk-index-violation into 6e45042 on tarantool:master.

@alyapunov alyapunov merged commit a1ba58d into tarantool:master Nov 9, 2022
@alyapunov
Copy link
Contributor

Cherry-picked to 2.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Enables all tests for a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Secondary index uniqueness violation

4 participants