You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "poorbarcode (via GitHub)" <gi...@apache.org> on 2023/09/15 17:00:46 UTC

[GitHub] [pulsar] poorbarcode commented on a diff in pull request #21183: [fix] [broker] Make the new exclusive consumer instead the inactive one faster

poorbarcode commented on code in PR #21183:
URL: https://github.com/apache/pulsar/pull/21183#discussion_r1327569100


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractDispatcherSingleActiveConsumer.java:
##########
@@ -166,6 +166,10 @@ public synchronized CompletableFuture<Void> addConsumer(Consumer consumer) {
         }
 
         if (subscriptionType == SubType.Exclusive && !consumers.isEmpty()) {
+            Consumer actConsumer = ACTIVE_CONSUMER_UPDATER.get(this);
+            if (actConsumer != null) {
+                actConsumer.cnx().checkConnectionLiveness();
+            }

Review Comment:
   @codelipenghui 
   
   > But the new consumer will not retry to connect to the topic, right? Do we need to wait for the connection liveness check to be done?
   
   Sure, I did this improve.
   
   I have a concern: 
   
   **Background**: the PR https://github.com/apache/pulsar/pull/20026 changed the method `dispatcher.addConsumer` to an asynchronous method, it broke the lock of `synchronized(dispathcer.this)`, this change only affected the releases larger than `3.0.0`.
   
   **Concern**: The improvement "wait for the connection liveness check done" relies on the asynchronous method `dispatcher.addConsumer`. I am thinking about whether to accept the patch https://github.com/apache/pulsar/pull/20026 and fix the broken lock, or revert this patch to make the logic simple.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org