Repository navigation
fix: stop readers of the latest version from seeing the next version's fast nodes during SaveVersion - #1172
Open
JayT106 wants to merge 8 commits into
Open
fix: stop readers of the latest version from seeing the next version's fast nodes during SaveVersion#1172JayT106 wants to merge 8 commits into
JayT106 wants to merge 8 commits into
Conversation
…s fast nodes during SaveVersion Fast nodes are not versioned. A reader of version N could get version N+1 data through them while SaveVersion ran: the batch may flush fast nodes before the commit, and the latest version moved in a second lock section after it. Mark the fast index dirty while fast node changes are uncommitted, move the latest version in the same lock section as the batch write, and check both after a fast node miss and after the fast iterator takes its snapshot. Closes cosmos#1171
…eDB lock A reader that held an open MemDB iterator and waited for the nodeDB lock deadlocked with a commit waiting for the MemDB lock.
Commit no longer marks the fast index clean, so a batch commit from pruning during SaveVersion cannot expose the next version's fast nodes.
… leaves the fast index dirty
…index on lazy version load
|
This PR does not match any of the 1 configured review trigger rule. |
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
…ndex version comment
…dirty A failed SaveVersion leaves its flushed fast nodes in the DB, and Rollback does not undo them.
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.
What
nodeDBand the tree read paths: readers of the latest version no longer see the next version's fast nodes duringSaveVersion.Issue
Getcould miss a key that N+1 removed.Solution
nodeDBtracks which version the fast index can serve; an iterator checks it after opening,Getunder the read's lock.Gets on the latest version read the tree; hits stay fast.Getgoes 0.46µs → 6.2µs, a 10-key scan 3.3µs → 22.7µs.