Class RoutingNodes.UnassignedShards
- java.lang.Object
-
- org.elasticsearch.cluster.routing.RoutingNodes.UnassignedShards
-
- All Implemented Interfaces:
java.lang.Iterable<ShardRouting>
- Enclosing class:
- RoutingNodes
public static final class RoutingNodes.UnassignedShards extends java.lang.Object implements java.lang.Iterable<ShardRouting>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classRoutingNodes.UnassignedShards.UnassignedIterator
-
Constructor Summary
Constructors Constructor Description UnassignedShards(RoutingNodes nodes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(ShardRouting shardRouting)ShardRouting[]drain()Drains all unassigned shards and returns it.intgetNumIgnoredPrimaries()Returns the number of temporarily marked as ignored unassigned primariesintgetNumPrimaries()Returns the number of non-ignored unassigned primariesjava.util.List<ShardRouting>ignored()The list of ignored unassigned shards (read only).intignoredSize()Returns the size of the temporarily marked as ignored unassigned shardsvoidignoreShard(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.booleanisIgnoredEmpty()Returnstrueiff any unassigned shards are marked as temporarily ignored.RoutingNodes.UnassignedShards.UnassignedIteratoriterator()voidshuffle()intsize()Returns the size of the non-ignored unassigned shardsvoidsort(java.util.Comparator<ShardRouting> comparator)
-
-
-
Constructor Detail
-
UnassignedShards
public UnassignedShards(RoutingNodes nodes)
-
-
Method Detail
-
add
public void add(ShardRouting shardRouting)
-
sort
public void sort(java.util.Comparator<ShardRouting> comparator)
-
size
public int size()
Returns the size of the non-ignored unassigned shards
-
ignoredSize
public int ignoredSize()
Returns the size of the temporarily marked as 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
public RoutingNodes.UnassignedShards.UnassignedIterator iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<ShardRouting>
-
ignored
public java.util.List<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
public ShardRouting[] drain()
Drains all unassigned shards and returns it. This method will not drain ignored shards.
-
-