Conversation
…advancing Cache refill can seek past the last entry after MapState.remove() deletes the resume key. That removal does not update the cached deletion flag, so advancing the exhausted iterator violates the RocksDB API contract.
Stop native MapState and timer seeks at the end of their key/namespace or key-group prefix instead of traversing unrelated tombstones during state access and timer queue initialization. Generated-by: Claude Fable 5.1
…nded iterators The bounded iterator copies the backend's ReadOptions, so a prefixSameAsStart or iterate_lower_bound set globally by an options factory would carry over and silently drop keys inside the bound: the first stops at the next extracted prefix, the second clamps the seek. Clear both on the private copy, the shared options stay untouched.
Contributor
Author
|
cc: @pnowojski |
Collaborator
pnowojski
approved these changes
Sep 16, 2026
pnowojski
left a comment
Contributor
There was a problem hiding this comment.
I have previously reviewed internal version of this PR. We have verified it on our production to resolve the performance issue when there are a lot of uncompacted deletion markers in the SST files.
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 is the purpose of the change
RocksDB MapState and timer iterators currently check their key prefix in Java after a native seek returns. When state contains many tombstones, RocksDB can scan through unrelated key ranges while searching for the next live entry. This increases CPU usage during state access and can significantly delay timer queue initialization after restore, which performs a seek for every assigned key group.
This change sets a native exclusive upper bound for each iterator, limiting it to the map’s key-group/key/namespace prefix or the timer queue’s key-group prefix. It prevents scanning unrelated tombstones while preserving the intended results. The change also guards exhausted MapState resume seeks before advancing and clears inherited seek restrictions on the private options copy so they cannot omit valid entries.
Brief change log
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Fable 5.1