Local Gateway: Listed active shards on each node does apply index deletion, closes #853.
This commit is contained in:
parent
41af86dd7e
commit
22b5e7ded8
|
@ -46,6 +46,7 @@ import org.elasticsearch.env.NodeEnvironment;
|
||||||
import org.elasticsearch.gateway.Gateway;
|
import org.elasticsearch.gateway.Gateway;
|
||||||
import org.elasticsearch.gateway.GatewayException;
|
import org.elasticsearch.gateway.GatewayException;
|
||||||
import org.elasticsearch.index.gateway.local.LocalIndexGatewayModule;
|
import org.elasticsearch.index.gateway.local.LocalIndexGatewayModule;
|
||||||
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Set;
|
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
|
// now, add all the ones that are active and on this node
|
||||||
RoutingNode routingNode = event.state().readOnlyRoutingNodes().node(event.state().nodes().localNodeId());
|
RoutingNode routingNode = event.state().readOnlyRoutingNodes().node(event.state().nodes().localNodeId());
|
||||||
if (routingNode != null) {
|
if (routingNode != null) {
|
||||||
|
|
Loading…
Reference in New Issue