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 class
RoutingNodes.UnassignedShards.UnassignedIterator
-
Constructor Summary
Constructors Constructor Description UnassignedShards(RoutingNodes nodes)
-
Method Summary
Modifier and Type Method Description void
add(ShardRouting shardRouting)
ShardRouting[]
drain()
Drains all unassigned shards and returns it.int
getNumIgnoredPrimaries()
Returns the number of temporarily marked as ignored unassigned primariesint
getNumPrimaries()
Returns the number of non-ignored unassigned primariesjava.util.List<ShardRouting>
ignored()
The list of ignored unassigned shards (read only).int
ignoredSize()
Returns the size of the temporarily marked as ignored unassigned shardsvoid
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
isIgnoredEmpty()
Returnstrue
iff any unassigned shards are marked as temporarily ignored.RoutingNodes.UnassignedShards.UnassignedIterator
iterator()
void
shuffle()
int
size()
Returns the size of the non-ignored unassigned shardsvoid
sort(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:
iterator
in 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()
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
public ShardRouting[] drain()
Drains all unassigned shards and returns it. This method will not drain ignored shards.
-
-