Class DelayedAllocationService
- java.lang.Object
-
- org.elasticsearch.common.component.AbstractLifecycleComponent
-
- org.elasticsearch.cluster.routing.DelayedAllocationService
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,ClusterStateListener
,LifecycleComponent
,Releasable
public class DelayedAllocationService extends AbstractLifecycleComponent implements ClusterStateListener
TheDelayedAllocationService
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 settingUnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING
(seeAllocationService.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 inAllocationService.removeDelayMarkers(RoutingAllocation)
, triggering yet another cluster change event.
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle
-
-
Constructor Summary
Constructors Constructor Description DelayedAllocationService(ThreadPool threadPool, ClusterService clusterService, AllocationService allocationService)
-
Method Summary
Modifier and Type Method Description protected void
assertClusterOrMasterStateThread()
void
clusterChanged(ClusterChangedEvent event)
Called when cluster state changes.protected long
currentNanoTime()
override this to control time based decisions during delayed allocationprotected void
doClose()
protected void
doStart()
protected void
doStop()
-
Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
-
-
-
-
Constructor Detail
-
DelayedAllocationService
@Inject public DelayedAllocationService(ThreadPool threadPool, ClusterService clusterService, AllocationService allocationService)
-
-
Method Detail
-
doStart
protected void doStart()
- Specified by:
doStart
in classAbstractLifecycleComponent
-
doStop
protected void doStop()
- Specified by:
doStop
in classAbstractLifecycleComponent
-
doClose
protected void doClose()
- Specified by:
doClose
in classAbstractLifecycleComponent
-
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.- Specified by:
clusterChanged
in interfaceClusterStateListener
-
assertClusterOrMasterStateThread
protected void assertClusterOrMasterStateThread()
-
-