Jason918 commented on pull request #12890:
URL: https://github.com/apache/pulsar/pull/12890#issuecomment-974591446


   > Thanks for the case, I think the root cause is there is an ongoing read op 
to read data from the managed ledger, but after a consumer closed, some 
messages will be added to the replay queue, after the previous read op 
completed, the active consumer might get messages out of order by key.
   
   The root cause of  this case is `recentlyJoinedConsumers` is cleared in 
Thread3 when c1 is closed. See here.
   
https://github.com/apache/pulsar/blob/552360455382e33901b6d74c26f883ffb6907ba9/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java#L137
   
   
   So in the following Thread2, when `sendMessagesToConsumers` is called for 
m10-m14. Previously we are using `recentlyJoinedConsumers` in 
`getRestrictedMaxEntriesForConsumer` to prevent sending these messages to c2. 
But now it's cleared. so "maxMessages" is returned instead of "0". See here: 
https://github.com/apache/pulsar/blob/552360455382e33901b6d74c26f883ffb6907ba9/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java#L315


-- 
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]


Reply via email to