amaliujia commented on code in PR #1643:
URL: https://github.com/apache/ratis/pull/1643#discussion_r4281392121
##########
ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLogWorker.java:
##########
@@ -417,12 +422,17 @@ private void unsafeFlushOutStream() throws IOException {
}
private void asyncFlushOutStream(CompletableFuture<Void> stateMachineFlush)
throws IOException {
+ final long scheduledFlushIndex = lastWrittenIndex;
final Timekeeper.Context logSyncTimerContext =
raftLogMetrics.getSyncTimer().time();
out.asyncFlush(flushExecutor)
.thenCombine(stateMachineFlush, (async, sm) -> async)
.whenComplete((v, e) -> {
- updateFlushedIndexIncreasingly(lastWrittenIndex);
logSyncTimerContext.stop();
+ if (e == null) {
Review Comment:
To be concrete, should we check IOException?
```
CompletableFuture<Void> asyncFlush(ExecutorService executor) throws
IOException {
try {
return out.asyncFlush(executor);
} catch (IOException ioe) {
String msg = "Failed to asyncFlush " + this;
LOG.error(msg, ioe);
throw new IOException(msg, ioe);
}
}
```
--
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]