Skip to content

[backport 3.3] memtx: fix a crash caused by mhash misusage in MVCC#11167

Merged
sergepetrenko merged 1 commit intorelease/3.3from
backport/release/3.3/11162
Feb 19, 2025
Merged

[backport 3.3] memtx: fix a crash caused by mhash misusage in MVCC#11167
sergepetrenko merged 1 commit intorelease/3.3from
backport/release/3.3/11162

Conversation

@TarantoolBot
Copy link
Collaborator

@TarantoolBot TarantoolBot commented Feb 18, 2025

(This PR is a backport of #11162 to release/3.3 to a future 3.3.2 release.)


We use mhash in memtx MVCC to store trackers of reads that have read nothing, we call them point holes. When handling a write to such hole, the tracker should be deleted because we can use the new tuple to store reads instead. Deletion flow in mhash is: we find bucket of the element with find, then we free the bucket with del. It can seem that the element is not needed on del because bucket id is used. However, it can be used on incremental resize of mhash. And, since we delete the point holes before releasing the bucket in mhash, in the rare case of incremental resize Tarantool will be aborted by mhash consistency check. The commit fixes the problem - simply release the bucket before deleting the object.

Along the way, the commit fixes another misusage that doesn't acutally break something. Method put_slot is internal so shouldn't be used manually - let's use more convenient get instead.

Closes #11022

We use mhash in memtx MVCC to store trackers of reads that have read
nothing, we call them point holes. When handling a write to such hole,
the tracker should be deleted because we can use the new tuple to store
reads instead. Deletion flow in mhash is: we find bucket of the element
with `find`, then we free the bucket with `del`. It can seem that the
element is not needed on `del` because bucket id is used. However, it
can be used on incremental resize of mhash. And, since we delete the
point holes before releasing the bucket in mhash, in the rare case of
incremental resize Tarantool will be aborted by mhash consistency check.
The commit fixes the problem - simply release the bucket before deleting
the object.

Along the way, the commit fixes another misusage that doesn't actually
break something. Method `put_slot` is internal so shouldn't be used
manually - let's use more convenient `get` instead.

Closes #11022

NO_DOC=bugfix

(cherry picked from commit 7c73e24)
@TarantoolBot TarantoolBot requested a review from a team as a code owner February 18, 2025 14:07
@TarantoolBot TarantoolBot added the full-ci Enables all tests for a pull request label Feb 18, 2025
@TarantoolBot TarantoolBot changed the title [Backport release/3.3] memtx: fix a crash caused by mhash misusage in MVCC [backport 3.3] memtx: fix a crash caused by mhash misusage in MVCC Feb 18, 2025
@coveralls
Copy link

Coverage Status

coverage: 87.407% (+0.008%) from 87.399%
when pulling d500baa on backport/release/3.3/11162
into 55c3dc1
on release/3.3
.

@sergepetrenko sergepetrenko merged commit 561ae6b into release/3.3 Feb 19, 2025
61 of 97 checks passed
@sergepetrenko sergepetrenko deleted the backport/release/3.3/11162 branch February 19, 2025 12:07
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.

4 participants