memtx: fix a crash caused by mhash misusage in MVCC#11162
Merged
sergepetrenko merged 1 commit intotarantool:masterfrom Feb 18, 2025
drewdzzz:mvcc_mhash_misusage
Merged
memtx: fix a crash caused by mhash misusage in MVCC#11162sergepetrenko merged 1 commit intotarantool:masterfrom drewdzzz:mvcc_mhash_misusage
sergepetrenko merged 1 commit intotarantool:masterfrom
drewdzzz:mvcc_mhash_misusage
Conversation
CuriousGeorgiy
approved these changes
Feb 18, 2025
mkostoevr
approved these changes
Feb 18, 2025
xuniq
approved these changes
Feb 18, 2025
changelogs/unreleased/gh-11022-memtx-mvcc-point-holes-mhash-abort.md
Outdated
Show resolved
Hide resolved
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
Collaborator
|
Successfully created backport PR for |
This was referenced Feb 18, 2025
Collaborator
|
Successfully created backport PR for |
Collaborator
|
Successfully created backport PR for |
Collaborator
Backport summary
|
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.
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