jiacheliu3 commented on code in PR #733:
URL: https://github.com/apache/ratis/pull/733#discussion_r962137790
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java:
##########
@@ -97,14 +98,31 @@
class RaftServerImpl implements RaftServer.Division,
RaftServerProtocol, RaftServerAsynchronousProtocol,
- RaftClientProtocol, RaftClientAsynchronousProtocol{
+ RaftClientProtocol, RaftClientAsynchronousProtocol, ErrorRecorded {
private static final String CLASS_NAME =
JavaUtils.getClassSimpleName(RaftServerImpl.class);
static final String REQUEST_VOTE = CLASS_NAME + ".requestVote";
static final String APPEND_ENTRIES = CLASS_NAME + ".appendEntries";
static final String INSTALL_SNAPSHOT = CLASS_NAME + ".installSnapshot";
static final String LOG_SYNC = APPEND_ENTRIES + ".logComplete";
static final String START_LEADER_ELECTION = CLASS_NAME +
".startLeaderElection";
+ private Throwable throwable;
+
+ @Override
+ public void setError(Throwable t) {
+ throwable = t;
+ LOG.error("Server transitioning to EXCEPTION state due to", t);
+ // TODO(jiacheng): will the server keep serving or just die itself?
+ // What is the cleanup I should consider?
+ lifeCycle.transition(LifeCycle.State.EXCEPTION);
Review Comment:
The implication is, many methods in `RaftServerImpl` rely on the state to be
`RUNNING` so operations will just fail. I wanted to double check with you guys
if that's okay. We might wanna distinguish errors that should crash the server
vs ones that should not (we want the RaftServer to hide the error from the
outside observer and just retry/recover internally).
The good news is, if we don't want something to crash the server, just don't
call this `ErrorRecorded.setError()` here.
Specifically to this PR, I presume all uncaught exceptions should crash the
server because otherwise they should be explicitly caught and eaten. WDYT?
--
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]