oneby-wang opened a new pull request, #25101: URL: https://github.com/apache/pulsar/pull/25101
Fixes https://github.com/apache/pulsar/issues/25092 ### Motivation `ManagedCursorTest.asyncMarkDeleteBlocking()` test is very flaky after PR https://github.com/apache/pulsar/pull/25087, so fix it. ### Modifications 1. When doing local debug, I see many logs like this: ``` org.apache.bookkeeper.mledger.ManagedLedgerException: org.apache.bookkeeper.mledger.impl.ManagedCursorImpl$MarkDeletingMarkedPosition: Mark deleting an already mark-deleted position. Current mark-delete: 13:9 -- attempted mark delete: 13:8 Caused by: org.apache.bookkeeper.mledger.impl.ManagedCursorImpl$MarkDeletingMarkedPosition: Mark deleting an already mark-deleted position. Current mark-delete: 13:9 -- attempted mark delete: 13:8 at org.apache.bookkeeper.mledger.impl.ManagedCursorImpl.setAcknowledgedPosition(ManagedCursorImpl.java:2076) at org.apache.bookkeeper.mledger.impl.ManagedCursorImpl.asyncMarkDelete(ManagedCursorImpl.java:2212) at org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl.maybeUpdateCursorBeforeTrimmingConsumedLedger(ManagedLedgerImpl.java:2736) at org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl$14.operationComplete(ManagedLedgerImpl.java:1768) at org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl$14.operationComplete(ManagedLedgerImpl.java:1747) at org.apache.bookkeeper.mledger.impl.MetaStoreImpl.lambda$asyncUpdateLedgerIds$7(MetaStoreImpl.java:187) ``` So I modify `if (!lastAckedPosition.equals(cursor.getMarkDeletedPosition()))` to `if (lastAckedPosition.compareTo(cursor.getMarkDeletedPosition()) > 0)` in `ManagedLedgerImpl`. 2. Modify some typos, and add some todos(could be deleted if not needed) in `ManagedLedgerImpl`. 3. Fix `asyncMarkDeleteBlocking()` flaky test, see method comments. 4. Add `asyncMarkDeleteBlockingWithOneShot()` test, see method comments. I move `c1.asyncMarkDelete` out of `asyncAddEntry#addComplete` callback method, because the two operations seem to compete for the same ledgerId, which is the reason why make `asyncMarkDeleteBlocking()` test is more flaky after https://github.com/apache/pulsar/pull/25087. Some logs in previous `asyncMarkDeleteBlocking()` unfixed flaky test. ``` 2025-12-19T21:58:48,996 - INFO - [main:ManagedCursorTest@1405] - size: 100, positions: [3:0, 3:1, 3:2, 3:3, 3:4, 3:5, 3:6, 3:7, 3:8, 3:9, 5:0, 5:1, 5:2, 5:3, 5:4, 5:5, 5:6, 5:7, 5:8, 5:9, 7:0, 7:1, 7:2, 7:3, 7:4, 7:5, 7:6, 7:7, 7:8, 7:9, 9:0, 9:1, 9:2, 9:3, 9:4, 9:5, 9:6, 9:7, 9:8, 9:9, 11:0, 11:1, 11:2, 11:3, 11:4, 11:5, 11:6, 11:7, 11:8, 11:9, 13:0, 13:1, 13:2, 13:3, 13:4, 13:5, 13:6, 13:7, 13:8, 13:9, 14:0, 14:1, 14:2, 14:3, 14:4, 14:5, 14:6, 14:7, 14:8, 14:9, 16:0, 16:1, 16:2, 16:3, 16:4, 16:5, 16:6, 16:7, 16:8, 16:9, 18:0, 18:1, 18:2, 18:3, 18:4, 18:5, 18:6, 18:7, 18:8, 18:9, 19:0, 19:1, 19:2, 19:3, 19:4, 19:5, 19:6, 19:7, 19:8, 19:9] 2025-12-19T21:58:48,625 - INFO - [main:ManagedCursorTest@1405] - size: 100, positions: [3:0, 3:1, 3:2, 3:3, 3:4, 3:5, 3:6, 3:7, 3:8, 3:9, 5:0, 5:1, 5:2, 5:3, 5:4, 5:5, 5:6, 5:7, 5:8, 5:9, 7:0, 7:1, 7:2, 7:3, 7:4, 7:5, 7:6, 7:7, 7:8, 7:9, 8:0, 8:1, 8:2, 8:3, 8:4, 8:5, 8:6, 8:7, 8:8, 8:9, 10:0, 10:1, 10:2, 10:3, 10:4, 10:5, 10:6, 10:7, 10:8, 10:9, 11:0, 11:1, 11:2, 11:3, 11:4, 11:5, 11:6, 11:7, 11:8, 11:9, 13:0, 13:1, 13:2, 13:3, 13:4, 13:5, 13:6, 13:7, 13:8, 13:9, 15:0, 15:1, 15:2, 15:3, 15:4, 15:5, 15:6, 15:7, 15:8, 15:9, 17:0, 17:1, 17:2, 17:3, 17:4, 17:5, 17:6, 17:7, 17:8, 17:9, 19:0, 19:1, 19:2, 19:3, 19:4, 19:5, 19:6, 19:7, 19:8, 19:9] ``` 5. Add `asyncMarkDeleteBlockingWithMultiShots()` test, see method comments. ### Verifying this change - [x] Make sure that the change passes the CI checks. ### Does this pull request potentially affect one of the following parts: <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. --> *If the box was checked, please highlight the changes* - [ ] Dependencies (add or upgrade a dependency) - [ ] The public API - [ ] The schema - [ ] The default values of configurations - [ ] The threading model - [ ] The binary protocol - [ ] The REST endpoints - [ ] The admin CLI options - [ ] The metrics - [ ] Anything that affects deployment ### 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: https://github.com/oneby-wang/pulsar/pull/16 -- 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]
