Skip to content

[backport 3.3] memtx: use index definition's key_def for point hole comparisons#11485

Merged
sergepetrenko merged 8 commits intotarantool:release/3.3from
CuriousGeorgiy:backport/3.3/mvcc-bitwise-key-comparison
May 14, 2025
Merged

[backport 3.3] memtx: use index definition's key_def for point hole comparisons#11485
sergepetrenko merged 8 commits intotarantool:release/3.3from
CuriousGeorgiy:backport/3.3/mvcc-bitwise-key-comparison

Conversation

@CuriousGeorgiy
Copy link
Member

@CuriousGeorgiy CuriousGeorgiy commented May 10, 2025

(This PR is a backport of #11388 to release/3.3 to a future 3.3.3 release.)


This patchset fixes the incorrect assumption that point hole equivalence classes are defined by
their keys' binary (MsgPack) representation.

Closes #10159
Closes #11292

@CuriousGeorgiy CuriousGeorgiy requested review from a team, Totktonada and ligurio as code owners May 10, 2025 13:55
@CuriousGeorgiy CuriousGeorgiy changed the base branch from master to release/3.3 May 10, 2025 13:55
@CuriousGeorgiy CuriousGeorgiy force-pushed the backport/3.3/mvcc-bitwise-key-comparison branch from aa10e9b to 25c65bc Compare May 10, 2025 13:56
@CuriousGeorgiy CuriousGeorgiy force-pushed the backport/3.3/mvcc-bitwise-key-comparison branch from 25c65bc to 72c1a76 Compare May 10, 2025 14:05
@CuriousGeorgiy CuriousGeorgiy added the full-ci Enables all tests for a pull request label May 10, 2025
@coveralls
Copy link

coveralls commented May 10, 2025

Coverage Status

coverage: 87.516% (+0.03%) from 87.482%
when pulling 020fa4f on CuriousGeorgiy:backport/3.3/mvcc-bitwise-key-comparison
into 73fc8dc
on tarantool:release/3.3
.

MVCC storages are supposed to be empty by the time MVCC is freed — let's
add assertions to check this assumption.

Needed for tarantool#10159
Needed for tarantool#11292

NO_CHANGELOG=<refactoring>
NO_DOC=<refactoring>
NO_TEST=<refactoring>

(cherry picked from commit 0a02acb)
We combine the index and tuple hash for point holes in a non-trivial way in
more than one place — let's encapsulate the combination logic in a separate
function for future changes.

Needed for tarantool#10159
Needed for tarantool#11292

NO_CHANGELOG=<refactoring>
NO_DOC=<refactoring>
NO_TEST=<refactoring>

(cherry picked from commit b6cabab)
It is safe to remove an object from its list, even if the list is empty —
let's always remove point holes from their rings to simplify the code. We
will use this to further separate the point hole storage deletion from the
point hole item deletion.

Needed for tarantool#10159
Needed for tarantool#11292

NO_CHANGELOG=<refactoring>
NO_DOC=<refactoring>
NO_TEST=<refactoring>

(cherry picked from commit 171412a)
We delete point item separately in more than one place — let's encapsulate
this logic in a separate function for further changes.

Needed for tarantool#10159
Needed for tarantool#11292

NO_CHANGELOG=<refactoring>
NO_DOC=<refactoring>
NO_TEST=<refactoring>

(cherry picked from commit 674d75e)
Globally unique index identifiers are redundant, since indexes can be
uniquely identified by pointers — let's use the pointer to the index for
this purpose.

Needed for tarantool#10159
Needed for tarantool#11292

NO_CHANGELOG=<refactoring>
NO_DOC=<refactoring>
NO_TEST=<refactoring>

(cherry picked from commit 19ac49a)
Currently, we assume that point hole equivalence classes are defined by
their keys' binary (MsgPack) representation, and use `memcmp` for
comparison. However, this is not true in the case of numeric key
definitions and collations.

To fix this, let's use the corresponding index's key definition for
comparison. Storing the key length then becomes redundant, so let's drop
it.

Closes tarantool#10159
Closes tarantool#11292

NO_DOC=<bugfix>

(cherry picked from commit b2fc501)
The `space_id` field has become redundant after we started saving the
`index` to point holes — let's drop it to simplify the code.

Folows-up tarantool#10159
Folows-up tarantool#11292

NO_CHANGELOG=<refactoring>
NO_DOC=<refactoring>
NO_TEST=<refactoring>

(cherry picked from commit f76d3f9)
Folows-up tarantool#10159
Folows-up tarantool#11292

NO_CHANGELOG=<optimization>
NO_DOC=<optimization>

(cherry picked from commit 76b114e)
@CuriousGeorgiy CuriousGeorgiy force-pushed the backport/3.3/mvcc-bitwise-key-comparison branch from 72c1a76 to 020fa4f Compare May 10, 2025 14:34
@sergepetrenko sergepetrenko merged commit debf0ae into tarantool:release/3.3 May 14, 2025
42 checks passed
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

3 participants