merlimat opened a new pull request, #25360:
URL: https://github.com/apache/pulsar/pull/25360
## Flaky test failure
```
org.awaitility.core.ConditionTimeoutException: Assertion condition expected
[1] but found [2] within 10 seconds.
at
org.apache.pulsar.broker.service.ConsumedLedgersTrimTest.testAdminTrimLedgers
```
Also reproduces as producer timeout when running with invocationCount>1.
## Summary
Follow-up to #25342. Three issues causing flakiness:
1. **Fixed producer name** `"producer-name"` causes 30s timeout when running
with `invocationCount>1` because the previous invocation's partitioned producer
(3 sub-producers) may not have fully disconnected yet, and the new producer
with the same name waits for the old one.
- Fix: remove the fixed `producerName` so each invocation gets a unique
auto-generated name.
2. **Assertion too strict** — expects exactly 1 ledger after trim, but with
`maxEntriesPerLedger=2`, if partition-0 receives an even number of messages,
the last ledger is full and a new empty active ledger is created. After
trimming, 2 ledgers remain.
- Fix: assert `<= 2` instead of `== 1`.
3. **Trim is async** — `admin.topics().trimTopic()` returns immediately but
the actual ledger deletion happens in the background. The mark-delete position
may not be persisted yet when the first trim runs.
- Fix: re-trigger `trimConsumedLedgersInBackground()` inside the
Awaitility loop.
## Documentation
- [x] `doc-not-needed`
(Your PR doesn't need any doc update)
## Matching PR in forked repository
_No response_
### Tip
Add the labels `ready-to-test` and `area/test` to trigger the CI.
--
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]