shibd opened a new pull request, #22600: URL: https://github.com/apache/pulsar/pull/22600
### Motivation #22430 After #22034, When the ledger is closed due to full entry, will trigger create a new ledger, However, since the creation of the ledger is asynchronous, sometimes the last ledger is not created before the function returns. https://github.com/apache/pulsar/blob/57a616eaa79096af5b49db89c99cd39ccc94ec00/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L1775-L1778 For this test: `ml.close();` is no make sure that the `currentLedger` switch successful, and there are two possible case: - Case1: **[Ledger01{entry1}], [Ledger02{entry1}], [Ledger03{}]** - Case2: **[Ledger01{entry1}], [Ledger02{entry1}]** **Case 1** will cause the test to fail. ### Modifications When `ml.close` to reopen a new `ManagerLedger` that will make sure into `Case1`, and then to assert timestamp of `Ledger02` than 0. ### Verifying this change - Run this test locally 1000 times always successful. ### Documentation <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. --> - [ ] `doc` <!-- Your PR contains doc changes. --> - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later --> - [x] `doc-not-needed` <!-- Your PR changes do not impact docs --> - [ ] `doc-complete` <!-- Docs have been already added --> ### Matching PR in forked repository PR in forked repository: <!-- ENTER URL HERE --> <!-- After opening this PR, the build in apache/pulsar will fail and instructions will be provided for opening a PR in the PR author's forked repository. apache/pulsar pull requests should be first tested in your own fork since the apache/pulsar CI based on GitHub Actions has constrained resources and quota. GitHub Actions provides separate quota for pull requests that are executed in a forked repository. The tests will be run in the forked repository until all PR review comments have been handled, the tests pass and the PR is approved by a reviewer. --> -- 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: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org