Class NodeReplacementAllocationDecider
java.lang.Object
org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider
org.elasticsearch.cluster.routing.allocation.decider.NodeReplacementAllocationDecider
An allocation decider that ensures that all the shards allocated to the node scheduled for removal are relocated to the replacement node.
It also ensures that auto-expands replicas are expanded to only the replacement source or target (not both at the same time)
and only of the shards that were already present on the source node.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncanAllocate
(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) Returns aDecision
whether the given shard routing can be allocated on the given node.canAllocateReplicaWhenThereIsRetentionLease
(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) Returns aDecision
whether the given replica shard can be allocated to the given node when there is an existing retention lease already existing on the node (meaning it has been allocated there previously) This method does not actually check whether there is a retention lease, that is the responsibility of the caller.canForceAllocateDuringReplace
(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) Returns aDecision
whether the given shard can be forced to the given node in the event that the shard's source node is being replaced.canRemain
(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) Returns aDecision
whether the given shard routing can be remain on the given node.shouldAutoExpandToNode
(IndexMetadata indexMetadata, DiscoveryNode node, RoutingAllocation allocation) Returns aDecision
whether shards of the given index should be auto-expanded to this node at this state of theRoutingAllocation
.Methods inherited from class org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider
canAllocate, canAllocate, canForceAllocatePrimary, canRebalance, canRebalance
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
NodeReplacementAllocationDecider
public NodeReplacementAllocationDecider()
-
-
Method Details
-
canAllocate
public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) Description copied from class:AllocationDecider
Returns aDecision
whether the given shard routing can be allocated on the given node. The default isDecision.ALWAYS
.- Overrides:
canAllocate
in classAllocationDecider
-
canRemain
public Decision canRemain(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) Description copied from class:AllocationDecider
Returns aDecision
whether the given shard routing can be remain on the given node. The default isDecision.ALWAYS
.- Overrides:
canRemain
in classAllocationDecider
-
shouldAutoExpandToNode
public Decision shouldAutoExpandToNode(IndexMetadata indexMetadata, DiscoveryNode node, RoutingAllocation allocation) Description copied from class:AllocationDecider
Returns aDecision
whether shards of the given index should be auto-expanded to this node at this state of theRoutingAllocation
. The default isDecision.ALWAYS
.- Overrides:
shouldAutoExpandToNode
in classAllocationDecider
-
canForceAllocateDuringReplace
public Decision canForceAllocateDuringReplace(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) Description copied from class:AllocationDecider
Returns aDecision
whether the given shard can be forced to the given node in the event that the shard's source node is being replaced. This allows nodes using a replace-type node shutdown to override certain deciders in the interest of moving the shard away from a node that *must* be removed. It defaults to returning "YES" and must be overridden by deciders that opt-out to having their other NO decisions *not* overridden while vacating. The caller is responsible for first checking: - that a replacement is ongoing - the shard routing's current node is the source of the replacement- Overrides:
canForceAllocateDuringReplace
in classAllocationDecider
-
canAllocateReplicaWhenThereIsRetentionLease
public Decision canAllocateReplicaWhenThereIsRetentionLease(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) Description copied from class:AllocationDecider
Returns aDecision
whether the given replica shard can be allocated to the given node when there is an existing retention lease already existing on the node (meaning it has been allocated there previously) This method does not actually check whether there is a retention lease, that is the responsibility of the caller. It defaults to the same value ascanAllocate
.- Overrides:
canAllocateReplicaWhenThereIsRetentionLease
in classAllocationDecider
-