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


##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java:
##########
@@ -110,7 +110,8 @@ public ProducerBatch(TopicPartition tp, 
MemoryRecordsBuilder recordsBuilder, lon
      * @param latestLeaderEpoch latest leader's epoch.
      */
     void maybeUpdateLeaderEpoch(Optional<Integer> latestLeaderEpoch) {
-        if (!currentLeaderEpoch.equals(latestLeaderEpoch)) {
+        if (latestLeaderEpoch.isPresent()

Review Comment:
   The change is intentional. The optimisation that KIP-951 proposed is that 
producer-batch should skip backoff period if "new leader" is known. This change 
corrects the previous logic to update the batch's leader-epoch only if its 
newer. I added a test in `ProducerBatchTest.java` to reflect that.



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