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: for necessary moves data stream write shards, then regular index shards, then the rest
for rebalancing the order is inverse
-
Method Summary
Modifier and TypeMethodDescriptionstatic OrderedShardsIteratorcreateForBalancing(RoutingAllocation allocation, NodeAllocationOrdering ordering) This iterator will progress through the shards node by node, each node's shards ordered from least write active to most.static OrderedShardsIteratorcreateForNecessaryMoves(RoutingAllocation allocation, NodeAllocationOrdering ordering) This iterator will progress through the shards node by node, each node's shards ordered from most write active to least.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) This iterator will progress through the shards node by node, each node's shards ordered from most write active to least.- Parameters:
allocation-ordering-- Returns:
- An iterator over all shards in the
RoutingNodesheld byallocation(all shards assigned to a node). The iterator will progress node by node, where each node's shards are ordered from data stream write indices, to regular indices and lastly to data stream read indices.
-
createForBalancing
public static OrderedShardsIterator createForBalancing(RoutingAllocation allocation, NodeAllocationOrdering ordering) This iterator will progress through the shards node by node, each node's shards ordered from least write active to most.- Parameters:
allocation-ordering-- Returns:
- An iterator over all shards in the
RoutingNodesheld byallocation(all shards assigned to a node). The iterator will progress node by node, where each node's shards are ordered from data stream read indices, to regular indices and lastly to data stream write indices.
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<ShardRouting>
-
next
- Specified by:
nextin interfaceIterator<ShardRouting>
-
dePrioritizeNode
-