protect a bit more from bogus (not relevant) exceptions when closing a node

This commit is contained in:
Shay Banon 2012-08-23 01:31:11 +02:00
parent 377914bd07
commit 37b33cf77d
1 changed files with 10 additions and 2 deletions

View File

@ -334,7 +334,11 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
}
List<String> typesToRefresh = null;
String index = indexMetaData.index();
IndexService indexService = indicesService.indexServiceSafe(index);
IndexService indexService = indicesService.indexService(index);
if (indexService == null) {
// got deleted on us, ignore (closing the node)
return;
}
MapperService mapperService = indexService.mapperService();
// first, go over and update the _default_ mapping (if exists)
if (indexMetaData.mappings().containsKey(MapperService.DEFAULT_MAPPING)) {
@ -523,7 +527,11 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
}
private void applyInitializingShard(final RoutingTable routingTable, final DiscoveryNodes nodes, final IndexShardRoutingTable indexShardRouting, final ShardRouting shardRouting) throws ElasticSearchException {
final IndexService indexService = indicesService.indexServiceSafe(shardRouting.index());
final IndexService indexService = indicesService.indexService(shardRouting.index());
if (indexService == null) {
// got deleted on us, ignore
return;
}
final int shardId = shardRouting.id();
if (indexService.hasShard(shardId)) {