[feat][ml] Add stateless RandomReader to ManagedLedger - #25880
Open
dao-jun wants to merge 3 commits into
Open
Conversation
dao-jun
force-pushed
the
dev/ml_add_readentries
branch
from
May 29, 2026 20:20
0c53fb8 to
b6556fc
Compare
This was referenced Jun 22, 2026
dao-jun
force-pushed
the
dev/ml_add_readentries
branch
from
July 16, 2026 04:39
b6556fc to
f6acd6d
Compare
# Conflicts: # managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
readEntries method to ManagedLedger
dao-jun
force-pushed
the
dev/ml_add_readentries
branch
from
July 17, 2026 14:21
68960bc to
28bd3dd
Compare
BewareMyPower
left a comment
Contributor
There was a problem hiding this comment.
expected read count is not taken carefully.
In EntryImpl:
protected void deallocate() {
if (decreaseReadCountOnRelease && readCountHandler != null) {
readCountHandler.markRead();
}The read count will always be decreased no matter whether the read op is on a RandomReader. This could affect the cache eviction strategy
Member
Author
|
@BewareMyPower fixed, PTAL |
BewareMyPower
approved these changes
Jul 23, 2026
dao-jun
force-pushed
the
dev/ml_add_readentries
branch
from
July 23, 2026 16:57
e1e90b5 to
62153b9
Compare
dao-jun
force-pushed
the
dev/ml_add_readentries
branch
from
July 23, 2026 19:44
62153b9 to
7789c55
Compare
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.
Motivation
Add stateless
RandomReaderto ML.Today every read path in managed-ledger goes through a ManagedCursor. A cursor is comparatively heavyweight for several access patterns:
ack, no backlog, no trimming hold) lets downstream projects batch-read entries directly by position, without those side effects.
Modifications
not prevent ledger trimming; reads do not wait for future entries, and callers must release every returned Entry. Reads honor count, position (maxPosition, inclusive), and estimated-size limits.
them. A populateCache=false reader serves cache hits without write-back, avoiding cache pollution for truly random, low-frequency access (cache integration touches EntryCache / RangeEntryCacheImpl).
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes