ddrid commented on code in PR #11991:
URL: https://github.com/apache/kafka/pull/11991#discussion_r843398778


##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java:
##########
@@ -184,16 +184,22 @@ private void startSequencesAtBeginning(TopicPartition 
topicPartition, ProducerId
         // responses which are due to the retention period elapsing, and those 
which are due to actual lost data.
         private long lastAckedOffset;
 
+        private static final Comparator<ProducerBatch> 
PRODUCER_BATCH_COMPARATOR = (b1, b2) -> {
+            if (b1.baseSequence() < b2.baseSequence()) return -1;
+            else if (b1.baseSequence() > b2.baseSequence()) return 1;
+            else return b1.equals(b2) ? 0 : 1;

Review Comment:
   Hi @artemlivshits, thanks for your comment. I don't think it violate the 
requirements for the `compare` method since we are comparing two batches using 
an integer.
   As for the stable order, I think it doesn't affect the current code, but I 
can fix this in another pr if you regard it necessary. What do you think?



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