[core] Add version-aware LocalKvDb range iterator#8871
Open
JingsongLi wants to merge 1 commit into
Open
Conversation
JingsongLi
marked this pull request as ready for review
July 27, 2026 16:25
leaves12138
requested changes
Jul 27, 2026
leaves12138
left a comment
Contributor
There was a problem hiding this comment.
There is one blocking mutation path missing the range-iterator guard. I reproduced the bulk-load operation blocking until the iterator is closed.
| } | ||
| } | ||
|
|
||
| private void ensureNoRangeIterator() { |
Contributor
There was a problem hiding this comment.
bulkLoad also mutates levels, but it does not call ensureNoRangeIterator(). rangeIterator() keeps the LsmLevels read lock until close, while bulkLoad() eventually calls levels.addFiles() and needs the write lock. With an iterator open on an empty DB, a concurrent bulk load blocks until close; invoking it on the iterator-owning thread deadlocks permanently because this lock cannot be upgraded. Please guard bulkLoad as well and add a regression test.
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.
Purpose
Add an efficient, version-aware prefix/range iteration primitive to
LocalKvDbfor ListState and SetState.Changes
Verification
mvn -q -pl paimon-common -Pfast-build -DwildcardSuites=none '-Dtest=LocalKvDbTest#testRangeScanMergesMemTableAndLevels+testForEachInRangeAcrossMemTableAndSingleSst+testRangeIteratorDeduplicatesVersionsAcrossAllSources+testRangeIteratorCrossesSstBlocks,LocalKvDbAsyncCompactionTest#testAutomaticCompactionRunsInBackground+testRangeIteratorPreventsCompactionFromDeletingItsFiles' testmvn -q -pl paimon-common spotless:check -DskipTestsmvn -q -pl paimon-common -DskipTests compile