szetszwo commented on code in PR #1382:
URL: https://github.com/apache/ratis/pull/1382#discussion_r3053009322
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java:
##########
@@ -868,20 +895,18 @@ private CompletableFuture<RaftClientReply>
appendTransaction(
} catch (StateMachineException e) {
// the StateMachineException is thrown by the SM in the preAppend
stage.
// Return the exception in a RaftClientReply.
- RaftClientReply exceptionReply = newExceptionReply(request, e);
- cacheEntry.failWithReply(exceptionReply);
+ final RaftClientReply exceptionReply = newExceptionReply(request, e);
// leader will step down here
if (e.leaderShouldStepDown() && getInfo().isLeader()) {
leaderState.submitStepDownEvent(StepDownReason.STATE_MACHINE_EXCEPTION);
}
- return CompletableFuture.completedFuture(exceptionReply);
+ return failWithReply(exceptionReply, cacheEntry, context);
Review Comment:
If a StateMachine throws an exception, it should also clean up its
resources. Cancel transaction is to tell the StateMachine that there is an
exception outside the StateMachine.
--
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]