Class FollowersChecker
java.lang.Object
org.elasticsearch.cluster.coordination.FollowersChecker
public class FollowersChecker
extends java.lang.Object
The 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 class
FollowersChecker.FollowerCheckRequest
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FOLLOWER_CHECK_ACTION_NAME
static Setting<org.elasticsearch.common.unit.TimeValue>
FOLLOWER_CHECK_INTERVAL_SETTING
static Setting<java.lang.Integer>
FOLLOWER_CHECK_RETRY_COUNT_SETTING
static Setting<org.elasticsearch.common.unit.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, NodeHealthService nodeHealthService)
-
Method Summary
Modifier and Type Method Description void
clearCurrentNodes()
Clear the set of known nodes, stopping all checks.java.util.Set<DiscoveryNode>
getFaultyNodes()
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.java.lang.String
toString()
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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
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<org.elasticsearch.common.unit.TimeValue> FOLLOWER_CHECK_INTERVAL_SETTING -
FOLLOWER_CHECK_TIMEOUT_SETTING
-
FOLLOWER_CHECK_RETRY_COUNT_SETTING
-
-
Constructor Details
-
FollowersChecker
public FollowersChecker(Settings settings, TransportService transportService, java.util.function.Consumer<FollowersChecker.FollowerCheckRequest> handleRequestAndUpdateState, java.util.function.BiConsumer<DiscoveryNode,java.lang.String> onNodeFailure, NodeHealthService nodeHealthService)
-
-
Method Details
-
setCurrentNodes
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
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
- Returns:
- nodes in the current cluster state which have failed their follower checks.
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-