Class RoutingNodes.UnassignedShards
java.lang.Object
org.elasticsearch.cluster.routing.RoutingNodes.UnassignedShards
- All Implemented Interfaces:
Iterable<ShardRouting>
- Enclosing class:
- RoutingNodes
public static final class RoutingNodes.UnassignedShards
extends Object
implements Iterable<ShardRouting>
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ShardRouting shardRouting)drain()Drains all unassigned shards and returns it.intReturns the number of temporarily marked as ignored unassigned primariesintReturns the number of non-ignored unassigned primariesignored()The list of ignored unassigned shards (read only).voidignoreShard(ShardRouting shard, UnassignedInfo.AllocationStatus allocationStatus, RoutingChangesObserver changes)Marks a shard as temporarily ignored and adds it to the ignore unassigned list.booleanisEmpty()Returnstrueiff this collection contains one or more non-ignored unassigned shards.booleanReturnstrueiff any unassigned shards are marked as temporarily ignored.iterator()voidshuffle()intsize()Returns the size of the non-ignored unassigned shardsvoidsort(Comparator<ShardRouting> comparator)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
UnassignedShards
-
-
Method Details
-
add
-
sort
-
size
public int size()Returns the size of the non-ignored unassigned shards -
getNumPrimaries
public int getNumPrimaries()Returns the number of non-ignored unassigned primaries -
getNumIgnoredPrimaries
public int getNumIgnoredPrimaries()Returns the number of temporarily marked as ignored unassigned primaries -
iterator
- Specified by:
iteratorin interfaceIterable<ShardRouting>
-
ignored
The list of ignored unassigned shards (read only). The ignored unassigned shards are not part of the formal unassigned list, but are kept around and used to build back the list of unassigned shards as part of the routing table. -
ignoreShard
public void ignoreShard(ShardRouting shard, UnassignedInfo.AllocationStatus allocationStatus, RoutingChangesObserver changes)Marks a shard as temporarily ignored and adds it to the ignore unassigned list. Should be used with caution, typically, the correct usage is to removeAndIgnore from the iterator. -
isEmpty
public boolean isEmpty()Returnstrueiff this collection contains one or more non-ignored unassigned shards. -
isIgnoredEmpty
public boolean isIgnoredEmpty()Returnstrueiff any unassigned shards are marked as temporarily ignored. -
shuffle
public void shuffle() -
drain
Drains all unassigned shards and returns it. This method will not drain ignored shards.
-