bdeggleston commented on code in PR #106:
URL: https://github.com/apache/cassandra-accord/pull/106#discussion_r1700737064
##########
accord-core/src/main/java/accord/local/SafeCommandStore.java:
##########
@@ -214,58 +214,64 @@ private void updateMaxConflicts(Command prev, Command
updated)
commandStore().updateMaxConflicts(prev, updated);
}
- private void updateCommandsForKey(Command prev, Command updated)
+ private void updateCommandsForKey(Command prev, Command next)
{
- if (!CommandsForKey.needsUpdate(prev, updated))
+ if (!CommandsForKey.needsUpdate(prev, next))
return;
- TxnId txnId = updated.txnId();
- Keys keys;
- if (txnId.domain().isKey() && txnId.kind().isGloballyVisible())
+ TxnId txnId = next.txnId();
+ if (CommandsForKey.manages(txnId)) updateManagedCommandsForKey(this,
prev, next);
+ if (!CommandsForKey.managesExecution(txnId) &&
next.hasBeen(Status.Stable) && !next.hasBeen(Status.Truncated) &&
!prev.hasBeen(Status.Stable))
+ updateUnmanagedExecutionCommandsForKey(this, next);
+ }
+
+ private static void updateManagedCommandsForKey(SafeCommandStore
safeStore, Command prev, Command next)
+ {
+ TxnId txnId = next.txnId();
+ Keys keys = (Keys)next.keysOrRanges();
+ if (keys == null || next.hasBeen(Status.Truncated)) keys =
(Keys)prev.keysOrRanges();
+ if (keys == null)
+ return;
+
+ // TODO (required): additionalKeysOrRanges may not be being handled
entirely correctly here, though it may not matter.
+ // Once committed without a given key, we should be effectively
erasing the command from that CFK
+ PreLoadContext context = PreLoadContext.contextFor(txnId, keys,
COMMANDS);
+ // TODO (expected): execute immediately for any keys we already have
loaded, and save only those we haven't for later
Review Comment:
yeah that makes sense. I think I was worried about edge cases caused by
updating some CFKs for an operation and not others? Thinking about it again
though, that seems like it should be ok and anyways pretty well covered by the
burn tests.
--
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]