Interface ExistingShardsAllocator.UnassignedAllocationHandler
- All Known Implementing Classes:
RoutingNodes.UnassignedShards.UnassignedIterator
- Enclosing interface:
- ExistingShardsAllocator
public static interface ExistingShardsAllocator.UnassignedAllocationHandler
Used by
ExistingShardsAllocator.allocateUnassigned(org.elasticsearch.cluster.routing.ShardRouting, org.elasticsearch.cluster.routing.allocation.RoutingAllocation, org.elasticsearch.cluster.routing.allocation.ExistingShardsAllocator.UnassignedAllocationHandler)
to handle its allocation decisions. A restricted interface to
RoutingNodes.UnassignedShards.UnassignedIterator
to limit what allocators can do.-
Method Summary
Modifier and TypeMethodDescriptioninitialize
(String nodeId, String existingAllocationId, long expectedShardSize, RoutingChangesObserver routingChangesObserver) Initializes the current unassigned shard and moves it from the unassigned list.void
removeAndIgnore
(UnassignedInfo.AllocationStatus attempt, RoutingChangesObserver changes) Removes and ignores the unassigned shard (will be ignored for this run, but will be added back to unassigned once the metadata is constructed again).updateUnassigned
(UnassignedInfo unassignedInfo, RecoverySource recoverySource, RoutingChangesObserver changes) updates the unassigned info and recovery source on the current unassigned shard
-
Method Details
-
initialize
ShardRouting initialize(String nodeId, @Nullable String existingAllocationId, long expectedShardSize, RoutingChangesObserver routingChangesObserver) Initializes the current unassigned shard and moves it from the unassigned list.- Parameters:
existingAllocationId
- allocation id to use. If null, a fresh allocation id is generated.
-
removeAndIgnore
Removes and ignores the unassigned shard (will be ignored for this run, but will be added back to unassigned once the metadata is constructed again). Typically this is used when an allocation decision prevents a shard from being allocated such that subsequent consumers of this API won't try to allocate this shard again.- Parameters:
attempt
- the result of the allocation attempt
-
updateUnassigned
ShardRouting updateUnassigned(UnassignedInfo unassignedInfo, RecoverySource recoverySource, RoutingChangesObserver changes) updates the unassigned info and recovery source on the current unassigned shard- Parameters:
unassignedInfo
- the new unassigned info to userecoverySource
- the new recovery source to use- Returns:
- the shard with unassigned info updated
-