Class ElectionSchedulerFactory
java.lang.Object
org.elasticsearch.cluster.coordination.ElectionSchedulerFactory
It's provably impossible to guarantee that any leader election algorithm ever elects a leader, but they generally work (with probability
that approaches 1 over time) as long as elections occur sufficiently infrequently, compared to the time it takes to send a message to
another node and receive a response back. We do not know the round-trip latency here, but we can approximate it by attempting elections
randomly at reasonably high frequency and backing off (linearly) until one of them succeeds. We also place an upper bound on the backoff
so that if elections are failing due to a network partition that lasts for a long time then when the partition heals there is an election
attempt reasonably quickly.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionElectionSchedulerFactory(Settings settings, Random random, ThreadPool threadPool)
-
Method Summary
Modifier and TypeMethodDescriptionorg.elasticsearch.core.Releasable
startElectionScheduler(org.elasticsearch.core.TimeValue gracePeriod, Runnable scheduledRunnable)
Start the process to schedule repeated election attempts.toString()
-
Field Details
-
ELECTION_INITIAL_TIMEOUT_SETTING
-
ELECTION_BACK_OFF_TIME_SETTING
-
ELECTION_MAX_TIMEOUT_SETTING
-
ELECTION_DURATION_SETTING
-
-
Constructor Details
-
ElectionSchedulerFactory
-
-
Method Details
-
startElectionScheduler
public org.elasticsearch.core.Releasable startElectionScheduler(org.elasticsearch.core.TimeValue gracePeriod, Runnable scheduledRunnable)Start the process to schedule repeated election attempts.- Parameters:
gracePeriod
- An initial period to wait before attempting the first election.scheduledRunnable
- The action to run each time an election should be attempted.
-
toString
-