SzyWilliam commented on code in PR #958:
URL: https://github.com/apache/ratis/pull/958#discussion_r1384413450
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/ReadRequests.java:
##########
@@ -92,9 +99,15 @@ Consumer<Long> getAppliedIndexConsumer() {
}
CompletableFuture<Long> waitToAdvance(long readIndex) {
- if (stateMachine.getLastAppliedTermIndex().getIndex() >= readIndex) {
- return CompletableFuture.completedFuture(readIndex);
+ final long lastApplied = stateMachine.getLastAppliedTermIndex().getIndex();
+ if (lastApplied >= readIndex) {
+ return CompletableFuture.completedFuture(lastApplied);
+ }
+ final CompletableFuture<Long> f = readIndexQueue.add(readIndex);
+ final long current = stateMachine.getLastAppliedTermIndex().getIndex();
+ if (current >= lastApplied) {
Review Comment:
You are right! I was thinking about `current >= readIndex`. Thanks very much
for the careful reviews ;)
--
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]