diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/block/ClusterBlocks.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/block/ClusterBlocks.java index f7fc68c5ca9..3a06cdf12e5 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/block/ClusterBlocks.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/block/ClusterBlocks.java @@ -194,6 +194,14 @@ public class ClusterBlocks { return this; } + public Builder removeIndexBlocks(String index) { + if (!indices.containsKey(index)) { + return this; + } + indices.remove(index); + return this; + } + public Builder removeIndexBlock(String index, ClusterBlock block) { if (!indices.containsKey(index)) { return this; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaDataDeleteIndexService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaDataDeleteIndexService.java index 23b149e1982..e5c21a0c0c5 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaDataDeleteIndexService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaDataDeleteIndexService.java @@ -23,6 +23,7 @@ import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateUpdateTask; import org.elasticsearch.cluster.action.index.NodeIndexDeletedAction; +import org.elasticsearch.cluster.block.ClusterBlocks; import org.elasticsearch.cluster.routing.IndexRoutingTable; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.strategy.ShardsRoutingStrategy; @@ -91,6 +92,8 @@ public class MetaDataDeleteIndexService extends AbstractComponent { RoutingTable newRoutingTable = shardsRoutingStrategy.reroute( newClusterStateBuilder().state(currentState).routingTable(routingTableBuilder).metaData(newMetaData).build()); + ClusterBlocks blocks = ClusterBlocks.builder().blocks(currentState.blocks()).removeIndexBlocks(request.index).build(); + final AtomicInteger counter = new AtomicInteger(currentState.nodes().size()); final NodeIndexDeletedAction.Listener nodeIndexDeleteListener = new NodeIndexDeletedAction.Listener() { @@ -114,7 +117,7 @@ public class MetaDataDeleteIndexService extends AbstractComponent { listener.timeout = timeoutTask; - return newClusterStateBuilder().state(currentState).routingTable(newRoutingTable).metaData(newMetaData).build(); + return newClusterStateBuilder().state(currentState).routingTable(newRoutingTable).metaData(newMetaData).blocks(blocks).build(); } catch (Exception e) { listener.onFailure(e); return currentState;