AndrewJSchofield commented on code in PR #21149:
URL: https://github.com/apache/kafka/pull/21149#discussion_r2671680842


##########
clients/src/main/java/org/apache/kafka/clients/producer/RoundRobinPartitioner.java:
##########
@@ -64,7 +64,11 @@ public int partition(String topic, Object key, byte[] 
keyBytes, Object value, by
     }
 
     private int nextValue(String topic) {
-        AtomicInteger counter = topicCounterMap.computeIfAbsent(topic, k -> 
new AtomicInteger(0));
+        AtomicInteger counter = topicCounterMap.get(topic);
+        if(counter == null) {
+            counter = new AtomicInteger(0);
+            AtomicInteger counter = topicCounterMap.putIfAbsent(topic, 
counter);
+        }
         return counter.getAndIncrement();
     }
 

Review Comment:
   Exactly. So, I propose that we close this PR. It doesn't seem like it's 
doing what was intended. Please correct me if I'm wrong.



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