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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add(ShardRouting shardRouting)
drain()
Drains all unassigned shards and returns it.int
Returns the number of temporarily marked as ignored unassigned primariesint
Returns the number of non-ignored unassigned primariesignored()
The list of ignored unassigned shards (read only).void
ignoreShard(ShardRouting shard, UnassignedInfo.AllocationStatus allocationStatus, RoutingChangesObserver changes)
Marks a shard as temporarily ignored and adds it to the ignore unassigned list.boolean
isEmpty()
Returnstrue
iff this collection contains one or more non-ignored unassigned shards.boolean
Returnstrue
iff any unassigned shards are marked as temporarily ignored.iterator()
void
shuffle()
int
size()
Returns the size of the non-ignored unassigned shardsvoid
sort(Comparator<ShardRouting> comparator)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
iterator
in 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()Returnstrue
iff this collection contains one or more non-ignored unassigned shards. -
isIgnoredEmpty
public boolean isIgnoredEmpty()Returnstrue
iff 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.
-