merlimat opened a new pull request, #25595:
URL: https://github.com/apache/pulsar/pull/25595

   ### Motivation
   
   `ManagedLedgerTest.testInvalidateReadHandleWhenConsumed` is flaky on CI with 
`expected [3] but found [2]` on `assertEquals(ledger.ledgerCache.size(), 3)`.
   
   With `maxEntriesPerLedger=1` and 3 entries, the test expects 4 ledgers (3 
closed + 1 current empty). When the read happens before the last ledger roll 
completes, the final entry is read directly from `currentLedger` instead of via 
`ledgerCache`, so `ledgerCache.size()` is 2 instead of the expected 3.
   
   Same root cause and fix as #25495 (which fixed the sibling 
`testInvalidateReadHandleWhenDeleteLedger`).
   
   ### Modifications
   
   Wait for `ledger.ledgers.size() == 4` before clearing the entry cache and 
reading entries.
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   This change is already covered by existing tests.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to