ifesdjeen commented on code in PR #173:
URL: https://github.com/apache/cassandra-accord/pull/173#discussion_r1968216307


##########
accord-core/src/main/java/accord/local/Commands.java:
##########
@@ -554,15 +556,18 @@ public static void listenerUpdate(SafeCommandStore 
safeStore, SafeCommand safeLi
         }
     }
 
-    protected static void postApply(SafeCommandStore safeStore, Command 
command)
+    protected static boolean postApply(SafeCommandStore safeStore, TxnId 
txnId, long t0)

Review Comment:
   nit: looks like the result here is still unused, intended?
   
   
   



##########
accord-core/src/main/java/accord/primitives/Range.java:
##########
@@ -215,6 +228,15 @@ private Range(RoutingKey start, RoutingKey end)
         this.end = end;
     }
 
+    private Range(RoutingKey start, RoutingKey end, AntiRangeMarker antiRange)

Review Comment:
   intended to be unused here?



##########
accord-core/src/main/java/accord/local/Commands.java:
##########
@@ -604,14 +606,15 @@ public static AsyncChain<Void> 
applyWrites(SafeCommandStore safeStore, PreLoadCo
         CommandStore unsafeStore = safeStore.commandStore();
         Command.Executed executed = command.asExecuted();
         Participants<?> executes = executed.participants().stillExecutes();
-        if (!executes.isEmpty())
-            return command.writes().apply(safeStore, executes, 
command.partialTxn())
-                          .flatMap(unused -> unsafeStore.build(context, ss -> {
-                              postApply(ss, command);
-                              return null;
-                          }));
-        else
+        if (executes.isEmpty())
             return AsyncChains.success(null);
+
+        TxnId txnId = command.txnId();
+        return command.writes().apply(safeStore, executes, 
command.partialTxn())
+                      .flatMap(unused -> unsafeStore.build(context, ss -> {
+                          postApply(ss, txnId, 0);

Review Comment:
   Could you elaborate why we won't pass a timestamp here? I checked the impl 
where this is used, and we would seemingly apply the negative number to 
metrics. I might need to check out new integration patch if there is one.



##########
accord-core/src/main/java/accord/primitives/Deps.java:
##########
@@ -326,13 +304,76 @@ public int size()
         };
     }
 
+    public int indexOf(TxnId txnId)
+    {
+        switch (txnId.domain())
+        {
+            default: throw new UnhandledEnum(txnId.domain());
+            case Key:
+            {
+                if (managesExecution(txnId))
+                    return keyDeps.indexOf(txnId);
+                int index = directKeyDeps.indexOf(txnId);
+                return index < 0 ? -1 : keyDeps.txnIdCount() + index;
+            }
+            case Range:
+            {
+                int index = rangeDeps.indexOf(txnId);
+                return index < 0 ? -1 : keyDeps.txnIdCount() + 
directKeyDeps.txnIdCount() + index;
+            }
+        }
+    }
+
     public Participants<?> participants(TxnId txnId)
+    {
+        return applyToId(txnId, KeyOrRangeDeps::participants);
+    }
+
+    public Participants<?> participants(int index)
+    {
+        return applyToIndex(index, KeyOrRangeDeps::participants);
+    }
+
+    public boolean isStable(int index)
+    {
+        return !applyToIndex(index, 
KeyOrRangeDeps::txnIdWithFlags).is(UNSTABLE);
+    }
+
+    private <T> T applyToIndex(int index, IndexedFunction<KeyOrRangeDeps, T> 
apply)
+    {
+        {

Review Comment:
   nit: are these blocks intentional / for visual separation? Just wondering



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to