msn-tldr commented on code in PR #14111:
URL: https://github.com/apache/kafka/pull/14111#discussion_r1581106940


##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java:
##########
@@ -384,6 +389,32 @@ int attempts() {
         return attempts.get();
     }
 
+    /*
+     * Returns whether the leader Node has changed since the last attempt.
+     * @param node The Node currently thought of as the leader, which might be 
null.
+     * @return true if the leader has changed, otherwise false
+     */
+    boolean hasLeaderChanged(Node latestLeader) {
+        boolean leaderChanged = false;
+        if (latestLeader != null) {
+            // If we don't know the leader yet, we have not yet attempted to 
send to the leader
+            if (currentLeader == null) {
+                currentLeader = latestLeader;
+            } else {
+                // If the leader's node id has changed, this counts as a 
leader change
+                if (currentLeader.id() != latestLeader.id()) {

Review Comment:
   The change was done along with KIP-951 changes.



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