belliottsmith commented on code in PR #233: URL: https://github.com/apache/cassandra-accord/pull/233#discussion_r2247962062
########## accord-core/src/main/java/accord/local/CommandStore.java: ########## @@ -666,7 +663,62 @@ protected void updatedRedundantBefore(SafeCommandStore safeStore, RedundantBefor listeners.clearBefore(this, clearWaitingBefore); } - protected void markSynced(SafeCommandStore safeStore, TxnId syncId, Ranges ranges) + protected final Ranges isWaitingOnSync(TxnId syncId, Ranges ranges) + { + if (waitingOnSync.isEmpty()) + return Ranges.EMPTY; + + Ranges waitingOn = Ranges.EMPTY; + for (Map.Entry<Long, WaitingOnSync> e : waitingOnSync.entrySet()) + { + if (e.getKey() > syncId.epoch()) + break; + + Ranges remaining = e.getValue().waitingOn; + Ranges intersecting = remaining.slice(ranges, Minimal); + if (!intersecting.isEmpty()) + { + ranges = ranges.without(intersecting); + waitingOn = waitingOn.with(intersecting); + } + } + + return waitingOn; + } + + protected final void markSyncing(TxnId syncId, Ranges ranges) + { + if (waitingOnSync.isEmpty()) + return; + + for (Map.Entry<Long, WaitingOnSync> e : waitingOnSync.entrySet()) + { + if (e.getKey() > syncId.epoch()) + break; + + Ranges remaining = e.getValue().waitingOn.without(ranges); + if (e.getValue().waitingOn != remaining) + e.getValue().waitingOn = remaining; + } + } + + protected final void unmarkSyncing(TxnId syncId, Ranges ranges) + { + if (waitingOnSync.isEmpty()) + return; + + for (Map.Entry<Long, WaitingOnSync> e : waitingOnSync.entrySet()) + { + if (e.getKey() > syncId.epoch()) + break; + + Ranges unmark = e.getValue().waitingOnDurable.slice(ranges, Minimal); + if (!unmark.isEmpty()) Review Comment: I don't follow. Do you mean remove the key from the collection? -- 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