Class PreLeader
java.lang.Object
org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior
org.opendaylight.controller.cluster.raft.behaviors.AbstractLeader
org.opendaylight.controller.cluster.raft.behaviors.PreLeader
- All Implemented Interfaces:
AutoCloseable
The behavior of a RaftActor when it is in the PreLeader state. This state performs all the duties of
Leader with the added behavior of attempting to commit all uncommitted entries from the previous leader's
term. Raft does not allow a leader to commit entries from a previous term by simply counting replicas -
only entries from the leader's current term can be committed (§5.4.2). Rather then waiting for a client
interaction to commit a new entry, the PreLeader state immediately appends a no-op entry (NoopPayload) to
the log with the leader's current term. Once the no-op entry is committed, all prior entries are committed
indirectly. Once all entries are committed, ie commitIndex matches the last log index, it switches to the
normal Leader state.
The use of a no-op entry in this manner is outlined in the last paragraph in §8 of the extended raft version.
- Author:
- Thomas Pantelis
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opendaylight.controller.cluster.raft.behaviors.AbstractLeader
AbstractLeader.SendHeartBeat
-
Method Summary
Modifier and TypeMethodDescriptionhandleMessage
(org.apache.pekko.actor.ActorRef sender, Object message) Handle a message.Methods inherited from class org.opendaylight.controller.cluster.raft.behaviors.AbstractLeader
addFollower, checkConsensusReached, close, followerLogSize, getFollower, getFollowerIds, getLeaderId, getLeaderPayloadVersion, getMinIsolatedLeaderPeerCount, initiateCaptureSnapshot, isLeaderIsolated, printFollowerStates, removeFollower, sendAppendEntries, sendInstallSnapshot, updateMinReplicaCount
Methods inherited from class org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior
getReplicatedToAllIndex, raftRole, setReplicatedToAllIndex
-
Method Details
-
handleMessage
Description copied from class:RaftActorBehavior
Handle a message. If the processing of the message warrants a state change then a new behavior should be returned otherwise this method should return the current behavior.- Overrides:
handleMessage
in classAbstractLeader
- Parameters:
sender
- The sender of the messagemessage
- A message that needs to be processed- Returns:
- The new behavior or current behavior, or null if the message was not handled.
-