belliottsmith commented on code in PR #174: URL: https://github.com/apache/cassandra-accord/pull/174#discussion_r1977258412
########## accord-core/src/main/java/accord/impl/AbstractConfigurationService.java: ########## @@ -237,15 +248,22 @@ public AsyncResult<Void> acknowledgeFuture(long epoch) return getOrCreate(epoch).acknowledged; } - synchronized void truncateUntil(long epoch) + private long truncatedUntil = -1; + public synchronized void truncateUntil(long epoch) { Invariants.requireArgument(epoch <= maxEpoch(), "epoch %d > %d", epoch, maxEpoch()); long minEpoch = minEpoch(); int toTrim = Ints.checkedCast(epoch - minEpoch); - if (toTrim <= 0) - return; - epochs = new ArrayList<>(epochs.subList(toTrim, epochs.size())); + int count = epochs.size(); + + if (toTrim == 0 || + // Always leave least 1 ready epoch after truncation + toTrim >= epochs.size() - 1 || + !epochs.get(toTrim + 1).isReady()) Review Comment: maybe loop to find the last isReady epoch if the one at the end of the requested range isn't suitable? -- 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