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


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java:
##########
@@ -630,6 +665,21 @@ public CompletableFuture<Void> acknowledgeOnClose(final 
Map<TopicIdPartition, No
         return closeFuture;
     }
 
+    private boolean isNodeLeader(int nodeId, TopicIdPartition 
topicIdPartition) {
+        Optional<Node> leaderNode = 
metadata.currentLeader(topicIdPartition.topicPartition()).leader;
+        if (leaderNode.isPresent()) {
+            if (leaderNode.get().id() != nodeId) {
+                log.debug("Node {} is no longer the leader for topic ID 
partition {}, failing acknowledgements", nodeId, topicIdPartition);

Review Comment:
   nit: In this file, the log lines just use `for partition {}` and never `for 
topic ID partition {}`.



##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java:
##########
@@ -630,6 +665,21 @@ public CompletableFuture<Void> acknowledgeOnClose(final 
Map<TopicIdPartition, No
         return closeFuture;
     }
 
+    private boolean isNodeLeader(int nodeId, TopicIdPartition 
topicIdPartition) {
+        Optional<Node> leaderNode = 
metadata.currentLeader(topicIdPartition.topicPartition()).leader;
+        if (leaderNode.isPresent()) {
+            if (leaderNode.get().id() != nodeId) {
+                log.debug("Node {} is no longer the leader for topic ID 
partition {}, failing acknowledgements", nodeId, topicIdPartition);
+                return false;
+            }
+        } else {
+            log.debug("No leader found for topic ID partition {}", 
topicIdPartition);

Review Comment:
   And here too.



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