wolfstudy opened a new pull request, #15468:
URL: https://github.com/apache/pulsar/pull/15468

   Signed-off-by: xiaolongran <[email protected]>
   
   
   ### Motivation
   
   
   Currently, if the user does not specify the producerName when creating the 
producer, the broker will generate a unique ProducerName field:
   
   ```
           // Use producer name provided by client if present
           final String producerName = cmdProducer.hasProducerName() ? 
cmdProducer.getProducerName()
                   : service.generateUniqueProducerName();
   ```
   
   However, when the sub is created and the user does not specify a 
consumerName, an empty string is used instead:
   
   ```
   final String consumerName = subscribe.hasConsumerName() ? 
subscribe.getConsumerName() : "";
   ```
   
   Under normal circumstances, this seems to be no problem, but when many 
topics reuse the same client, and for some reason, the connection is frequently 
disconnected, reconnected, disconnected, and reconnected. In this way, we can 
see that there are many consumer objects with the same consumerName under the 
current subscription through `bin/pulsar-admin topics stats <topic-name>`.
   
   The following is a phenomenon we encountered in the production environment. 
This `consumerName: exchange-wal-consumer-9.1x.1x.x-3953a` has a total of 
**997** consumer objects with the same name under this topic.
   
   
   <img width="1685" alt="image" 
src="https://user-images.githubusercontent.com/20965307/167100529-f1d88a11-77ba-48c4-81d4-96d2f5b36e88.png";>
   
   
   ### Modifications
   
   - Use unique consumer name when create sub
   
   


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