dcapwell commented on code in PR #2144:
URL: https://github.com/apache/cassandra/pull/2144#discussion_r1123951451


##########
src/java/org/apache/cassandra/service/accord/AccordSafeCommand.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.cassandra.service.accord;
+
+import java.util.Objects;
+
+import com.google.common.annotations.VisibleForTesting;
+
+import accord.local.Command;
+import accord.local.SafeCommand;
+import accord.primitives.TxnId;
+
+public class AccordSafeCommand extends SafeCommand implements 
AccordSafeState<TxnId, Command>
+{
+    private boolean invalidated;
+    private final AccordLoadingState<TxnId, Command> global;
+    private Command original;
+    private Command current;
+
+    public AccordSafeCommand(AccordLoadingState<TxnId, Command> global)
+    {
+        super(global.key());
+        this.global = global;
+        this.original = null;
+        this.current = null;
+    }
+
+    @Override
+    public boolean equals(Object o)
+    {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        AccordSafeCommand that = (AccordSafeCommand) o;
+        return Objects.equals(original, that.original) && 
Objects.equals(current, that.current);
+    }
+
+    @Override
+    public int hashCode()
+    {
+        throw new UnsupportedOperationException();

Review Comment:
   ```
   ERROR [CommandStore[20]:1] 2023-03-02 17:52:10,604 
JVMStabilityInspector.java:68 - Exception in thread 
Thread[CommandStore[20]:1,5,CommandStore[20]]
   java.lang.UnsupportedOperationException: null
           at 
org.apache.cassandra.service.accord.AccordSafeCommand.hashCode(AccordSafeCommand.java:56)
           at java.base/java.lang.Object.toString(Object.java:246)
           at java.base/java.lang.String.valueOf(String.java:2951)
           at java.base/java.lang.StringBuilder.append(StringBuilder.java:172)
           at 
org.apache.cassandra.service.accord.AccordSafeState.checkNotInvalidated(AccordSafeState.java:74)
           at 
org.apache.cassandra.service.accord.AccordSafeCommand.original(AccordSafeCommand.java:82)
           at 
org.apache.cassandra.service.accord.AccordSafeCommand.original(AccordSafeCommand.java:29)
           at 
org.apache.cassandra.service.accord.AccordSafeState.hasUpdate(AccordSafeState.java:38)
           at 
org.apache.cassandra.service.accord.async.AsyncWriter.lambda$assembleWrites$1(AsyncWriter.java:85)
   ```
   
   this is why I am not a fan of our style guide saying we should exclude if we 
define the other... we don't always know its not used =(



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to