poorbarcode opened a new pull request, #17116: URL: https://github.com/apache/pulsar/pull/17116
Fixes - #11145 - #10380 - #17044 Master Issue: #11145 #10380 #17044 ### Motivation https://github.com/apache/pulsar/blob/4d7b1acff35a1a131ffeff34e8cec6007f6a2ec9/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ConsumedLedgersTrimTest.java#L145-L150 In addition to calling `internalTrimLedgers` directly in this unit test, the Broker also has scheduled tasks `consumedLedgersMonitor` calling `internalTrimLedgers`. (<strong>High light</strong>)See the code above, If `consumedLedgersMonitor` call `internalTrimLedgers` before `line:148`: the command `topics.getLastMessageId` will return `-1:-1:-1`, then the #11145 #10380 occurs. https://github.com/apache/pulsar/blob/4d7b1acff35a1a131ffeff34e8cec6007f6a2ec9/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ConsumedLedgersTrimTest.java#L152-L161 (<strong>High light</strong>)See the code above, If `consumedLedgersMonitor` call `internalTrimLedgers` before `line:161`: the command `managedLedger.getLedgersInfoAsList().size()` will return `1`, then the #17044 occurs. ### Modifications - Fix flaky test: Make `internalTrimLedgers` never trigger by `consumedLedgersMonitor` before `consumedLedgersMonitor` is triggered manually: disabled policy retention. https://github.com/apache/pulsar/blob/4d7b1acff35a1a131ffeff34e8cec6007f6a2ec9/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ConsumedLedgersTrimTest.java#L94-L99 - Try to solve another hidden Falky test: See the code above, I think `line:99` may be flaky, because we can't guarantee that `consumedLedgersMonitor --> internalTrimLedgers` will be executed later than `line:99`, so delete `line:99` ### Documentation - [ ] `doc-required` (Your PR needs to update docs and you will update later) - [x] `doc-not-needed` (Please explain why) - [ ] `doc` (Your PR contains doc changes) - [ ] `doc-complete` (Docs have been already added) -- 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]
