Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix hasMessageAvailable return true but can't read message (apache#10414
) ### Motivation I temporarily fixed this problem in PR apache#10190. Now we have found a better way, this way can avoid the seek, then avoid trigger another reconnection. Thank you @codelipenghui to troubleshoot this issue with me all night. We have added a lot of log and found that this issue is caused by some race condition problems. Here is the first reason: https://github.com/apache/pulsar/blob/f2d72c9fc13a33df584ec1bd96a4c147774b858d/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1808-L1818 Now we have an acknowledgmentsGroupingTracker to filter duplicate messages, and this Tracker will be cleaned up after seek. However, it is possible that the connection is ready and Broker has pushed message, but `acknowledgmentsGroupingTracker.flushAndClean(); ` has not been executed yet. Finally hasMessageAvailableAsync returns true, but the message cannot be read because it is filtered by the acknowledgmentsGroupingTracker ### Modifications clean the tracker when connection was open ### Verifying this change
- Loading branch information