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

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

commit f5b25b5b1d2858a66e45aba409a3d2a201b8f6a2
Author: Benedict Elliott Smith <bened...@apache.org>
AuthorDate: Sun Sep 29 09:15:52 2024 +0100

    fix replay
---
 accord-core/src/main/java/accord/impl/InMemoryCommandStore.java | 3 ++-
 accord-core/src/test/java/accord/impl/basic/Journal.java        | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/accord-core/src/main/java/accord/impl/InMemoryCommandStore.java 
b/accord-core/src/main/java/accord/impl/InMemoryCommandStore.java
index 8f32380e..89fe806f 100644
--- a/accord-core/src/main/java/accord/impl/InMemoryCommandStore.java
+++ b/accord-core/src/main/java/accord/impl/InMemoryCommandStore.java
@@ -101,6 +101,7 @@ import static accord.primitives.SaveStatus.ReadyToExecute;
 import static accord.primitives.Status.Applied;
 import static accord.primitives.Status.Durability.Local;
 import static accord.primitives.Status.Invalidated;
+import static accord.primitives.Status.PreApplied;
 import static accord.primitives.Status.PreCommitted;
 import static accord.primitives.Status.Stable;
 import static accord.primitives.Status.Truncated;
@@ -1397,7 +1398,7 @@ public abstract class InMemoryCommandStore extends 
CommandStore
                                  safeStore -> {
                                      SafeCommand safeCommand = 
safeStore.unsafeGet(txnId);
                                      Command local = safeCommand.current();
-                                     if (local.is(Stable) && 
!local.hasBeen(Applied))
+                                     if (local.is(Stable) || 
local.is(PreApplied))
                                          Commands.maybeExecute(safeStore, 
safeCommand, local, true, true);
                                      else if 
(local.saveStatus().compareTo(Applying) >= 0 && !local.is(Invalidated) && 
!local.is(Truncated))
                                          Commands.applyWrites(safeStore, 
context, local).begin(agent);
diff --git a/accord-core/src/test/java/accord/impl/basic/Journal.java 
b/accord-core/src/test/java/accord/impl/basic/Journal.java
index 019801b7..1a53472b 100644
--- a/accord-core/src/test/java/accord/impl/basic/Journal.java
+++ b/accord-core/src/test/java/accord/impl/basic/Journal.java
@@ -55,6 +55,7 @@ import accord.primitives.Writes;
 import accord.utils.Invariants;
 import org.agrona.collections.Long2ObjectHashMap;
 
+import static accord.primitives.SaveStatus.Stable;
 import static accord.primitives.Status.Invalidated;
 import static accord.primitives.Status.Truncated;
 import static accord.utils.Invariants.illegalState;
@@ -134,7 +135,7 @@ public class Journal
             for (TxnId txnId : diffs.keySet())
             {
                 Command command = reconstruct(commandStoreId, txnId);
-                if (command.saveStatus().compareTo(SaveStatus.Applying) >= 0 
&& !command.is(Invalidated) && !command.is(Truncated))
+                if (command.saveStatus().compareTo(Stable) >= 0 && 
!command.hasBeen(Truncated))
                     toApply.add(command);
                 loader.load(command);
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to