Repository navigation
[fix][ml] Read published positions through stale read-only caches - #27223
Merged
codelipenghui merged 2 commits intoNov 6, 2026
Merged
codelipenghui merged 2 commits into
codelipenghui merged 2 commits into
Conversation
Route explicit read-only singleton positions before the captured-inventory fallback. Use the open handle published-position read without changing cursor or range frontiers, and retain closed-handle bounds. Cover direct LAC lag and cache-owner rollover with real BookKeeper tests. Assisted-by: OpenAI Codex
codelipenghui
marked this pull request as ready for review
October 31, 2026 00:28
lhotari
approved these changes
Nov 4, 2026
lhotari
left a comment
Member
There was a problem hiding this comment.
LGTM. Thanks for tracking down this snapshot-recovery read failure and covering it with real BookKeeper tests.
I checked that the cursor and range-read paths stay bounded before they reach this method: ManagedLedgerImpl.java:2962-2998 caps the range at the captured last position, so only explicit point reads take the new branch. Reverting the production change makes the new ReadEntryUtilsTest cases and both new ManagedLedgerBkTest cases fail. The red Broker Group 2 check is a Failed to bind to /0.0.0.0:42175 error in PulsarFunctionTlsMixedListenersTest.setup, which does not touch this code, so a re-run should clear it. One small, non-blocking note is inline.
Assisted-by: Codex
3 of 11 tasks
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
A shared entry cache can retain an older read-only managed ledger whose inventory predates a newly published snapshot ledger. Falling back to the read handle LAC rejects that published position when the open handle piggyback LAC lags, interrupting snapshot recovery. Explicit point reads need to work without changing cursor visibility.
Modifications
The real BookKeeper tests create their cursors before reading, so this change is independent of the separate read-only frontier initialization fix.
Verifying this change
Base: Apache master
8b827b7953aa62f51913b29377b760aec59db0d0.org.apache.bookkeeper.mledger.impl.cache.ReadEntryUtilsTest,org.apache.bookkeeper.mledger.impl.ManagedLedgerBkTest.testReadOnlyDirectReadLastPublishedEntryBeyondCursorFrontier,org.apache.bookkeeper.mledger.impl.ManagedLedgerBkTest.testReadOnlyDirectReadWithSharedCacheAfterRollover. 42 passed, zero failures/errors/skips, retries disabled../gradlew quickCheck --max-workers=2: passed.git diff --check: passed.Does this pull request potentially affect one of the following parts: