You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2021/11/03 10:30:20 UTC
[GitHub] [ratis] szetszwo commented on a change in pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception
szetszwo commented on a change in pull request #520:
URL: https://github.com/apache/ratis/pull/520#discussion_r741800646
##########
File path: ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -1604,14 +1604,21 @@ private InstallSnapshotReplyProto notifyStateMachineToInstallSnapshot(
LOG.debug("{}: StateMachine could not install snapshot as it is not available", this);
}
}
- // wait for 10 seconds for statemachine to install snapshot
+ // wait for 1 seconds for statemachine to install snapshot
}).get(1, TimeUnit.SECONDS);
- } catch (ExecutionException t) {
+ } catch (InterruptedException | TimeoutException t) {
+ //nothing to do
+ } catch (Exception t) {
+ // there are two cases:
+ //1 `get()` may throw ExecutionException if `whenComplete` throw an exception
+ //2 when generating completeFuture, `statemachine#notifyInstallSnapshotFromLeader`
+ // may throw an uncertain exception, which is determined by the implementation of
+ // user statemachine.
inProgressInstallSnapshotRequest.compareAndSet(firstAvailableLogIndex, 0);
- LOG.warn("{}: Failed to notify StateMachine to InstallSnapshot. ExecutionException: {}",
+ LOG.warn("{}: Failed to notify StateMachine to InstallSnapshot. Exception: {}",
getMemberId(), t.getMessage());
throw new IOException("Failed to install snapshot");
Review comment:
Let's add the exception t to the IOException.
```
final String err = getMemberId() + ": Failed to notify StateMachine to InstallSnapshot.";
LOG.warn(err + " " + t);
throw new IOException(err, t);
```
--
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: issues-unsubscribe@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org