Class DelayedAllocationService

java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.cluster.routing.DelayedAllocationService
All Implemented Interfaces:
Closeable, AutoCloseable, ClusterStateListener, LifecycleComponent, org.elasticsearch.core.Releasable

public class DelayedAllocationService extends AbstractLifecycleComponent implements ClusterStateListener
The DelayedAllocationService listens to cluster state changes and checks if there are unassigned shards with delayed allocation (unassigned shards that have the delay marker). These are shards that have become unassigned due to a node leaving and which were assigned the delay marker based on the index delay setting UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING (see AllocationService.disassociateDeadNodes(RoutingAllocation). This class is responsible for choosing the next (closest) delay expiration of a delayed shard to schedule a reroute to remove the delay marker. The actual removal of the delay marker happens in AllocationService.removeDelayMarkers(RoutingAllocation), triggering yet another cluster change event.
  • Constructor Details

  • Method Details

    • doStart

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

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

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

      protected long currentNanoTime()
      override this to control time based decisions during delayed allocation
    • clusterChanged

      public void clusterChanged(ClusterChangedEvent event)
      Description copied from interface: ClusterStateListener
      Called when cluster state changes.

      Cluster states are applied one-by-one which means they can be a performance bottleneck. Implementations of this method should therefore be fast, so please consider forking work into the background rather than doing everything inline.

      Specified by:
      clusterChanged in interface ClusterStateListener
    • assertClusterOrMasterStateThread

      protected void assertClusterOrMasterStateThread()