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

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

commit 5785d86ddad62932e21eb427deede09c77352213
Author: Alex Petrov <[email protected]>
AuthorDate: Wed Dec 4 10:51:57 2024 +0100

    Fix SimulatedDepsTest
    
    Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20114
---
 .../test/java/accord/impl/basic/InMemoryJournal.java   | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/accord-core/src/test/java/accord/impl/basic/InMemoryJournal.java 
b/accord-core/src/test/java/accord/impl/basic/InMemoryJournal.java
index a7120fad..0432ede5 100644
--- a/accord-core/src/test/java/accord/impl/basic/InMemoryJournal.java
+++ b/accord-core/src/test/java/accord/impl/basic/InMemoryJournal.java
@@ -92,15 +92,23 @@ public class InMemoryJournal implements Journal
     }
 
     @Override
-    public void saveCommand(int store, CommandUpdate diff, Runnable onFlush)
+    public void saveCommand(int store, CommandUpdate update, Runnable onFlush)
     {
-        if (diff != null && diff.before != diff.after && 
diff.after.saveStatus() == SaveStatus.Uninitialised)
+        Diff diff;
+        if (update == null
+            || update.before == update.after
+            || update.after.saveStatus() == SaveStatus.Uninitialised
+            || (diff = diff(update.before, update.after)) == null)
         {
-            diffsPerCommandStore.computeIfAbsent(store, (k) -> new TreeMap<>())
-                                .computeIfAbsent(diff.txnId, (k_) -> new 
ArrayList<>())
-                                .add(diff(diff.before, diff.after));
+            if (onFlush!= null)
+                onFlush.run();
+            return;
         }
 
+        diffsPerCommandStore.computeIfAbsent(store, (k) -> new TreeMap<>())
+                            .computeIfAbsent(update.txnId, (k_) -> new 
ArrayList<>())
+                            .add(diff);
+
         if (onFlush!= null)
             onFlush.run();
     }


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

Reply via email to