You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/08/02 17:17:38 UTC

[GitHub] [pulsar] Sunny-Island opened a new pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Sunny-Island opened a new pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535


   
   
   Fixes #11493 
   
   Master Issue: #11493 
   
   ### Motivation
   In Pulsar, we use a single client to create multiple producers/consumers/readers. Is there any method/attribute that can give information on number of producers/readers/consumers connected to the given pulsar client instance at the given point of time?
   
   Say there is a single pulsar client instance. Multiple consumers and readers are created from the given client instance. This client needs to be cleaned up when all the references are closed. In this case, it would be of help, to get information on the number of the consumers/readers/ getPartitionsForTopic calls are active on the given client. Ie, having the number of references for the given client can provide information on whether it is fine to clean up the client instance at the given point of time.
   
   *Explain here the context, and why you're making that change. What is the problem you're trying to solve.*
   
   ### Modifications
   
   Add these method to `Client.h`, `Client.cc`, `ClientImpl.h`, `CliemtImpl.cc` :
   ```
   uint64_t getNumberOfProducer()
   uint64_t getNumberOfConsumer()
   uint64_t getNumberOfReader() (May not be used)
   ```
   To count alive producers, I get each producer by weak point and check if it is connected.
   
   ### Verifying this change
   
   This change added tests and can be verified as follows:
   
   Add unit test to check if these functions can return correct references number. Test file is `ClientTest.cc`. Test function is `TEST(ClientTest, testGetNumberOfReferences)`.
   
   ### Documentation
   
   
   For this PR, do we need to update docs?
   
   I will add doc to C++ client part in follow-up issue.
   


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



[GitHub] [pulsar] Anonymitaet commented on pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#issuecomment-891630000


   @BewareMyPower many thanks for providing doc info! Since this PR modifies docs (it adds some descriptions in `.h` files and they are "docs"), I label this PR with `doc`.


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



[GitHub] [pulsar] Sunny-Island commented on pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
Sunny-Island commented on pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#issuecomment-891200632


   I have open a [PR](https://github.com/apache/pulsar/pull/11535). There are two questions:
   
   1. For PartitionedProducer/PartitionedConsumer/MultiTopicConsumer which consist of more than one consumer/producer. They should be counted as one or more reference?
   2. When created reader from client, client add reader's consumer to its consumer list. Should we remove `getNumberOfReader()`? I haven't implemented this function yet.


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



[GitHub] [pulsar] BewareMyPower commented on pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#issuecomment-891525856


   @Anonymitaet I changed the label from doc-required to no-need-doc because the documents are already added to the C++ header so that the related documents will be generated by Doxygen.


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



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#discussion_r681369774



##########
File path: pulsar-client-cpp/lib/ClientImpl.cc
##########
@@ -588,6 +588,30 @@ uint64_t ClientImpl::newRequestId() {
     return requestIdGenerator_++;
 }
 
+uint64_t ClientImpl::getNumberOfProducers() {
+    Lock lock(mutex_);
+    uint64_t numberOfAliveProducers = 0;
+    for (const auto& producer : producers_) {
+        if (producer.lock()->isConnected()) {

Review comment:
       You should check whether `lock()` returns a valid shared pointer like:
   
   ```c++
   const auto producerImpl = producer.lock();
   if (producerImpl) { /* ... */ }
   ```




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



[GitHub] [pulsar] BewareMyPower commented on pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#issuecomment-891438717


   > For PartitionedProducer/PartitionedConsumer/MultiTopicConsumer which consist of more than one consumer/producer. They should be counted as one or more reference?
   
   I think it should be counted as multiple references. For example, if you created a producer of a 3 partitions topic, there're actually 3 TCP connections.
   
   > When created reader from client, client add reader's consumer to its consumer list. Should we remove getNumberOfReader()? I haven't implemented this function yet.
   
   `Reader` is just treated as a `Consumer`, so I think we can remove the `getNumberOfReader()` method.


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



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#discussion_r681431017



##########
File path: pulsar-client-cpp/tests/ClientTest.cc
##########
@@ -114,3 +114,32 @@ TEST(ClientTest, testConnectTimeout) {
     clientLow.close();
     clientDefault.close();
 }
+
+TEST(ClientTest, testGetNumberOfReferences) {
+    Client client("pulsar://localhost:6650");
+    uint64_t numberOfProducers = 0;
+
+    Producer producer;
+    client.createProducer("persistent://public/default/testGetNumberOfReferences", producer);
+    numberOfProducers = 1;
+    ASSERT_EQ(numberOfProducers, client.getNumberOfProducers());
+
+    producer.close();
+    numberOfProducers = 0;
+    ASSERT_EQ(numberOfProducers, client.getNumberOfProducers());
+
+    uint64_t numberOfConsumers = 0;
+
+    Consumer consumer;
+    client.subscribe("persistent://public/default/testGetNumberOfReferences", "consumer-1", consumer);
+    numberOfConsumers = 1;
+    ASSERT_EQ(numberOfConsumers, client.getNumberOfConsumers());
+
+    consumer.close();
+    numberOfConsumers = 0;
+    ASSERT_EQ(numberOfConsumers, client.getNumberOfConsumers());
+
+    uint64_t numberOfReaders = 0;
+    ASSERT_EQ(numberOfReaders, client.getNumberOfReaders());
+    client.close();

Review comment:
       Remove it
   
   ```suggestion
   ```




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



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#discussion_r681515307



##########
File path: pulsar-client-cpp/tests/ClientTest.cc
##########
@@ -114,3 +116,50 @@ TEST(ClientTest, testConnectTimeout) {
     clientLow.close();
     clientDefault.close();
 }
+
+TEST(ClientTest, testGetNumberOfReferences) {
+    Client client("pulsar://localhost:6650");
+
+    // Producer test
+    uint64_t numberOfProducers = 0;
+    const std::string nonPartitionedTopic = "nonPartitionedTopic";
+    const std::string partitionedTopic = "partitionedTopic";
+    Producer producer;
+    client.createProducer(nonPartitionedTopic, producer);
+    numberOfProducers = 1;
+    ASSERT_EQ(numberOfProducers, client.getNumberOfProducers());
+
+    producer.close();
+    numberOfProducers = 0;
+    ASSERT_EQ(numberOfProducers, client.getNumberOfProducers());
+
+    // PartitionedProducer
+    int res = makePutRequest(
+        "http://localhost:8080/admin/v2/persistent/public/default/" + partitionedTopic + "/partitions", "2");
+    ASSERT_TRUE(res == 204 || res == 409) << "res: " << res;
+
+    client.createProducer(partitionedTopic, producer);
+    numberOfProducers = 2;
+    ASSERT_EQ(numberOfProducers, client.getNumberOfProducers());

Review comment:
       Add the test when `producer` of a partitioned topic is closed, the number of producers will become 0.




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



[GitHub] [pulsar] Anonymitaet commented on a change in pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on a change in pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#discussion_r681531217



##########
File path: pulsar-client-cpp/include/pulsar/Client.h
##########
@@ -355,6 +355,20 @@ class PULSAR_PUBLIC Client {
      */
     void shutdown();
 
+    /**
+     * @brief Get the Number Of alive Producers on current client.
+     *
+     * @return The number of alive Producers on current client.
+     */
+    uint64_t getNumberOfProducers();
+
+    /**
+     * @brief Get the Number Of alive Consumers on current client.
+     *
+     * @return The number of alive Consumers on current client.
+     */

Review comment:
       same

##########
File path: pulsar-client-cpp/include/pulsar/Client.h
##########
@@ -355,6 +355,20 @@ class PULSAR_PUBLIC Client {
      */
     void shutdown();
 
+    /**
+     * @brief Get the Number Of alive Producers on current client.
+     *
+     * @return The number of alive Producers on current client.

Review comment:
       same

##########
File path: pulsar-client-cpp/include/pulsar/Client.h
##########
@@ -355,6 +355,20 @@ class PULSAR_PUBLIC Client {
      */
     void shutdown();
 
+    /**
+     * @brief Get the Number Of alive Producers on current client.

Review comment:
       ```suggestion
        * @brief Get the number of alive producers on the current client.
   ```




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



[GitHub] [pulsar] Anonymitaet commented on pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#issuecomment-891508908


   @Sunny-Island you can take [this](https://docs.google.com/spreadsheets/d/1iTzn6QnOpTYK8QQHxXRb6a25nvuTNGPPJDdUQHGBUS4/edit#gid=1784579914) as references when adding docs.


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



[GitHub] [pulsar] Sunny-Island edited a comment on pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
Sunny-Island edited a comment on pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#issuecomment-891200632


   There are two questions:
   
   1. For PartitionedProducer/PartitionedConsumer/MultiTopicConsumer which consist of more than one consumer/producer. They should be counted as one or more reference?
   2. When created reader from client, client add reader's consumer to its consumer list. Should we remove `getNumberOfReader()`? I haven't implemented this function yet.


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



[GitHub] [pulsar] Anonymitaet removed a comment on pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
Anonymitaet removed a comment on pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#issuecomment-891627964


   @BewareMyPower many thanks for providing doc info!


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



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#discussion_r681362728



##########
File path: pulsar-client-cpp/include/pulsar/Client.h
##########
@@ -355,6 +355,10 @@ class PULSAR_PUBLIC Client {
      */
     void shutdown();
 
+    uint64_t getNumberOfProducers();
+    uint64_t getNumberOfConsumers();
+    uint64_t getNumberOfReaders();

Review comment:
       Please add the documents to these methods like other methods so that doxygen can generate the related docs.




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



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#discussion_r681514393



##########
File path: pulsar-client-cpp/tests/ClientTest.cc
##########
@@ -114,3 +116,50 @@ TEST(ClientTest, testConnectTimeout) {
     clientLow.close();
     clientDefault.close();
 }
+
+TEST(ClientTest, testGetNumberOfReferences) {
+    Client client("pulsar://localhost:6650");
+
+    // Producer test
+    uint64_t numberOfProducers = 0;
+    const std::string nonPartitionedTopic = "nonPartitionedTopic";
+    const std::string partitionedTopic = "partitionedTopic";
+    Producer producer;
+    client.createProducer(nonPartitionedTopic, producer);
+    numberOfProducers = 1;
+    ASSERT_EQ(numberOfProducers, client.getNumberOfProducers());
+
+    producer.close();
+    numberOfProducers = 0;
+    ASSERT_EQ(numberOfProducers, client.getNumberOfProducers());
+
+    // PartitionedProducer
+    int res = makePutRequest(
+        "http://localhost:8080/admin/v2/persistent/public/default/" + partitionedTopic + "/partitions", "2");
+    ASSERT_TRUE(res == 204 || res == 409) << "res: " << res;
+
+    client.createProducer(partitionedTopic, producer);
+    numberOfProducers = 2;
+    ASSERT_EQ(numberOfProducers, client.getNumberOfProducers());
+
+    // Consumer test
+    uint64_t numberOfConsumers = 0;
+
+    Consumer consumer;
+    client.subscribe(nonPartitionedTopic, "consumer-1", consumer);
+    numberOfConsumers = 1;
+    ASSERT_EQ(numberOfConsumers, client.getNumberOfConsumers());
+
+    consumer.close();
+    numberOfConsumers = 0;
+    ASSERT_EQ(numberOfConsumers, client.getNumberOfConsumers());
+
+    client.subscribe(partitionedTopic, "consumer-2", consumer);
+    numberOfConsumers = 2;
+    ASSERT_EQ(numberOfConsumers, client.getNumberOfConsumers());
+    client.subscribe(nonPartitionedTopic, "consumer-3", consumer);
+    numberOfConsumers = 3;
+    ASSERT_EQ(numberOfConsumers, client.getNumberOfConsumers());

Review comment:
       It's not good to reuse the `consumer` variable. You can create another two consumers so that you can test if the number of consumers would become 0 after they're closed.




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



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#discussion_r681510812



##########
File path: pulsar-client-cpp/tests/ClientTest.cc
##########
@@ -114,3 +116,50 @@ TEST(ClientTest, testConnectTimeout) {
     clientLow.close();
     clientDefault.close();
 }
+
+TEST(ClientTest, testGetNumberOfReferences) {
+    Client client("pulsar://localhost:6650");
+
+    // Producer test
+    uint64_t numberOfProducers = 0;
+    const std::string nonPartitionedTopic = "nonPartitionedTopic";
+    const std::string partitionedTopic = "partitionedTopic";

Review comment:
       Can you modify these two topic name to make sure they're unique and can be recognized as the related topics of `testGetNumberOfReferences`? You can take `ConsumerTest.testIsConnected` as example.




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



[GitHub] [pulsar] Sunny-Island commented on a change in pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
Sunny-Island commented on a change in pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#discussion_r681382836



##########
File path: pulsar-client-cpp/include/pulsar/Client.h
##########
@@ -355,6 +355,10 @@ class PULSAR_PUBLIC Client {
      */
     void shutdown();
 
+    uint64_t getNumberOfProducers();
+    uint64_t getNumberOfConsumers();
+    uint64_t getNumberOfReaders();

Review comment:
       ok.




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



[GitHub] [pulsar] BewareMyPower merged pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
BewareMyPower merged pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535


   


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



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#discussion_r681430765



##########
File path: pulsar-client-cpp/lib/ClientImpl.cc
##########
@@ -588,6 +588,30 @@ uint64_t ClientImpl::newRequestId() {
     return requestIdGenerator_++;
 }
 
+uint64_t ClientImpl::getNumberOfProducers() {
+    Lock lock(mutex_);
+    uint64_t numberOfAliveProducers = 0;
+    for (const auto& producer : producers_) {
+        const auto& producerImpl = producer.lock();
+        if (producerImpl && producerImpl->isConnected()) {
+            numberOfAliveProducers++;
+        }
+    }
+    return numberOfAliveProducers;
+}
+
+uint64_t ClientImpl::getNumberOfConsumers() {
+    Lock lock(mutex_);
+    uint64_t numberOfAliveConsumers = 0;
+    for (const auto& consumer : consumers_) {
+        const auto consumerImpl = consumer.lock();
+        if (consumerImpl) {
+            if (consumerImpl->isConnected()) numberOfAliveConsumers++;

Review comment:
       You can merge these two conditions to `if (consumerImpl && consumerImpl->isConnected())`.




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



[GitHub] [pulsar] Anonymitaet commented on pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#issuecomment-891627964


   @BewareMyPower many thanks for providing doc info!


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



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #11535: [Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #11535:
URL: https://github.com/apache/pulsar/pull/11535#discussion_r681508224



##########
File path: pulsar-client-cpp/lib/MultiTopicsConsumerImpl.cc
##########
@@ -749,3 +749,15 @@ bool MultiTopicsConsumerImpl::isConnected() const {
     }
     return true;
 }
+
+uint64_t MultiTopicsConsumerImpl::getNumberOfConnectedConsumer() {
+    Lock lock(mutex_);
+    uint64_t numberOfConnectedConsumer = 0;
+    const auto consumers = consumers_;

Review comment:
       Call `lock.unlock()` before this line because after this line only the local variable `consumers` is accessed and the lock is not required anymore.




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