Class Coordinator

java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.cluster.coordination.Coordinator
All Implemented Interfaces:
Closeable, AutoCloseable, ClusterStatePublisher, LifecycleComponent, org.elasticsearch.core.Releasable

public class Coordinator extends AbstractLifecycleComponent implements ClusterStatePublisher
  • Field Details

    • PUBLISH_INFO_TIMEOUT_SETTING

      public static final Setting<org.elasticsearch.core.TimeValue> PUBLISH_INFO_TIMEOUT_SETTING
    • PUBLISH_TIMEOUT_SETTING

      public static final Setting<org.elasticsearch.core.TimeValue> PUBLISH_TIMEOUT_SETTING
  • Constructor Details

  • Method Details

    • doStart

      protected void doStart()
      Specified by:
      doStart in class AbstractLifecycleComponent
    • stats

      public DiscoveryStats stats()
    • startInitialJoin

      public void startInitialJoin()
    • doStop

      protected void doStop()
      Specified by:
      doStop in class AbstractLifecycleComponent
    • doClose

      protected void doClose() throws IOException
      Specified by:
      doClose in class AbstractLifecycleComponent
      Throws:
      IOException
    • invariant

      public void invariant()
    • isInitialConfigurationSet

      public boolean isInitialConfigurationSet()
    • setInitialConfiguration

      public boolean setInitialConfiguration(CoordinationMetadata.VotingConfiguration votingConfiguration)
      Sets the initial configuration to the given CoordinationMetadata.VotingConfiguration. This method is safe to call more than once, as long as the argument to each call is the same.
      Parameters:
      votingConfiguration - The nodes that should form the initial configuration.
      Returns:
      whether this call successfully set the initial configuration - if false, the cluster has already been bootstrapped.
    • getLastAcceptedState

      public ClusterState getLastAcceptedState()
    • getApplierState

      @Nullable public ClusterState getApplierState()
    • publish

      public void publish(ClusterStatePublicationEvent clusterStatePublicationEvent, ActionListener<Void> publishListener, ClusterStatePublisher.AckListener ackListener)
      Description copied from interface: ClusterStatePublisher
      Publishes an updated ClusterState to all the nodes in the cluster:
      • Send the updated state to all nodes. Typically we only send a Diff which each node combines with its local state to yield the updated state very cheaply.
      • Wait for enough master-eligible nodes to indicate that they have accepted the new state (i.e. written it to durable storage).
      • Tell all the nodes that the new state is now committed and should be applied via ClusterStateApplier.applyClusterState(org.elasticsearch.cluster.ClusterChangedEvent).
      • Finally, apply the state on the master.
      Specified by:
      publish in interface ClusterStatePublisher
      publishListener - Notified when the publication completes, whether successful or not. In particular, publication may fail with a FailedToCommitClusterStateException if this node didn't receive responses to indicate that enough other master-eligible nodes accepted this state. In that case this node stops being the elected master and the master election process starts again.

      If the publication completes successfully then every future state will be a descendant of the published state. If the publication completes exceptionally then the new state may or may not be lost. More precisely, if the published state was accepted by the node that wins the master election triggered by the publication failure then the new master will publish the state which the old master failed to publish.

      If the publication completes successfully then the new state has definitely been applied on this node, and it has usually been applied on all other nodes too. However some nodes might have timed out or otherwise failed to apply the state, so it is possible that the last-applied state on some nodes is somewhat stale.

      ackListener - Notified when individual nodes acknowledge that they've applied the cluster state (or failed to do so).
    • getOnJoinValidators

      public Collection<BiConsumer<DiscoveryNode,ClusterState>> getOnJoinValidators()
    • getFoundPeers

      public Iterable<DiscoveryNode> getFoundPeers()