db/kv/membatchwithdb: restrict overlays to the pure-Go memStore backing - #22534
Draft
yperbasis wants to merge 1 commit into
Draft
db/kv/membatchwithdb: restrict overlays to the pure-Go memStore backing#22534yperbasis wants to merge 1 commit into
yperbasis wants to merge 1 commit into
Conversation
Split out of #21293. Shared-tx read views are safe under a concurrent parent Close only because memStore's Rollback/Close are no-ops on the data; typing memTx as *memStore enforces that backing. Remove the unused MDBX-backed constructor, whose write tx pins an OS thread and would invalidate cursors mid-iteration.
This was referenced Jul 16, 2026
Draft
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.
Split out of #21293 (
FcuBackgroundCommitgroundwork).Shared-tx overlay read views (
MemoryMutation.NewReadView/NewTemporalReadView) are safe under a concurrent parentCloseonly on the pure-GomemStorebacking, whoseRollback/Closeare no-ops on the data — that is what lets a background-commit goroutine close the published overlay while RPC readers still iterate views. This PR makes the invariant structural instead of conventional:MemoryMutation.memTxis typed*memStore(waskv.RwTx), so an overlay cannot be constructed on a backing whoseRollbackinvalidates cursors.NewMemoryBatchMDBX(the MDBX-backed constructor, unused) is removed: its write tx pins the goroutine to an OS thread and itsRollbackdestroys the data under live read views — exactly the construction the invariant forbids.newReadViewMut, with pointers fromMemoryMutation.Rollback,SharedDomains.Close, andFilters.WithOverlay/WithTemporalOverlay(the read-view producers/consumers that rely on it).