pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] sschepens commented on a change in pull request #963: Partitioned Consumer UnAckedMessageTracker
Date Thu, 01 Jan 1970 00:00:00 GMT
sschepens commented on a change in pull request #963: Partitioned Consumer UnAckedMessageTracker
URL: https://github.com/apache/incubator-pulsar/pull/963#discussion_r157476847
 
 

 ##########
 File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/PartitionedConsumerImpl.java
 ##########
 @@ -418,24 +449,24 @@ private ConsumerConfiguration getInternalConsumerConfig() {
 
     @Override
     public void redeliverUnacknowledgedMessages() {
-        for (ConsumerImpl c : consumers) {
-            c.redeliverUnacknowledgedMessages();
+        synchronized (this) {
+            incomingMessages.clear();
+            unAckedMessageTracker.clear();
+            for (ConsumerImpl c : consumers) {
+                c.redeliverUnacknowledgedMessages();
+            }
+            resumeReceivingFromPausedConsumersIfNeeded();
 
 Review comment:
   @rdhabalia I'm not sure when this could happen.
   
   >  mean what if none of the consumer is waiting on pausedConsumers. we add consumer
pausedConsumers list when incomingMessages size reached to threshold
   
   If no consumer is waiting on `pausedConsumers` that would mean we have an active call to
`receiveAsync` on every consumer, redelivery should not affect this.
   
   > So, if that threshold is not reached yet and pausedConsumers is empty and if we call
resumeReceivingFromPausedConsumersIfNeeded then it doesn't do anything and partitioned-consumer
may not receive any messages.
   
   There should be no way this threshold is not reached here since we're emptying the queue,
anyways, reaching the threshold would mean that there are still messages in the queue waiting
to be consumed, when these messages are eventually consumed that would trigger and unpause
of consumers.
   Anyways I'm going to reoder the method, I think we should first call redelivery on the
consumers and then empty the queue.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message