Class JoinTaskExecutor

java.lang.Object
org.elasticsearch.cluster.coordination.JoinTaskExecutor
All Implemented Interfaces:
ClusterStateTaskExecutor<JoinTask>

public class JoinTaskExecutor extends Object implements ClusterStateTaskExecutor<JoinTask>
  • Constructor Details

  • Method Details

    • execute

      public ClusterState execute(ClusterState currentState, List<ClusterStateTaskExecutor.TaskContext<JoinTask>> joinTaskContexts) throws Exception
      Description copied from interface: ClusterStateTaskExecutor
      Update the cluster state based on the current state and the given tasks. Return the *same instance* if no update should be published.

      If this method throws an exception then the cluster state is unchanged and every task's ClusterStateTaskListener.onFailure(java.lang.Exception) method is called.

      A common implementation pattern is to iterate through the tasks, constructing a new and updated ClusterState for each one. This works ok but beware that constructing a whole new ClusterState can be somewhat expensive, and there may sometimes be surprisingly many tasks to process in the batch. If it's possible to accumulate the effects of the tasks at a lower level then you should do that instead.

      Specified by:
      execute in interface ClusterStateTaskExecutor<JoinTask>
      Parameters:
      currentState - The initial cluster state on which the tasks should be executed.
      joinTaskContexts - A ClusterStateTaskExecutor.TaskContext for each task in the batch. Implementations must complete every context in the list.
      Returns:
      The resulting cluster state after executing all the tasks. If {code currentState} is returned then no update is published.
      Throws:
      Exception
    • becomeMasterAndTrimConflictingNodes

      protected ClusterState.Builder becomeMasterAndTrimConflictingNodes(ClusterState currentState, List<ClusterStateTaskExecutor.TaskContext<JoinTask>> taskContexts, long term)
    • runOnlyOnMaster

      public boolean runOnlyOnMaster()
      Specified by:
      runOnlyOnMaster in interface ClusterStateTaskExecutor<JoinTask>
      Returns:
      true iff this executor should only run on the elected master.
    • ensureIndexCompatibility

      public static void ensureIndexCompatibility(Version nodeVersion, Metadata metadata)
      Ensures that all indices are compatible with the given node version. This will ensure that all indices in the given metadata will not be created with a newer version of elasticsearch as well as that all indices are newer or equal to the minimum index compatibility version.
      Throws:
      IllegalStateException - if any index is incompatible with the given version
      See Also:
    • ensureNodesCompatibility

      public static void ensureNodesCompatibility(Version joiningNodeVersion, DiscoveryNodes currentNodes)
      ensures that the joining node has a version that's compatible with all current nodes
    • ensureNodesCompatibility

      public static void ensureNodesCompatibility(Version joiningNodeVersion, Version minClusterNodeVersion, Version maxClusterNodeVersion)
      ensures that the joining node has a version that's compatible with a given version range
    • ensureVersionBarrier

      public static void ensureVersionBarrier(Version joiningNodeVersion, Version minClusterNodeVersion)
      ensures that the joining node's version is equal or higher to the minClusterNodeVersion. This is needed to ensure that if the master is already fully operating under the new version, it doesn't go back to mixed version mode
    • addBuiltInJoinValidators

      public static Collection<BiConsumer<DiscoveryNode,ClusterState>> addBuiltInJoinValidators(Collection<BiConsumer<DiscoveryNode,ClusterState>> onJoinValidators)