FrankYang0529 commented on code in PR #19475:
URL: https://github.com/apache/kafka/pull/19475#discussion_r2068841287


##########
server-common/src/main/java/org/apache/kafka/server/common/OffsetAndEpoch.java:
##########
@@ -16,40 +16,11 @@
  */
 package org.apache.kafka.server.common;
 
-public class OffsetAndEpoch {
-    private final long offset;
-    private final int leaderEpoch;
-
-    public OffsetAndEpoch(long offset, int leaderEpoch) {
-        this.offset = offset;
-        this.leaderEpoch = leaderEpoch;
-    }
-
-    public long offset() {
-        return offset;
-    }
-
-    public int leaderEpoch() {
-        return leaderEpoch;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-        OffsetAndEpoch that = (OffsetAndEpoch) o;
-        return offset == that.offset && leaderEpoch == that.leaderEpoch;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = leaderEpoch;
-        result = 31 * result + Long.hashCode(offset);
-        return result;
-    }
-
+public record OffsetAndEpoch(long offset, int leaderEpoch) implements 
Comparable<OffsetAndEpoch> {

Review Comment:
   I think chnage to `epoch` can fix error test cases, because current 
assertion error is:
   ```
   Expected :Cannot create a snapshot with an id (OffsetAndEpoch[offset=1, 
epoch=1]) greater than the high-watermark (0)
   Actual   :Cannot create a snapshot with an id (OffsetAndEpoch[offset=1, 
leaderEpoch=1]) greater than the high-watermark (0)
   ```
   



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