merlimat opened a new pull request, #25371:
URL: https://github.com/apache/pulsar/pull/25371
## Flaky test failure
```
java.lang.IllegalArgumentException
at
com.google.common.base.Preconditions.checkArgument(Preconditions.java:127)
at
org.apache.pulsar.broker.delayed.bucket.BucketDelayedDeliveryTracker.addMessage(BucketDelayedDeliveryTracker.java:401)
```
## Summary
- Fix `IllegalArgumentException` in
`BucketDelayedDeliveryTracker.addMessage` when a ledger ID falls within the
current mutable bucket range (`startLedgerId <= ledgerId < endLedgerId`).
- The old code had a gap in its condition: it checked `ledgerId <
startLedgerId` to route to `sharedBucketPriorityQueue`, then assumed the else
branch always had `ledgerId >= endLedgerId` — but ledger IDs within
`[startLedgerId, endLedgerId)` fell through and hit `checkArgument(ledgerId >=
endLedgerId)` which throws.
- Fix by inverting the condition: check the "fast path" first (`ledgerId >=
endLedgerId && !existBucket` → add to mutable bucket), and route everything
else to `sharedBucketPriorityQueue`. This removes the `checkArgument` that
assumed monotonic ordering.
- The class is annotated `@ThreadSafe` and all public methods are
`synchronized`, so it should handle any concurrent call pattern gracefully.
- Verified 100/100 passes with `invocationCount=100` on the thread safety
test, plus all 24 `BucketDelayedDeliveryTrackerTest` pass.
## 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]