Skip to content

[backport 2.11] memtx: fix a crash caused by mhash misusage in MVCC#11165

Merged
sergepetrenko merged 1 commit intorelease/2.11from
backport/release/2.11/11162
Feb 18, 2025
Merged

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

Conversation

@TarantoolBot
Copy link
Collaborator

@TarantoolBot TarantoolBot commented Feb 18, 2025

(This PR is a backport of #11162 to release/2.11 to a future 2.11.6 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/2.11] memtx: fix a crash caused by mhash misusage in MVCC [backport 2.11] memtx: fix a crash caused by mhash misusage in MVCC Feb 18, 2025
@coveralls
Copy link

Coverage Status

coverage: 86.039% (+0.02%) from 86.015%
when pulling 3ef4992 on backport/release/2.11/11162
into 69e26ee
on release/2.11
.

@sergepetrenko sergepetrenko merged commit 3dc8a3b into release/2.11 Feb 18, 2025
95 of 181 checks passed
@sergepetrenko sergepetrenko deleted the backport/release/2.11/11162 branch February 18, 2025 18:38
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