smjn commented on code in PR #17149:
URL: https://github.com/apache/kafka/pull/17149#discussion_r1779348983


##########
share/src/main/java/org/apache/kafka/server/share/PersisterStateBatch.java:
##########
@@ -77,22 +77,40 @@ public boolean equals(Object o) {
         PersisterStateBatch that = (PersisterStateBatch) o;
         return firstOffset == that.firstOffset &&
             lastOffset == that.lastOffset &&
-            deliveryState == that.deliveryState &&
-            deliveryCount == that.deliveryCount;
+            deliveryCount == that.deliveryCount &&
+            deliveryState == that.deliveryState;
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(firstOffset, lastOffset, deliveryState, 
deliveryCount);
+        return Objects.hash(firstOffset, lastOffset, deliveryCount, 
deliveryState);
     }
 
     @Override
     public String toString() {
         return "PersisterStateBatch(" +
             "firstOffset=" + firstOffset + "," +
             "lastOffset=" + lastOffset + "," +
-            "deliveryState=" + deliveryState + "," +
-            "deliveryCount=" + deliveryCount +
+            "deliveryCount=" + deliveryCount + "," +
+            "deliveryState=" + deliveryState +
             ")";
     }
+
+    @Override
+    public int compareTo(Object o) {
+        PersisterStateBatch that = (PersisterStateBatch) o;
+        int deltaFirst = Long.compare(this.firstOffset(), that.firstOffset());
+        if (deltaFirst == 0) {
+            int deltaLast = Long.compare(this.lastOffset(), that.lastOffset());
+            if (deltaLast == 0) {
+                int deltaCount = this.deliveryCount() - that.deliveryCount();

Review Comment:
   No, this was a conscious decision:
   Plz check discussion 
https://github.com/apache/kafka/pull/17149#discussion_r1777003384



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