java.lang.Object
org.elasticsearch.gateway.BaseGatewayShardAllocator
org.elasticsearch.gateway.ReplicaShardAllocator
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
-
Field Summary
Fields inherited from class org.elasticsearch.gateway.BaseGatewayShardAllocator
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<NodeAllocationResult>
augmentExplanationsWithStoreInfo
(List<NodeAllocationResult> nodeDecisions, Map<String, NodeAllocationResult> withShardStores) Takes the store info for nodes that have a shard store and adds them to the node decisions, leaving the node explanations untouched for those nodes that do not have any store information.canBeAllocatedToAtLeastOneNode
(ShardRouting shard, RoutingAllocation allocation) Determines if the shard can be allocated on at least one node based on the allocation deciders.static AllocateUnassignedDecision
delayedDecision
(ShardRouting unassignedShard, RoutingAllocation allocation, org.apache.logging.log4j.Logger logger, List<NodeAllocationResult> nodeDecisions) Return a delayed decision, filling in the right amount of remaining time if decisions are debugged/explained.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, Predicate<ShardRouting> isRelevantShardPredicate) 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
-
Constructor Details
-
ReplicaShardAllocator
public ReplicaShardAllocator()
-
-
Method Details
-
processExistingRecoveries
public void processExistingRecoveries(RoutingAllocation allocation, Predicate<ShardRouting> isRelevantShardPredicate) 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
-
delayedDecision
public static AllocateUnassignedDecision delayedDecision(ShardRouting unassignedShard, RoutingAllocation allocation, org.apache.logging.log4j.Logger logger, List<NodeAllocationResult> nodeDecisions) Return a delayed decision, filling in the right amount of remaining time if decisions are debugged/explained. -
canBeAllocatedToAtLeastOneNode
public static ReplicaShardAllocator.PerNodeAllocationResult 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. -
augmentExplanationsWithStoreInfo
public static List<NodeAllocationResult> augmentExplanationsWithStoreInfo(List<NodeAllocationResult> nodeDecisions, Map<String, NodeAllocationResult> withShardStores) Takes the store info for nodes that have a shard store and adds them to the node decisions, leaving the node explanations untouched for those nodes that do not have any store information. -
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.
-