BewareMyPower commented on code in PR #24920:
URL: https://github.com/apache/pulsar/pull/24920#discussion_r2485754056


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractDispatcherSingleActiveConsumer.java:
##########
@@ -64,6 +64,7 @@ public abstract class AbstractDispatcherSingleActiveConsumer 
extends AbstractBas
 
     protected boolean isFirstRead = true;
     private static final int CONSUMER_CONSISTENT_HASH_REPLICAS = 100;
+    private volatile int addConsumerCount = 0;

Review Comment:
   ```suggestion
       private int addConsumerCount = 0;
   ```
   
   No need to use `volatile` here



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractDispatcherSingleActiveConsumer.java:
##########
@@ -225,6 +226,24 @@ public synchronized CompletableFuture<Void> 
addConsumer(Consumer consumer) {
         return CompletableFuture.completedFuture(null);
     }
 
+    /**
+     * This method is used to help debugging addConsumer failed for exclusive 
subscription.
+     * @param actConsumer
+     * @param consumer
+     * @return
+     */
+    private synchronized CompletableFuture<Void> internalAddConsumer(Consumer 
actConsumer, Consumer consumer) {
+        addConsumerCount++;
+        if (addConsumerCount >= 5) {
+            log.warn("Added consumer failed, consumers {}, active consumer {}, 
active state : {}", consumers,
+                    actConsumer, actConsumer.cnx().isActive());

Review Comment:
   You can add `addConsumerCount` in log.



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