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 901a086  Ninja: Added check that command.route is not null when SPL is 
trying to inform, saw this event in CI and need more details to know what 
happened
901a086 is described below

commit 901a0868cdaf6426226e6bafb0675773e04668bd
Author: David Capwell <dcapw...@apache.org>
AuthorDate: Thu Jan 11 09:22:24 2024 -0800

    Ninja: Added check that command.route is not null when SPL is trying to 
inform, saw this event in CI and need more details to know what happened
---
 accord-core/src/main/java/accord/impl/SimpleProgressLog.java | 2 ++
 accord-core/src/main/java/accord/local/Command.java          | 8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/accord-core/src/main/java/accord/impl/SimpleProgressLog.java 
b/accord-core/src/main/java/accord/impl/SimpleProgressLog.java
index 32e432d..575252d 100644
--- a/accord-core/src/main/java/accord/impl/SimpleProgressLog.java
+++ b/accord-core/src/main/java/accord/impl/SimpleProgressLog.java
@@ -402,6 +402,8 @@ public class SimpleProgressLog implements 
ProgressLog.Factory
                 {
                     Command command = safeCommand.current();
                     // make sure a quorum of the home shard is aware of the 
transaction, so we can rely on it to ensure progress
+                    if (command.route() == null)
+                        throw new AssertionError(String.format("Attempted to 
inform but route is not known for command %s", command));
                     AsyncChain<Void> inform = inform(node, txnId, 
command.route());
                     inform.begin((success, fail) -> {
                         commandStore.execute(empty(), ignore -> {
diff --git a/accord-core/src/main/java/accord/local/Command.java 
b/accord-core/src/main/java/accord/local/Command.java
index 1f082a9..cb157b7 100644
--- a/accord-core/src/main/java/accord/local/Command.java
+++ b/accord-core/src/main/java/accord/local/Command.java
@@ -225,11 +225,12 @@ public abstract class Command implements CommonAttributes
         private final TxnId txnId;
         private final SaveStatus status;
         private final Durability durability;
+        @Nullable
         private final Route<?> route;
         private final Ballot promised;
         private final Listeners.Immutable listeners;
 
-        private AbstractCommand(TxnId txnId, SaveStatus status, Durability 
durability, Route<?> route, Ballot promised, Listeners.Immutable listeners)
+        private AbstractCommand(TxnId txnId, SaveStatus status, Durability 
durability, @Nullable Route<?> route, Ballot promised, Listeners.Immutable 
listeners)
         {
             this.txnId = txnId;
             this.status = validateCommandClass(status, getClass());
@@ -418,6 +419,7 @@ public abstract class Command implements CommonAttributes
      *    or any route will do
      */
     @Override
+    @Nullable
     public abstract Route<?> route();
 
     /**
@@ -629,7 +631,7 @@ public abstract class Command implements CommonAttributes
 
     public static final class NotDefined extends AbstractCommand
     {
-        NotDefined(TxnId txnId, SaveStatus status, Durability durability, 
Route<?> route, Ballot promised, Listeners.Immutable listeners)
+        NotDefined(TxnId txnId, SaveStatus status, Durability durability, 
@Nullable Route<?> route, Ballot promised, Listeners.Immutable listeners)
         {
             super(txnId, status, durability, route, promised, listeners);
         }
@@ -706,7 +708,7 @@ public abstract class Command implements CommonAttributes
             this.result = result;
         }
 
-        public Truncated(TxnId txnId, SaveStatus saveStatus, Durability 
durability, Route<?> route, @Nullable Timestamp executeAt, Listeners.Immutable 
listeners, @Nullable Writes writes, @Nullable Result result)
+        public Truncated(TxnId txnId, SaveStatus saveStatus, Durability 
durability, @Nullable Route<?> route, @Nullable Timestamp executeAt, 
Listeners.Immutable listeners, @Nullable Writes writes, @Nullable Result result)
         {
             super(txnId, saveStatus, durability, route, Ballot.MAX, listeners);
             this.executeAt = executeAt;


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

Reply via email to