Interface ExistingShardsAllocator
- All Known Implementing Classes:
GatewayAllocator
public interface ExistingShardsAllocator
Searches for, and allocates, shards for which there is an existing on-disk copy somewhere in the cluster. The default implementation is
GatewayAllocator
, but plugins can supply their own implementations too.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
-
Field Summary
Modifier and TypeFieldDescriptionAllows plugins to override how we allocate shards that may already exist on disk in the cluster. -
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
-
Field Details
-
EXISTING_SHARDS_ALLOCATOR_SETTING
Allows plugins to override how we allocate shards that may already exist on disk in the cluster.
-
-
Method Details
-
beforeAllocation
Called before starting a round of allocation, allowing the allocator to invalidate some caches if appropriate. -
afterPrimariesBeforeReplicas
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. -
allocateUnassigned
void allocateUnassigned(ShardRouting shardRouting, RoutingAllocation allocation, ExistingShardsAllocator.UnassignedAllocationHandler unassignedAllocationHandler)Allocate any unassigned shards in the givenRoutingAllocation
for which thisExistingShardsAllocator
is responsible. -
explainUnassignedShardAllocation
AllocateUnassignedDecision explainUnassignedShardAllocation(ShardRouting unassignedShard, RoutingAllocation routingAllocation)Returns an explanation for a single unassigned shard. -
cleanCaches
void cleanCaches()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. -
applyStartedShards
Called when the given shards have started, so that implementations can invalidate caches and clean up any in-flight activity for those shards. -
applyFailedShards
Called when the given shards have failed, so that implementations can invalidate caches and clean up any in-flight activity for those shards. -
getNumberOfInFlightFetches
int getNumberOfInFlightFetches()- Returns:
- the number of in-flight fetches under this allocator's control.
-