equanz commented on code in PR #23447:
URL: https://github.com/apache/pulsar/pull/23447#discussion_r1798774260


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ConsistentHashingStickyKeyConsumerSelector.java:
##########
@@ -147,9 +208,15 @@ public Optional<ImpactedConsumersResult> 
removeConsumer(Consumer consumer) {
                 // Remove all the points that were added for this consumer
                 for (int i = 0; i < numberOfPoints; i++) {
                     int hash = calculateHashForConsumerAndIndex(consumer, 
consumerNameIndex, i);
-                    if (hashRing.remove(hash, consumerIdentityWrapper)) {
-                        
consumerNameIndexTracker.decreaseConsumerRefCount(consumerIdentityWrapper);
-                    }
+                    hashRing.compute(hash, (k, hashRingPointEntry) -> {
+                        assert hashRingPointEntry != null : "hash ring entry 
wasn't found for hash " + hash;

Review Comment:
   nits:
   I know this line is for unexpected behavior. But is it a good handling 
method when assertion is enabled?
   



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