|
|
@@ -140,10 +140,24 @@ public class IndicesStore extends AbstractComponent implements ClusterStateListe
|
|
|
shardCanBeDeleted = false;
|
|
|
break;
|
|
|
}
|
|
|
- String localNodeId = clusterService.localNode().id();
|
|
|
+
|
|
|
+ // if the allocated or relocation node id doesn't exists in the cluster state, its a stale
|
|
|
+ // node, make sure we don't do anything with this until the routing table has properly been
|
|
|
+ // rerouted to reflect the fact that the node does not exists
|
|
|
+ if (!event.state().nodes().nodeExists(shardRouting.currentNodeId())) {
|
|
|
+ shardCanBeDeleted = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (shardRouting.relocatingNodeId() != null) {
|
|
|
+ if (!event.state().nodes().nodeExists(shardRouting.relocatingNodeId())) {
|
|
|
+ shardCanBeDeleted = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// check if shard is active on the current node or is getting relocated to the our node
|
|
|
+ String localNodeId = clusterService.localNode().id();
|
|
|
if (localNodeId.equals(shardRouting.currentNodeId()) || localNodeId.equals(shardRouting.relocatingNodeId())) {
|
|
|
- // shard will be used locally - keep it
|
|
|
shardCanBeDeleted = false;
|
|
|
break;
|
|
|
}
|