From 22b5e7ded813794f99e69cf237780181f80fd428 Mon Sep 17 00:00:00 2001 From: kimchy Date: Wed, 13 Apr 2011 16:15:26 +0300 Subject: [PATCH] Local Gateway: Listed active shards on each node does apply index deletion, closes #853. --- .../java/org/elasticsearch/gateway/local/LocalGateway.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGateway.java b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGateway.java index bc5fa771dc5..e0939b96d52 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGateway.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGateway.java @@ -46,6 +46,7 @@ import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.gateway.Gateway; import org.elasticsearch.gateway.GatewayException; import org.elasticsearch.index.gateway.local.LocalIndexGatewayModule; +import org.elasticsearch.index.shard.ShardId; import java.io.*; import java.util.Set; @@ -249,6 +250,12 @@ public class LocalGateway extends AbstractLifecycleComponent implements } } } + // remove deleted indices from the started shards + for (ShardId shardId : builder.build().shards().keySet()) { + if (!event.state().metaData().hasIndex(shardId.index().name())) { + builder.remove(shardId); + } + } // now, add all the ones that are active and on this node RoutingNode routingNode = event.state().readOnlyRoutingNodes().node(event.state().nodes().localNodeId()); if (routingNode != null) {