Creates an iterator over shards interleaving between nodes: The iterator returns the first shard from
the first node, then the first shard of the second node, etc.
Returns one active replica shard for the given shard id or null if
no active replica is found.
Since replicas could possibly be on nodes with a older version of ES than
the primary is, this will return replicas on the highest version of ES.
Applies the relevant logic to start an initializing shard.
Moves the initializing shard to started. If the shard is a relocation target, also removes the relocation source.
If the started shard is a primary relocation target, this also reinitializes currently initializing replicas as their
recovery source changes
Applies the relevant logic to handle a cancelled or failed shard.
Moves the shard to unassigned or completely removes the shard (if relocation target).
- If shard is a primary, this also fails initializing replicas.
- If shard is an active primary, this also promotes an active replica to primary (if such a replica exists).
- If shard is a relocating primary, this also removes the primary relocation target shard.
- If shard is a relocating replica, this promotes the replica relocation target to a full initializing replica, removing the
relocation source information. This is possible as peer recovery is always done from the primary.
- If shard is a (primary or replica) relocation target, this also clears the relocation information on the source shard.
public staticbooleanassertShardStats(RoutingNodes routingNodes)
Calculates RoutingNodes statistics by iterating over all ShardRoutings
in the cluster to ensure the book-keeping is correct.
For performance reasons, this should only be called from asserts
Returns:
this method always returns true or throws an assertion error. If assertion are not enabled
this method does nothing.
Creates an iterator over shards interleaving between nodes: The iterator returns the first shard from
the first node, then the first shard of the second node, etc. until one shard from each node has been returned.
The iterator then resumes on the first node by returning the second shard and continues until all shards from
all the nodes have been returned.