Class FollowersChecker
- java.lang.Object
-
- org.elasticsearch.cluster.coordination.FollowersChecker
-
public class FollowersChecker extends java.lang.ObjectThe FollowersChecker is responsible for allowing a leader to check that its followers are still connected and healthy. On deciding that a follower has failed the leader will remove it from the cluster. We are fairly lenient, possibly allowing multiple checks to fail before considering a follower to be faulty, to allow for a brief network partition or a long GC cycle to occur without triggering the removal of a node and the consequent shard reallocation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFollowersChecker.FollowerCheckRequest
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFOLLOWER_CHECK_ACTION_NAMEstatic Setting<TimeValue>FOLLOWER_CHECK_INTERVAL_SETTINGstatic Setting<java.lang.Integer>FOLLOWER_CHECK_RETRY_COUNT_SETTINGstatic Setting<TimeValue>FOLLOWER_CHECK_TIMEOUT_SETTING
-
Constructor Summary
Constructors Constructor Description FollowersChecker(Settings settings, TransportService transportService, java.util.function.Consumer<FollowersChecker.FollowerCheckRequest> handleRequestAndUpdateState, java.util.function.BiConsumer<DiscoveryNode,java.lang.String> onNodeFailure)
-
Method Summary
Modifier and Type Method Description voidclearCurrentNodes()Clear the set of known nodes, stopping all checks.java.util.Set<DiscoveryNode>getFaultyNodes()voidsetCurrentNodes(DiscoveryNodes discoveryNodes)Update the set of known nodes, starting to check any new ones and stopping checking any previously-known-but-now-unknown ones.java.lang.StringtoString()voidupdateFastResponseState(long term, Coordinator.Mode mode)The system is normally in a state in which every follower remains a follower of a stable leader in a single term for an extended period of time, and therefore our response to every follower check is the same.
-
-
-
Field Detail
-
FOLLOWER_CHECK_ACTION_NAME
public static final java.lang.String FOLLOWER_CHECK_ACTION_NAME
- See Also:
- Constant Field Values
-
FOLLOWER_CHECK_INTERVAL_SETTING
public static final Setting<TimeValue> FOLLOWER_CHECK_INTERVAL_SETTING
-
FOLLOWER_CHECK_TIMEOUT_SETTING
public static final Setting<TimeValue> FOLLOWER_CHECK_TIMEOUT_SETTING
-
FOLLOWER_CHECK_RETRY_COUNT_SETTING
public static final Setting<java.lang.Integer> FOLLOWER_CHECK_RETRY_COUNT_SETTING
-
-
Constructor Detail
-
FollowersChecker
public FollowersChecker(Settings settings, TransportService transportService, java.util.function.Consumer<FollowersChecker.FollowerCheckRequest> handleRequestAndUpdateState, java.util.function.BiConsumer<DiscoveryNode,java.lang.String> onNodeFailure)
-
-
Method Detail
-
setCurrentNodes
public void setCurrentNodes(DiscoveryNodes discoveryNodes)
Update the set of known nodes, starting to check any new ones and stopping checking any previously-known-but-now-unknown ones.
-
clearCurrentNodes
public void clearCurrentNodes()
Clear the set of known nodes, stopping all checks.
-
updateFastResponseState
public void updateFastResponseState(long term, Coordinator.Mode mode)The system is normally in a state in which every follower remains a follower of a stable leader in a single term for an extended period of time, and therefore our response to every follower check is the same. We handle this case with a single volatile read entirely on the network thread, and only if the fast path fails do we perform some work in the background, by notifying the FollowersChecker whenever our term or mode changes here.
-
getFaultyNodes
public java.util.Set<DiscoveryNode> getFaultyNodes()
- Returns:
- nodes in the current cluster state which have failed their follower checks.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-