Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that the same message ID is not added to UnAckedMessageTracker…
… multiple times (apache#5823) ### Motivation When a message ID is added to `UnAckedMessageTracker`, it is added as an instance of `MessageIdImpl`, not `BatchMessageIdImpl`. Since the batch index information is deleted at this time, the same message ID will be added to `UnAckedMessageTracker` multiple times when consumer receives batched messages. https://github.com/apache/pulsar/blob/a8c8a7ee1559bc607b3454fa55134094d8a2c208/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1124-L1134 There is no problem even if the same message ID is added without taking too much time. However, if the interval between these message IDs is long, the message IDs may be added to other elements of `timePartitions`. https://github.com/apache/pulsar/blob/09360682953d0cbc154630a470492c11a4f83184/pulsar-client/src/main/java/org/apache/pulsar/client/impl/UnAckedMessageTracker.java#L163-L172 As a result, even if the consumer sends ack, some message IDs remain without being deleted from `timePartitions`, and an unnecessary ack timeout event occurs. ### Modifications When adding a message ID to `UnAckedMessageTracker`, check if the same message ID is already included in` timePartitions`, and if it is included, do nothing.
- Loading branch information