dcapwell commented on code in PR #6:
URL: https://github.com/apache/cassandra-accord/pull/6#discussion_r946038785
##########
accord-core/src/main/java/accord/messages/BeginRecovery.java:
##########
@@ -289,24 +273,44 @@ public String toString()
}
}
- private static Stream<Command> uncommittedStartedBefore(CommandStore
commandStore, TxnId startedBefore, Keys keys)
+ private static Deps uncommittedStartedBefore(CommandStore commandStore,
TxnId txnId, Keys keys)
{
- return keys.stream().flatMap(key -> {
- CommandsForKey forKey = commandStore.maybeCommandsForKey(key);
- if (forKey == null)
- return Stream.of();
- return forKey.uncommitted.headMap(startedBefore,
false).values().stream();
- });
+ try (Deps.OrderedBuilder builder = Deps.orderedBuilder(true);)
+ {
+ keys.forEach(key -> {
+ CommandsForKey forKey = commandStore.maybeCommandsForKey(key);
+ if (forKey == null)
+ return;
+
+ // committed txns with an earlier txnid and have our txnid as
a dependency
+ builder.nextKey(key);
+ forKey.uncommitted.headMap(txnId, false).forEach((ts, command)
-> {
+ if (command.is(Accepted) &&
command.savedDeps().contains(txnId) && command.executeAt().compareTo(txnId) > 0)
Review Comment:
this was `!c.savedDeps().contains(txnId)` before, now its searching
explicitly for commands that depend on the TxnId? Trying to understand this
difference... is there a test I can look at that hits this subtle difference?
--
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]