Allow to delete a closed index, closes #859.
This commit is contained in:
parent
7c38f20056
commit
897587f981
|
@ -74,8 +74,7 @@ public class MetaDataDeleteIndexService extends AbstractComponent {
|
|||
@Override public ClusterState execute(ClusterState currentState) {
|
||||
final DeleteIndexListener listener = new DeleteIndexListener(request, userListener);
|
||||
try {
|
||||
RoutingTable routingTable = currentState.routingTable();
|
||||
if (!routingTable.hasIndex(request.index)) {
|
||||
if (!currentState.metaData().hasIndex(request.index)) {
|
||||
listener.onFailure(new IndexMissingException(new Index(request.index)));
|
||||
return currentState;
|
||||
}
|
||||
|
@ -100,6 +99,7 @@ public class MetaDataDeleteIndexService extends AbstractComponent {
|
|||
|
||||
// initialize the counter only for nodes the shards are allocated to
|
||||
Set<String> allocatedNodes = Sets.newHashSet();
|
||||
if (currentState.routingTable().hasIndex(request.index)) {
|
||||
for (IndexShardRoutingTable indexShardRoutingTable : currentState.routingTable().index(request.index)) {
|
||||
for (ShardRouting shardRouting : indexShardRoutingTable) {
|
||||
if (shardRouting.currentNodeId() != null) {
|
||||
|
@ -110,6 +110,7 @@ public class MetaDataDeleteIndexService extends AbstractComponent {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allocatedNodes.isEmpty()) {
|
||||
// no nodes allocated, don't wait for a response
|
||||
|
|
Loading…
Reference in New Issue