Class ElectionStrategy
java.lang.Object
org.elasticsearch.cluster.coordination.ElectionStrategy
public abstract class ElectionStrategy
extends java.lang.Object
Allows plugging in a custom election strategy, restricting the notion of an election quorum.
Custom additional quorum restrictions can be defined by implementing the
satisfiesAdditionalQuorumConstraints(org.elasticsearch.cluster.node.DiscoveryNode, long, long, long, org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfiguration, org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfiguration, org.elasticsearch.cluster.coordination.CoordinationState.VoteCollection)
method.-
Field Summary
Fields Modifier and Type Field Description static ElectionStrategy
DEFAULT_INSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description protected
ElectionStrategy()
-
Method Summary
Modifier and Type Method Description boolean
isElectionQuorum(DiscoveryNode localNode, long localCurrentTerm, long localAcceptedTerm, long localAcceptedVersion, CoordinationMetadata.VotingConfiguration lastCommittedConfiguration, CoordinationMetadata.VotingConfiguration lastAcceptedConfiguration, CoordinationState.VoteCollection joinVotes)
Whether there is an election quorum from the point of view of the given local node under the provided voting configurationsprotected abstract boolean
satisfiesAdditionalQuorumConstraints(DiscoveryNode localNode, long localCurrentTerm, long localAcceptedTerm, long localAcceptedVersion, CoordinationMetadata.VotingConfiguration lastCommittedConfiguration, CoordinationMetadata.VotingConfiguration lastAcceptedConfiguration, CoordinationState.VoteCollection joinVotes)
The extension point to be overridden by plugins.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
DEFAULT_INSTANCE
-
-
Constructor Details
-
ElectionStrategy
protected ElectionStrategy()
-
-
Method Details
-
isElectionQuorum
public final boolean isElectionQuorum(DiscoveryNode localNode, long localCurrentTerm, long localAcceptedTerm, long localAcceptedVersion, CoordinationMetadata.VotingConfiguration lastCommittedConfiguration, CoordinationMetadata.VotingConfiguration lastAcceptedConfiguration, CoordinationState.VoteCollection joinVotes)Whether there is an election quorum from the point of view of the given local node under the provided voting configurations -
satisfiesAdditionalQuorumConstraints
protected abstract boolean satisfiesAdditionalQuorumConstraints(DiscoveryNode localNode, long localCurrentTerm, long localAcceptedTerm, long localAcceptedVersion, CoordinationMetadata.VotingConfiguration lastCommittedConfiguration, CoordinationMetadata.VotingConfiguration lastAcceptedConfiguration, CoordinationState.VoteCollection joinVotes)The extension point to be overridden by plugins. Defines additional constraints on the election quorum.- Parameters:
localNode
- the local node for the election quorumlocalCurrentTerm
- the current term of the local nodelocalAcceptedTerm
- the last accepted term of the local nodelocalAcceptedVersion
- the last accepted version of the local nodelastCommittedConfiguration
- the last committed configuration for the election quorumlastAcceptedConfiguration
- the last accepted configuration for the election quorumjoinVotes
- the votes that were provided so far- Returns:
- true iff the additional quorum constraints are satisfied
-