|
21 | 21 |
|
22 | 22 | import com.carrotsearch.hppc.cursors.ObjectCursor;
|
23 | 23 | import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
24 |
| - |
25 | 24 | import org.apache.logging.log4j.message.ParameterizedMessage;
|
26 | 25 | import org.apache.logging.log4j.util.Supplier;
|
27 | 26 | import org.apache.lucene.util.CollectionUtil;
|
28 | 27 | import org.elasticsearch.ElasticsearchException;
|
| 28 | +import org.elasticsearch.ResourceAlreadyExistsException; |
29 | 29 | import org.elasticsearch.Version;
|
30 | 30 | import org.elasticsearch.action.ActionListener;
|
31 | 31 | import org.elasticsearch.action.admin.indices.alias.Alias;
|
|
68 | 68 | import org.elasticsearch.index.mapper.MapperParsingException;
|
69 | 69 | import org.elasticsearch.index.mapper.MapperService;
|
70 | 70 | import org.elasticsearch.index.query.QueryShardContext;
|
71 |
| -import org.elasticsearch.indices.IndexAlreadyExistsException; |
72 | 71 | import org.elasticsearch.indices.IndexCreationException;
|
73 | 72 | import org.elasticsearch.indices.IndicesService;
|
74 | 73 | import org.elasticsearch.indices.InvalidIndexNameException;
|
@@ -137,10 +136,10 @@ public static void validateIndexName(String index, ClusterState state) {
|
137 | 136 | throw new InvalidIndexNameException(index, "must be lowercase");
|
138 | 137 | }
|
139 | 138 | if (state.routingTable().hasIndex(index)) {
|
140 |
| - throw new IndexAlreadyExistsException(state.routingTable().index(index).getIndex()); |
| 139 | + throw new ResourceAlreadyExistsException(state.routingTable().index(index).getIndex()); |
141 | 140 | }
|
142 | 141 | if (state.metaData().hasIndex(index)) {
|
143 |
| - throw new IndexAlreadyExistsException(state.metaData().index(index).getIndex()); |
| 142 | + throw new ResourceAlreadyExistsException(state.metaData().index(index).getIndex()); |
144 | 143 | }
|
145 | 144 | if (state.metaData().hasAlias(index)) {
|
146 | 145 | throw new InvalidIndexNameException(index, "already exists as alias");
|
@@ -453,7 +452,7 @@ public ClusterState execute(ClusterState currentState) throws Exception {
|
453 | 452 |
|
454 | 453 | @Override
|
455 | 454 | public void onFailure(String source, Exception e) {
|
456 |
| - if (e instanceof IndexAlreadyExistsException) { |
| 455 | + if (e instanceof ResourceAlreadyExistsException) { |
457 | 456 | logger.trace((Supplier<?>) () -> new ParameterizedMessage("[{}] failed to create", request.index()), e);
|
458 | 457 | } else {
|
459 | 458 | logger.debug((Supplier<?>) () -> new ParameterizedMessage("[{}] failed to create", request.index()), e);
|
@@ -520,7 +519,7 @@ static List<String> validateShrinkIndex(ClusterState state, String sourceIndex,
|
520 | 519 | Set<String> targetIndexMappingsTypes, String targetIndexName,
|
521 | 520 | Settings targetIndexSettings) {
|
522 | 521 | if (state.metaData().hasIndex(targetIndexName)) {
|
523 |
| - throw new IndexAlreadyExistsException(state.metaData().index(targetIndexName).getIndex()); |
| 522 | + throw new ResourceAlreadyExistsException(state.metaData().index(targetIndexName).getIndex()); |
524 | 523 | }
|
525 | 524 | final IndexMetaData sourceMetaData = state.metaData().index(sourceIndex);
|
526 | 525 | if (sourceMetaData == null) {
|
|
0 commit comments