Package org.elasticsearch.gateway
Class GatewayAllocator
java.lang.Object
org.elasticsearch.gateway.GatewayAllocator
- All Implemented Interfaces:
ExistingShardsAllocator
public class GatewayAllocator extends java.lang.Object implements ExistingShardsAllocator
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.routing.allocation.ExistingShardsAllocator
ExistingShardsAllocator.UnassignedAllocationHandler -
Field Summary
Fields Modifier and Type Field Description static java.lang.StringALLOCATOR_NAMEFields inherited from interface org.elasticsearch.cluster.routing.allocation.ExistingShardsAllocator
EXISTING_SHARDS_ALLOCATOR_SETTING -
Constructor Summary
Constructors Modifier Constructor Description protectedGatewayAllocator()GatewayAllocator(RerouteService rerouteService, TransportNodesListGatewayStartedShards startedAction, TransportNodesListShardStoreMetadata storeAction) -
Method Summary
Modifier and Type Method Description voidafterPrimariesBeforeReplicas(RoutingAllocation allocation)Called during a round of allocation after attempting to allocate all the primaries but before any replicas, allowing the allocator to prepare for replica allocation.voidallocateUnassigned(ShardRouting shardRouting, RoutingAllocation allocation, ExistingShardsAllocator.UnassignedAllocationHandler unassignedAllocationHandler)Allocate any unassigned shards in the givenRoutingAllocationfor which thisExistingShardsAllocatoris responsible.voidapplyFailedShards(java.util.List<FailedShard> failedShards, RoutingAllocation allocation)Called when the given shards have failed, so that implementations can invalidate caches and clean up any in-flight activity for those shards.voidapplyStartedShards(java.util.List<ShardRouting> startedShards, RoutingAllocation allocation)Called when the given shards have started, so that implementations can invalidate caches and clean up any in-flight activity for those shards.voidbeforeAllocation(RoutingAllocation allocation)Called before starting a round of allocation, allowing the allocator to invalidate some caches if appropriate.voidcleanCaches()Called when this node becomes the elected master and when it stops being the elected master, so that implementations can clean up any in-flight activity from an earlier mastership.AllocateUnassignedDecisionexplainUnassignedShardAllocation(ShardRouting unassignedShard, RoutingAllocation routingAllocation)Returns an explanation for a single unassigned shard.intgetNumberOfInFlightFetches()protected static voidinnerAllocatedUnassigned(RoutingAllocation allocation, PrimaryShardAllocator primaryShardAllocator, ReplicaShardAllocator replicaShardAllocator, ShardRouting shardRouting, ExistingShardsAllocator.UnassignedAllocationHandler unassignedAllocationHandler)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
ALLOCATOR_NAME
public static final java.lang.String ALLOCATOR_NAME- See Also:
- Constant Field Values
-
-
Constructor Details
-
GatewayAllocator
@Inject public GatewayAllocator(RerouteService rerouteService, TransportNodesListGatewayStartedShards startedAction, TransportNodesListShardStoreMetadata storeAction) -
GatewayAllocator
protected GatewayAllocator()
-
-
Method Details
-
cleanCaches
public void cleanCaches()Description copied from interface:ExistingShardsAllocatorCalled when this node becomes the elected master and when it stops being the elected master, so that implementations can clean up any in-flight activity from an earlier mastership.- Specified by:
cleanCachesin interfaceExistingShardsAllocator
-
getNumberOfInFlightFetches
public int getNumberOfInFlightFetches()- Specified by:
getNumberOfInFlightFetchesin interfaceExistingShardsAllocator- Returns:
- the number of in-flight fetches under this allocator's control.
-
applyStartedShards
public void applyStartedShards(java.util.List<ShardRouting> startedShards, RoutingAllocation allocation)Description copied from interface:ExistingShardsAllocatorCalled when the given shards have started, so that implementations can invalidate caches and clean up any in-flight activity for those shards.- Specified by:
applyStartedShardsin interfaceExistingShardsAllocator
-
applyFailedShards
public void applyFailedShards(java.util.List<FailedShard> failedShards, RoutingAllocation allocation)Description copied from interface:ExistingShardsAllocatorCalled when the given shards have failed, so that implementations can invalidate caches and clean up any in-flight activity for those shards.- Specified by:
applyFailedShardsin interfaceExistingShardsAllocator
-
beforeAllocation
Description copied from interface:ExistingShardsAllocatorCalled before starting a round of allocation, allowing the allocator to invalidate some caches if appropriate.- Specified by:
beforeAllocationin interfaceExistingShardsAllocator
-
afterPrimariesBeforeReplicas
Description copied from interface:ExistingShardsAllocatorCalled during a round of allocation after attempting to allocate all the primaries but before any replicas, allowing the allocator to prepare for replica allocation.- Specified by:
afterPrimariesBeforeReplicasin interfaceExistingShardsAllocator
-
allocateUnassigned
public void allocateUnassigned(ShardRouting shardRouting, RoutingAllocation allocation, ExistingShardsAllocator.UnassignedAllocationHandler unassignedAllocationHandler)Description copied from interface:ExistingShardsAllocatorAllocate any unassigned shards in the givenRoutingAllocationfor which thisExistingShardsAllocatoris responsible.- Specified by:
allocateUnassignedin interfaceExistingShardsAllocator
-
innerAllocatedUnassigned
protected static void innerAllocatedUnassigned(RoutingAllocation allocation, PrimaryShardAllocator primaryShardAllocator, ReplicaShardAllocator replicaShardAllocator, ShardRouting shardRouting, ExistingShardsAllocator.UnassignedAllocationHandler unassignedAllocationHandler) -
explainUnassignedShardAllocation
public AllocateUnassignedDecision explainUnassignedShardAllocation(ShardRouting unassignedShard, RoutingAllocation routingAllocation)Description copied from interface:ExistingShardsAllocatorReturns an explanation for a single unassigned shard.- Specified by:
explainUnassignedShardAllocationin interfaceExistingShardsAllocator
-