Repository: incubator-ratis Updated Branches: refs/heads/master 05812468f -> 9533febc0
RATIS-291. Raft Server should fail themselves when a raft storage directory fails. Contributed by Shashikant Banerjee Project: http://git-wip-us.apache.org/repos/asf/incubator-ratis/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ratis/commit/9533febc Tree: http://git-wip-us.apache.org/repos/asf/incubator-ratis/tree/9533febc Diff: http://git-wip-us.apache.org/repos/asf/incubator-ratis/diff/9533febc Branch: refs/heads/master Commit: 9533febc04745bc259c3ad7abc1882cabf9f35b1 Parents: 0581246 Author: Tsz Wo Nicholas Sze <[email protected]> Authored: Thu Aug 23 15:41:48 2018 -0700 Committer: Tsz Wo Nicholas Sze <[email protected]> Committed: Thu Aug 23 15:41:48 2018 -0700 ---------------------------------------------------------------------- .../main/java/org/apache/ratis/server/impl/RaftServerImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/9533febc/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java ---------------------------------------------------------------------- diff --git a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java index 291c5fe..fd0ee4a 100644 --- a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java +++ b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java @@ -530,6 +530,12 @@ public class RaftServerImpl implements RaftServerProtocol, RaftServerAsynchronou // Return the exception in a RaftClientReply. RaftClientReply exceptionReply = new RaftClientReply(request, e, getCommitInfos()); cacheEntry.failWithReply(exceptionReply); + // leader will step down here + if (isLeader() && leaderState != null) { + leaderState.submitUpdateStateEvent(new LeaderState.StateUpdateEvent( + LeaderState.StateUpdateEventType.STEPDOWN, + leaderState.getCurrentTerm())); + } return CompletableFuture.completedFuture(exceptionReply); }
