This is an automated email from the ASF dual-hosted git repository.

dcapwell pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-accord.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 21cdaf5d IndexOutOfBoundsException while serializing CommandsForKey 
(#90)
21cdaf5d is described below

commit 21cdaf5d280965cfdc690d385375635b498bc9f9
Author: dcapwell <[email protected]>
AuthorDate: Fri May 17 15:16:45 2024 -0700

    IndexOutOfBoundsException while serializing CommandsForKey (#90)
    
    patch by David Capwell; reviewed by Blake Eggleston for CASSANDRA-19642
---
 .../src/main/java/accord/local/CommandsForKey.java | 18 +++++++++++++++-
 .../accord/impl/basic/DelayedCommandStores.java    | 25 +++++++---------------
 2 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/accord-core/src/main/java/accord/local/CommandsForKey.java 
b/accord-core/src/main/java/accord/local/CommandsForKey.java
index cba170c9..cc44f242 100644
--- a/accord-core/src/main/java/accord/local/CommandsForKey.java
+++ b/accord-core/src/main/java/accord/local/CommandsForKey.java
@@ -161,6 +161,21 @@ public class CommandsForKey implements CommandsSummary
             return c;
         }
 
+        @Override
+        public boolean equals(Object o)
+        {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+            Unmanaged unmanaged = (Unmanaged) o;
+            return pending == unmanaged.pending && 
waitingUntil.equals(unmanaged.waitingUntil) && txnId.equals(unmanaged.txnId);
+        }
+
+        @Override
+        public int hashCode()
+        {
+            return Objects.hash(pending, waitingUntil, txnId);
+        }
+
         @Override
         public String toString()
         {
@@ -1699,7 +1714,8 @@ public class CommandsForKey implements CommandsSummary
         if (o == null || getClass() != o.getClass()) return false;
         CommandsForKey that = (CommandsForKey) o;
         return Objects.equals(key, that.key)
-               && Arrays.equals(txns, that.txns);
+               && Arrays.equals(txns, that.txns)
+               && Arrays.equals(unmanageds, that.unmanageds);
     }
 
     @Override
diff --git 
a/accord-core/src/test/java/accord/impl/basic/DelayedCommandStores.java 
b/accord-core/src/test/java/accord/impl/basic/DelayedCommandStores.java
index ea97c5e0..17e18b81 100644
--- a/accord-core/src/test/java/accord/impl/basic/DelayedCommandStores.java
+++ b/accord-core/src/test/java/accord/impl/basic/DelayedCommandStores.java
@@ -48,7 +48,6 @@ import accord.local.PreLoadContext;
 import accord.local.SafeCommandStore;
 import accord.local.SerializerSupport;
 import accord.local.ShardDistributor;
-import accord.messages.Message;
 import accord.primitives.Range;
 import accord.primitives.RoutableKey;
 import accord.primitives.Txn;
@@ -266,22 +265,14 @@ public class DelayedCommandStores extends 
InMemoryCommandStores.SingleThread
         @Override
         public void postExecute()
         {
-            if (context instanceof Message)
-            {
-                Message m = (Message) context;
-                if (m.type() != null && !m.type().hasSideEffects())
-                {
-                    // double check there are no modifications
-                    commands.entrySet().forEach(e -> {
-                        InMemorySafeCommand safe = e.getValue();
-                        if (!safe.isModified()) return;
-                        commandStore.validateRead(safe.current());
-                        Command original = safe.original();
-                        if (original != null)
-                            commandStore.validateRead(original);
-                    });
-                }
-            }
+            commands.entrySet().forEach(e -> {
+                InMemorySafeCommand safe = e.getValue();
+                if (!safe.isModified()) return;
+                commandStore.validateRead(safe.current());
+                Command original = safe.original();
+                if (original != null)
+                    commandStore.validateRead(original);
+            });
         }
     }
 }


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

Reply via email to