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


##########
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:
   I don't see a problem in using an assertion for a case which would be a 
clear bug in the implementation that will be catched by the unit tests.



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