belliottsmith commented on code in PR #6:
URL: https://github.com/apache/cassandra-accord/pull/6#discussion_r946071071
##########
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 is a good spot, and the only test that can easily elicit this is the
burn test. It would be a difficult test to write to elicit this directly, but
perhaps we should consider how to do so (or else have a tightly coupled test
for the response given some simple state)
--
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]