Class ReconfigurationHelper

java.lang.Object
io.atomix.raft.impl.ReconfigurationHelper

public final class ReconfigurationHelper extends Object
  • Constructor Details

    • ReconfigurationHelper

      public ReconfigurationHelper(RaftContext raftContext)
  • Method Details

    • join

      public CompletableFuture<Void> join(Collection<MemberId> clusterMembers)
    • leave

      public CompletableFuture<Void> leave()
    • forceConfigure

      public CompletableFuture<Void> forceConfigure(Map<MemberId,RaftMember.Type> newMembersIds)
      Force configuration works as follows. Assume current members are 0,1,3,4, and we want to force remove 2 and 3.
      
         External                        Raft 0 (follower)                     Raft 1 (follower)             Raft 2/3
            |                                 |                                     |                        (Members to be removed)
            |    forceConfigure([0,1])        |                                     |                                    |
            |-------------------------------->|                                     |                                    |
            |                                 |                                     |                                    |
            |               Configuration={   |                                     |                                    |
            |                newMembers=[0,1],|                                     |                                    |
            |                oldMembers=[]    |                                     |                                    |
            |                force=TRUE       |                                     |                                    |
            |               Commit new config |   ForceConfigureRequest(newMembers) |                                    |
            |                                 |------------------------------------>|                                    |
            |                                 |               OK                    |Commit new Configuration            |
            |         OK                      |invalid input: '<'------------------------------------|                                    |
            |invalid input: '<'--------------------------------|                                     |        Poll/Vote/Append            |
            |                                 |                                     |invalid input: '<'-----------------------------------|
            |                        election |             poll/vote               |----------------------------------->|
            |                        timeout  ------------------------------------->|     Reject because Force==TRUE     |
            |                                 |               OK                    |                                    |
            |                                 |invalid input: '<'------------------------------------|                                    |
            |                    Become leader|                                     |                                    |
            |                                 |                                     |                                    |
            |             Append InitialEntry |                                     |                                    |
            |       Append ConfigurationEntry |                                     |                                    |
            |               Configuration={   |           AppendEntry               |                                    |
            |                newMembers=[0,1] |------------------------------------>|                                    |
            |                force=FALSE      |invalid input: '<'------------------------------------|                                    |
            |               }                 |                                     |                                    |
            |                                 |------------------------------------>|                                    |
            |                                 |invalid input: '<'------------------------------------|                                    |
            |                                 |                                     |                                    |
            |                Commit new config|            AppendEntry              |On commitIndex update               |
            |                                 |------------------------------------>|Commit new config                   |
            |                                 |                                     |                                    |
            |                                 |                                     |      Poll/Vote                     |
            |                                 |                                     |invalid input: '<'-----------------------------------|
            |                                 |                                     |  Reject because log not uptodate   |
            |                                 |                                     |----------------------------------->|
            |                                 |                                     |                                    |
       
    • anoint

      public CompletableFuture<Void> anoint()
      Attempts to become the leader.