/** * @return all shard ids the request should run on */ protected List<ShardId> shards(Request request, ClusterState clusterState) { List<ShardId> shardIds = new ArrayList<>(); String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(clusterState, request); for (String index : concreteIndices) { IndexMetaData indexMetaData = clusterState.metaData().getIndices().get(index); if (indexMetaData != null) { for (IntObjectCursor<IndexShardRoutingTable> shardRouting : clusterState.getRoutingTable().indicesRouting().get(index).getShards()) { shardIds.add(shardRouting.value.shardId()); } } } return shardIds; }
waitForActiveShards = SETTING_WAIT_FOR_ACTIVE_SHARDS.get(indexMetaData.getSettings()); for (final IntObjectCursor<IndexShardRoutingTable> shardRouting : indexRoutingTable.getShards()) { if (waitForActiveShards.enoughShardsActive(shardRouting.value) == false) {
private Map<Integer, List<ShardRouting>> getShardRoutings(ClusterStateResponse clusterStateResponse, Map.Entry<String, ClusterIndexHealth> index) { Map<Integer, List<ShardRouting>> shardRoutings = new HashMap<>(); for (Map.Entry<Integer, ClusterShardHealth> shard : index.getValue().getShards().entrySet()) { List<ShardRouting> shardRoutingList = clusterStateResponse.getState() .getRoutingTable() .index(index.getValue().getIndex()) .getShards() .get(shard.getKey()) .getShards(); shardRoutings.put(shard.getKey(), shardRoutingList); } return shardRoutings; } }
/** * @return all shard ids the request should run on */ protected List<ShardId> shards(Request request, ClusterState clusterState) { List<ShardId> shardIds = new ArrayList<>(); String[] concreteIndices = indexNameExpressionResolver.concreteIndices(clusterState, request); for (String index : concreteIndices) { IndexMetaData indexMetaData = clusterState.metaData().getIndices().get(index); if (indexMetaData != null) { for (IntObjectCursor<IndexShardRoutingTable> shardRouting : clusterState.getRoutingTable().indicesRouting().get(index).getShards()) { shardIds.add(shardRouting.value.shardId()); } } } return shardIds; }
/** * @return all shard ids the request should run on */ protected List<ShardId> shards(Request request, ClusterState clusterState) { List<ShardId> shardIds = new ArrayList<>(); String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(clusterState, request); for (String index : concreteIndices) { IndexMetaData indexMetaData = clusterState.metaData().getIndices().get(index); if (indexMetaData != null) { for (IntObjectCursor<IndexShardRoutingTable> shardRouting : clusterState.getRoutingTable().indicesRouting().get(index).getShards()) { shardIds.add(shardRouting.value.shardId()); } } } return shardIds; }
/** * @return all shard ids the request should run on */ protected List<ShardId> shards(Request request, ClusterState clusterState) { List<ShardId> shardIds = new ArrayList<>(); String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(clusterState, request); for (String index : concreteIndices) { IndexMetaData indexMetaData = clusterState.metaData().getIndices().get(index); if (indexMetaData != null) { for (IntObjectCursor<IndexShardRoutingTable> shardRouting : clusterState.getRoutingTable().indicesRouting().get(index).getShards()) { shardIds.add(shardRouting.value.shardId()); } } } return shardIds; }
/** * @return all shard ids the request should run on */ protected List<ShardId> shards(Request request, ClusterState clusterState) { List<ShardId> shardIds = new ArrayList<>(); String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(clusterState, request); for (String index : concreteIndices) { IndexMetaData indexMetaData = clusterState.metaData().getIndices().get(index); if (indexMetaData != null) { for (IntObjectCursor<IndexShardRoutingTable> shardRouting : clusterState.getRoutingTable().indicesRouting().get(index).getShards()) { shardIds.add(shardRouting.value.shardId()); } } } return shardIds; }
waitForActiveShards = SETTING_WAIT_FOR_ACTIVE_SHARDS.get(indexMetaData.getSettings()); for (final IntObjectCursor<IndexShardRoutingTable> shardRouting : indexRoutingTable.getShards()) { if (waitForActiveShards.enoughShardsActive(shardRouting.value) == false) {
waitForActiveShards = SETTING_WAIT_FOR_ACTIVE_SHARDS.get(indexMetaData.getSettings()); for (final IntObjectCursor<IndexShardRoutingTable> shardRouting : indexRoutingTable.getShards()) { if (waitForActiveShards.enoughShardsActive(shardRouting.value) == false) {
waitForActiveShards = SETTING_WAIT_FOR_ACTIVE_SHARDS.get(indexMetaData.getSettings()); for (final IntObjectCursor<IndexShardRoutingTable> shardRouting : indexRoutingTable.getShards()) { if (waitForActiveShards.enoughShardsActive(shardRouting.value) == false) {