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) static OrderedShardsIteratorcreateForNecessaryMoves(RoutingAllocation allocation, NodeAllocationOrdering ordering) 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) -
createForBalancing
public static OrderedShardsIterator createForBalancing(RoutingAllocation allocation, NodeAllocationOrdering ordering) -
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<ShardRouting>
-
next
- Specified by:
nextin interfaceIterator<ShardRouting>
-
dePrioritizeNode
-