Copilot commented on code in PR #2133:
URL: https://github.com/apache/phoenix/pull/2133#discussion_r2065183909


##########
phoenix-core-server/src/main/java/org/apache/phoenix/replication/log/LogFileRecord.java:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.replication.log;
+
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellScanner;
+import org.apache.hadoop.hbase.client.Delete;
+import org.apache.hadoop.hbase.client.Mutation;
+import org.apache.hadoop.hbase.client.Put;
+
[email protected](value = { "EI_EXPOSE_REP", 
"EI_EXPOSE_REP2" },
+    justification = "Intentional")
+public class LogFileRecord implements LogFile.Record {
+
+    private String tableName;
+    private long commitId;
+    private Mutation mutation;
+    private int serializedLength;
+
+    public LogFileRecord() {
+    }
+
+    @Override
+    public String getHBaseTableName() {
+        return tableName;
+    }
+
+    @Override
+    public LogFile.Record setHBaseTableName(String tableName) {
+        this.tableName = tableName;
+        return this;
+    }
+
+    @Override
+    public long getCommitId() {
+        return commitId;
+    }
+
+    @Override
+    public LogFile.Record setCommitId(long commitId) {
+        this.commitId = commitId;
+        return this;
+    }
+
+    @Override
+    public Mutation getMutation() {
+        return this.mutation;
+    }
+
+    @Override
+    public LogFile.Record setMutation(Mutation mutation) {
+        this.mutation = mutation;
+        return this;
+    }
+
+    @Override
+    public int getSerializedLength() {
+        // NOTE: Should be set by the Codec using setSerializedLength after 
reading or writing
+        // the record.
+        return this.serializedLength;
+    }
+
+    @Override
+    public LogFile.Record setSerializedLength(int serializedLength) {
+        this.serializedLength = serializedLength;
+        return this;
+    }
+
+    @Override
+    public int hashCode() {
+        int code = tableName.hashCode();
+        code ^= Long.hashCode(commitId);
+        code ^= mutation.toString().hashCode();
+        return code;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        LogFileRecord other = (LogFileRecord) obj;
+        return tableName.equals(other.tableName)
+            && commitId == other.commitId
+            && mutation.toString().equals(other.toString());

Review Comment:
   The equals() method compares mutation.toString() against other.toString() 
instead of comparing the mutations directly (e.g., using 
other.mutation.toString()). This can lead to incorrect equality checks; please 
update the comparison to explicitly compare the mutation fields.
   ```suggestion
               && mutation.toString().equals(other.mutation.toString());
   ```



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