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


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java:
##########
@@ -572,23 +575,29 @@ public CompletableFuture<Void> acknowledgeOnClose(final 
Map<TopicIdPartition, Ac
             Node node = cluster.nodeById(nodeId);
             if (node != null) {
                 Map<TopicIdPartition, Acknowledgements> 
acknowledgementsMapForNode = new HashMap<>();
-                for (TopicIdPartition tip : 
sessionHandler.sessionPartitions()) {
-                    Acknowledgements acknowledgements = 
acknowledgementsMap.getOrDefault(tip, Acknowledgements.empty());
 
-                    Acknowledgements acksFromShareFetch = 
fetchAcknowledgementsToSend.remove(tip);
+                acknowledgementsMap.forEach((tip, nodeAcks) -> {
+                    Acknowledgements acknowledgements = 
Acknowledgements.empty();
+                    Map<TopicIdPartition, Acknowledgements> 
nodeAcksFromFetchMap = fetchAcknowledgementsToSend.get(nodeId);
+                    if (nodeAcksFromFetchMap != null) {
+                        Acknowledgements acksFromFetchMap = 
nodeAcksFromFetchMap.get(tip);

Review Comment:
   I'm not sure it matters because this is on the close path, but I think 
you're right that it's an improvement.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to