This is an automated email from the ASF dual-hosted git repository. szetszwo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-ratis.git
commit 0793e9b513ff7393c197b1c13e15d22205495edd Author: Tsz-Wo Nicholas Sze <[email protected]> AuthorDate: Fri Aug 30 12:58:06 2019 -0700 RATIS-661. Add call in state machine to handle group removal. Contributed by Lokesh Jain --- .../main/java/org/apache/ratis/server/impl/RaftServerProxy.java | 1 + .../src/main/java/org/apache/ratis/statemachine/StateMachine.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java index 4a0f04c..f7ff5e1 100644 --- a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java +++ b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java @@ -404,6 +404,7 @@ public class RaftServerProxy implements RaftServer { return f.thenApply(impl -> { final Collection<CommitInfoProto> commitInfos = impl.getCommitInfos(); impl.shutdown(deleteDirectory); + impl.getStateMachine().notifyGroupRemove(); return new RaftClientReply(request, commitInfos); }); } diff --git a/ratis-server/src/main/java/org/apache/ratis/statemachine/StateMachine.java b/ratis-server/src/main/java/org/apache/ratis/statemachine/StateMachine.java index 5ce8e96..dece95b 100644 --- a/ratis-server/src/main/java/org/apache/ratis/statemachine/StateMachine.java +++ b/ratis-server/src/main/java/org/apache/ratis/statemachine/StateMachine.java @@ -283,4 +283,12 @@ public interface StateMachine extends Closeable { default void notifyLeader(long lastCommittedIndex){ } + /** + * Notify about group removal in the state machine. This function is called + * during group removal after all the pending transactions have been applied + * by the state machine. + */ + default void notifyGroupRemove() { + } + }
