Class TwoNodeClusterRaftPolicy
java.lang.Object
org.opendaylight.controller.cluster.datastore.policy.TwoNodeClusterRaftPolicy
- All Implemented Interfaces:
RaftPolicy
The TwoNodeClusterRaftPolicy is intended to be used in a two node deployment where when one instance
of the controller goes down the other instance is to take over and move the state forward.
When a TwoNodeClusterRaftPolicy is used Raft elections are disabled. This is primarily because we would
need to specify the leader externally. Also since we want one node to continue to function while the other
node is down we would need to apply a modification to the state before consensus occurs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAccording to Raft consensus on a Raft entry is achieved only after a Leader replicates a log entry to a majority of it's followers.booleanAccording to Raft a Follower which does not receive a heartbeat (aka AppendEntries) in a given period should become a Candidate and trigger an election.
-
Constructor Details
-
TwoNodeClusterRaftPolicy
public TwoNodeClusterRaftPolicy()
-
-
Method Details
-
automaticElectionsEnabled
public boolean automaticElectionsEnabled()Description copied from interface:RaftPolicyAccording to Raft a Follower which does not receive a heartbeat (aka AppendEntries) in a given period should become a Candidate and trigger an election.- Specified by:
automaticElectionsEnabledin interfaceRaftPolicy- Returns:
- true to enable automatic Raft elections, false to disable them
-
applyModificationToStateBeforeConsensus
public boolean applyModificationToStateBeforeConsensus()Description copied from interface:RaftPolicyAccording to Raft consensus on a Raft entry is achieved only after a Leader replicates a log entry to a majority of it's followers.- Specified by:
applyModificationToStateBeforeConsensusin interfaceRaftPolicy- Returns:
- true if modification should be applied before consensus, false to apply modification to state as per Raft
-