Local Gateway: Listed active shards on each node does apply index deletion, closes #853.

This commit is contained in:
kimchy 2011-04-13 16:15:26 +03:00
parent 41af86dd7e
commit 22b5e7ded8
1 changed files with 7 additions and 0 deletions

View File

@ -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<Gateway> 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) {