Package org.elasticsearch.gateway
Class GatewayAllocator
java.lang.Object
org.elasticsearch.gateway.GatewayAllocator
- All Implemented Interfaces:
ExistingShardsAllocator
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.routing.allocation.ExistingShardsAllocator
ExistingShardsAllocator.UnassignedAllocationHandler
-
Field Summary
Fields inherited from interface org.elasticsearch.cluster.routing.allocation.ExistingShardsAllocator
EXISTING_SHARDS_ALLOCATOR_SETTING
-
Constructor Summary
ModifierConstructorDescriptionprotected
GatewayAllocator(RerouteService rerouteService, TransportNodesListGatewayStartedShards startedAction, TransportNodesListShardStoreMetadata storeAction)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterPrimariesBeforeReplicas(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.void
allocateUnassigned(ShardRouting shardRouting, RoutingAllocation allocation, ExistingShardsAllocator.UnassignedAllocationHandler unassignedAllocationHandler)
Allocate any unassigned shards in the givenRoutingAllocation
for which thisExistingShardsAllocator
is responsible.void
applyFailedShards(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.void
applyStartedShards(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.void
beforeAllocation(RoutingAllocation allocation)
Called before starting a round of allocation, allowing the allocator to invalidate some caches if appropriate.void
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.explainUnassignedShardAllocation(ShardRouting unassignedShard, RoutingAllocation routingAllocation)
Returns an explanation for a single unassigned shard.int
protected static void
innerAllocatedUnassigned(RoutingAllocation allocation, PrimaryShardAllocator primaryShardAllocator, ReplicaShardAllocator replicaShardAllocator, ShardRouting shardRouting, ExistingShardsAllocator.UnassignedAllocationHandler unassignedAllocationHandler)
-
Field Details
-
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:ExistingShardsAllocator
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.- Specified by:
cleanCaches
in interfaceExistingShardsAllocator
-
getNumberOfInFlightFetches
public int getNumberOfInFlightFetches()- Specified by:
getNumberOfInFlightFetches
in interfaceExistingShardsAllocator
- Returns:
- the number of in-flight fetches under this allocator's control.
-
applyStartedShards
Description copied from interface:ExistingShardsAllocator
Called when the given shards have started, so that implementations can invalidate caches and clean up any in-flight activity for those shards.- Specified by:
applyStartedShards
in interfaceExistingShardsAllocator
-
applyFailedShards
Description copied from interface:ExistingShardsAllocator
Called when the given shards have failed, so that implementations can invalidate caches and clean up any in-flight activity for those shards.- Specified by:
applyFailedShards
in interfaceExistingShardsAllocator
-
beforeAllocation
Description copied from interface:ExistingShardsAllocator
Called before starting a round of allocation, allowing the allocator to invalidate some caches if appropriate.- Specified by:
beforeAllocation
in interfaceExistingShardsAllocator
-
afterPrimariesBeforeReplicas
Description copied from interface:ExistingShardsAllocator
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.- Specified by:
afterPrimariesBeforeReplicas
in interfaceExistingShardsAllocator
-
allocateUnassigned
public void allocateUnassigned(ShardRouting shardRouting, RoutingAllocation allocation, ExistingShardsAllocator.UnassignedAllocationHandler unassignedAllocationHandler)Description copied from interface:ExistingShardsAllocator
Allocate any unassigned shards in the givenRoutingAllocation
for which thisExistingShardsAllocator
is responsible.- Specified by:
allocateUnassigned
in 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:ExistingShardsAllocator
Returns an explanation for a single unassigned shard.- Specified by:
explainUnassignedShardAllocation
in interfaceExistingShardsAllocator
-