Search in sources :

Example 1 with PrimaryMissingActionException

use of org.opensearch.action.PrimaryMissingActionException in project OpenSearch by opensearch-project.

the class TransportUpgradeAction method shards.

/**
 * The upgrade request works against *all* shards.
 */
@Override
protected ShardsIterator shards(ClusterState clusterState, UpgradeRequest request, String[] concreteIndices) {
    ShardsIterator iterator = clusterState.routingTable().allShards(concreteIndices);
    Set<String> indicesWithMissingPrimaries = indicesWithMissingPrimaries(clusterState, concreteIndices);
    if (indicesWithMissingPrimaries.isEmpty()) {
        return iterator;
    }
    // If some primary shards are not available the request should fail.
    throw new PrimaryMissingActionException("Cannot upgrade indices because the following indices are missing primary shards " + indicesWithMissingPrimaries);
}
Also used : PrimaryMissingActionException(org.opensearch.action.PrimaryMissingActionException) ShardsIterator(org.opensearch.cluster.routing.ShardsIterator)

Aggregations

PrimaryMissingActionException (org.opensearch.action.PrimaryMissingActionException)1 ShardsIterator (org.opensearch.cluster.routing.ShardsIterator)1