Search in sources :

Example 1 with PrimaryMissingActionException

use of org.elasticsearch.action.PrimaryMissingActionException in project elasticsearch by elastic.

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.elasticsearch.action.PrimaryMissingActionException) ShardsIterator(org.elasticsearch.cluster.routing.ShardsIterator)

Example 2 with PrimaryMissingActionException

use of org.elasticsearch.action.PrimaryMissingActionException in project crate by crate.

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.elasticsearch.action.PrimaryMissingActionException) ShardsIterator(org.elasticsearch.cluster.routing.ShardsIterator)

Aggregations

PrimaryMissingActionException (org.elasticsearch.action.PrimaryMissingActionException)2 ShardsIterator (org.elasticsearch.cluster.routing.ShardsIterator)2