Repository navigation
[fix][test] Fix flaky shared read-ahead verification in ManagedLedgerTest - #27490
Open
void-ptr974 wants to merge 1 commit into
Open
void-ptr974 wants to merge 1 commit into
void-ptr974 wants to merge 1 commit into
Conversation
…Test Verify shared prefetch results and cache reuse without ordering asynchronous mock reads. Release test resources on assertion failures. Assisted-by: Codex
codelipenghui
approved these changes
Nov 9, 2026
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
This PR fixes a flaky assertion in
cursorsAtTheSamePositionShareTheReadAheadand strengthens its behavioral checks. Both cursors must receive the correct entries and reuse the prefetched cache, with exactly one storage read per range.The demand read is submitted first, but both mock reads reach the interceptor through
thenComposeAsync, so their observation order is not guaranteed. CI observed[5, 0], which the test incorrectly rejected because it required[0, 5].Modifications
Verify the shared read-ahead contract
0and5exactly once each, in either order. Missing, duplicate, or additional storage reads still fail.Keep the fixture stable and clean up on failure
Verifying this change
Validated on Linux x86_64 with JDK 21 and test retries disabled:
./gradlew quickCheckpassed.[5, 0]order. The scheduling gates were temporary and are not included in this PR.The changed test can be run with:
Does this pull request potentially affect one of the following parts: