[backport 3.3] memtx: fix a crash caused by mhash misusage in MVCC#11167
Merged
sergepetrenko merged 1 commit intorelease/3.3from Feb 19, 2025
Merged
[backport 3.3] memtx: fix a crash caused by mhash misusage in MVCC#11167sergepetrenko merged 1 commit intorelease/3.3from
sergepetrenko merged 1 commit intorelease/3.3from
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(This PR is a backport of #11162 to
release/3.3to a future3.3.2release.)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 withdel. It can seem that the element is not needed ondelbecause 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_slotis internal so shouldn't be used manually - let's use more convenientgetinstead.Closes #11022