belliottsmith commented on code in PR #106:
URL: https://github.com/apache/cassandra-accord/pull/106#discussion_r1692257735


##########
accord-core/src/main/java/accord/local/CommandsForKey.java:
##########
@@ -1046,29 +1542,20 @@ static class InfoWithAdditions
         }
     }
 
-    private Object computeInsert(int insertPos, TxnId txnId, InternalStatus 
newStatus, Command command)
-    {
-        return computeInfoAndAdditions(insertPos, -1, txnId, newStatus, 
command);
-    }
-
-    private Object computeUpdate(int updatePos, TxnId txnId, InternalStatus 
newStatus, Command command)
-    {
-        return computeInfoAndAdditions(updatePos, updatePos, txnId, newStatus, 
command);
-    }
-
     private Object computeInfoAndAdditions(int insertPos, int updatePos, TxnId 
txnId, InternalStatus newStatus, Command command)
     {
-        Timestamp executeAt = txnId;
-        if (newStatus.hasInfo)
-        {
-            executeAt = command.executeAt();
-            if (executeAt.equals(txnId)) executeAt = txnId;
-        }
+        Invariants.checkState(newStatus.hasExecuteAtOrDeps);
+        Timestamp executeAt = command.executeAt();
+        if (executeAt.equals(txnId)) executeAt = txnId;
+        Ballot ballot = Ballot.ZERO;
+        if (newStatus.hasBallot)
+            ballot = command.acceptedOrCommitted();
+
         Timestamp depsKnownBefore = newStatus.depsKnownBefore(txnId, 
executeAt);
-        return computeInfoAndAdditions(insertPos, updatePos, txnId, newStatus, 
executeAt, depsKnownBefore, command.partialDeps().keyDeps.txnIds(key));
+        return computeInfoAndAdditions(insertPos, updatePos, txnId, newStatus, 
ballot, executeAt, depsKnownBefore, command.partialDeps().keyDeps.txnIds(key));
     }
 
-    private Object computeInfoAndAdditions(int insertPos, int updatePos, TxnId 
plainTxnId, InternalStatus newStatus, Timestamp executeAt, Timestamp 
depsKnownBefore, SortedList<TxnId> deps)
+    private Object computeInfoAndAdditions(int insertPos, int updatePos, TxnId 
plainTxnId, InternalStatus newStatus, Ballot ballot, Timestamp executeAt, 
Timestamp depsKnownBefore, SortedList<TxnId> deps)

Review Comment:
   I don't think so, at least not without making the allocations larger, and 
performance is a key concern here. I don't think in this particular case it is 
onerous, we know it is one of only two types. I can add documentation to make 
this clear.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to