Package org.elasticsearch.gateway
Class ReplicaShardAllocator
java.lang.Object
org.elasticsearch.gateway.BaseGatewayShardAllocator
org.elasticsearch.gateway.ReplicaShardAllocator
-
Field Summary
Fields inherited from class org.elasticsearch.gateway.BaseGatewayShardAllocator
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.elasticsearch.core.Tuple<Decision,Map<String,NodeAllocationResult>>
canBeAllocatedToAtLeastOneNode(ShardRouting shard, RoutingAllocation allocation)
Determines if the shard can be allocated on at least one node based on the allocation deciders.protected abstract AsyncShardFetch.FetchResult<TransportNodesListShardStoreMetadata.NodeStoreFilesMetadata>
fetchData(ShardRouting shard, RoutingAllocation allocation)
protected abstract boolean
hasInitiatedFetching(ShardRouting shard)
Returns a boolean indicating whether fetching shard data has been triggered at any point for the given shard.makeAllocationDecision(ShardRouting unassignedShard, RoutingAllocation allocation, org.apache.logging.log4j.Logger logger)
Make a decision on the allocation of an unassigned shard.void
processExistingRecoveries(RoutingAllocation allocation)
Process existing recoveries of replicas and see if we need to cancel them if we find a better match.Methods inherited from class org.elasticsearch.gateway.BaseGatewayShardAllocator
allocateUnassigned, buildDecisionsForAllNodes, getExpectedShardSize
-
Constructor Details
-
ReplicaShardAllocator
public ReplicaShardAllocator()
-
-
Method Details
-
processExistingRecoveries
Process existing recoveries of replicas and see if we need to cancel them if we find a better match. Today, a better match is one that can perform a no-op recovery while the previous recovery has to copy segment files. -
makeAllocationDecision
public AllocateUnassignedDecision makeAllocationDecision(ShardRouting unassignedShard, RoutingAllocation allocation, org.apache.logging.log4j.Logger logger)Description copied from class:BaseGatewayShardAllocator
Make a decision on the allocation of an unassigned shard. This method is used byBaseGatewayShardAllocator.allocateUnassigned(ShardRouting, RoutingAllocation, ExistingShardsAllocator.UnassignedAllocationHandler)
to make decisions about whether or not the shard can be allocated by this allocator and if so, to which node it will be allocated.- Specified by:
makeAllocationDecision
in classBaseGatewayShardAllocator
- Parameters:
unassignedShard
- the unassigned shard to allocateallocation
- the current routing statelogger
- the logger- Returns:
- an
AllocateUnassignedDecision
with the final decision of whether to allocate and details of the decision
-
canBeAllocatedToAtLeastOneNode
public static org.elasticsearch.core.Tuple<Decision,Map<String,NodeAllocationResult>> canBeAllocatedToAtLeastOneNode(ShardRouting shard, RoutingAllocation allocation)Determines if the shard can be allocated on at least one node based on the allocation deciders. Returns the best allocation decision for allocating the shard on any node (i.e. YES if at least one node decided YES, THROTTLE if at least one node decided THROTTLE, and NO if none of the nodes decided YES or THROTTLE). If in explain mode, also returns the node-level explanations as the second element in the returned tuple. -
fetchData
protected abstract AsyncShardFetch.FetchResult<TransportNodesListShardStoreMetadata.NodeStoreFilesMetadata> fetchData(ShardRouting shard, RoutingAllocation allocation) -
hasInitiatedFetching
Returns a boolean indicating whether fetching shard data has been triggered at any point for the given shard.
-