[ 
https://issues.apache.org/jira/browse/RATIS-661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16916965#comment-16916965
 ] 

Tsz Wo Nicholas Sze commented on RATIS-661:
-------------------------------------------

[~ljain], thanks for working on this.
-  Why changing remove(..) to get(..) below?  It could have a race condition 
when there are multiple groupRemoveAsync(..) calls.
{code}
     }
-    final CompletableFuture<RaftServerImpl> f = impls.remove(groupId);
+    final CompletableFuture<RaftServerImpl> f = impls.get(groupId);
     if (f == null) {
{code}
- Let's call the new method notifyGroupRemove() in StateMachine.
- Let's do not change shutdown(..) since the groupRemoval parameter is always 
false except for groupRemoveAsync(..). Just make the call there as below.
{code}
@@ -403,6 +403,7 @@ public class RaftServerProxy implements RaftServer {
     }
     return f.thenApply(impl -> {
       final Collection<CommitInfoProto> commitInfos = impl.getCommitInfos();
+      impl.getStateMachine().notifyGroupRemove();
       impl.shutdown(deleteDirectory);
       return new RaftClientReply(request, commitInfos);
     });
 {code}


> Add call in state machine to handle group removal
> -------------------------------------------------
>
>                 Key: RATIS-661
>                 URL: https://issues.apache.org/jira/browse/RATIS-661
>             Project: Ratis
>          Issue Type: Bug
>            Reporter: Lokesh Jain
>            Assignee: Lokesh Jain
>            Priority: Major
>         Attachments: RATIS-661.001.patch, RATIS-661.002.patch, 
> RATIS-661.003.patch, RATIS-661.004.patch
>
>
> Currently during RaftServerProxy#groupRemoveAsync there is no way for 
> stateMachine to know that the RaftGroup will be removed. This Jira aims to 
> add a call in the stateMachine to handle group removal.
> It also changes the logic of groupRemoval api to remove the RaftServerImpl 
> from the RaftServerProxy#impls map after the shutdown is complete. This is 
> required to synchronize the removal with the corresponding api of 
> RaftServer#getGroupIds. RaftServer#getGroupIds uses the RaftServerProxy#impls 
> map to get the groupIds.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to