Module org.elasticsearch.server
Class OrderedShardsIterator
java.lang.Object
org.elasticsearch.cluster.routing.allocation.allocator.OrderedShardsIterator
- All Implemented Interfaces:
Iterator<ShardRouting>
This class iterates all shards from all nodes.
The shard order is defined by
(1) allocation recency: shards from the node that had a new shard allocation would appear in the end of iteration.
(2) shard priority: dictated by the provided
ShardRelocationOrder.-
Method Summary
Modifier and TypeMethodDescriptionstatic OrderedShardsIteratorcreateForBalancing(RoutingAllocation allocation, NodeAllocationOrdering ordering, ShardRelocationOrder shardRelocationOrder) Creates an iterator over all shards in theRoutingNodesheld byallocation(all shards assigned to a node) that will progress through the shards node by node based onNodeAllocationOrdering, each node's shards ordered based on the providedShardRelocationOrderfor balancing moves.static OrderedShardsIteratorcreateForNecessaryMoves(RoutingAllocation allocation, NodeAllocationOrdering ordering, ShardRelocationOrder shardRelocationOrder) Creates an iterator over all shards in theRoutingNodesheld byallocation(all shards assigned to a node) that will progress through the shards node by node based onNodeAllocationOrdering, each node's shards ordered based on the providedShardRelocationOrderfor necessary moves.voiddePrioritizeNode(String nodeId) booleanhasNext()next()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Method Details
-
createForNecessaryMoves
public static OrderedShardsIterator createForNecessaryMoves(RoutingAllocation allocation, NodeAllocationOrdering ordering, ShardRelocationOrder shardRelocationOrder) Creates an iterator over all shards in theRoutingNodesheld byallocation(all shards assigned to a node) that will progress through the shards node by node based onNodeAllocationOrdering, each node's shards ordered based on the providedShardRelocationOrderfor necessary moves. -
createForBalancing
public static OrderedShardsIterator createForBalancing(RoutingAllocation allocation, NodeAllocationOrdering ordering, ShardRelocationOrder shardRelocationOrder) Creates an iterator over all shards in theRoutingNodesheld byallocation(all shards assigned to a node) that will progress through the shards node by node based onNodeAllocationOrdering, each node's shards ordered based on the providedShardRelocationOrderfor balancing moves. -
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<ShardRouting>
-
next
- Specified by:
nextin interfaceIterator<ShardRouting>
-
dePrioritizeNode
-