Skip to content

Commit 37b33cf

Browse files
committed
protect a bit more from bogus (not relevant) exceptions when closing a node
1 parent 377914b commit 37b33cf

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,11 @@ private void applyMappings(ClusterChangedEvent event) {
334334
}
335335
List<String> typesToRefresh = null;
336336
String index = indexMetaData.index();
337-
IndexService indexService = indicesService.indexServiceSafe(index);
337+
IndexService indexService = indicesService.indexService(index);
338+
if (indexService == null) {
339+
// got deleted on us, ignore (closing the node)
340+
return;
341+
}
338342
MapperService mapperService = indexService.mapperService();
339343
// first, go over and update the _default_ mapping (if exists)
340344
if (indexMetaData.mappings().containsKey(MapperService.DEFAULT_MAPPING)) {
@@ -523,7 +527,11 @@ private void applyNewOrUpdatedShards(final ClusterChangedEvent event) throws Ela
523527
}
524528

525529
private void applyInitializingShard(final RoutingTable routingTable, final DiscoveryNodes nodes, final IndexShardRoutingTable indexShardRouting, final ShardRouting shardRouting) throws ElasticSearchException {
526-
final IndexService indexService = indicesService.indexServiceSafe(shardRouting.index());
530+
final IndexService indexService = indicesService.indexService(shardRouting.index());
531+
if (indexService == null) {
532+
// got deleted on us, ignore
533+
return;
534+
}
527535
final int shardId = shardRouting.id();
528536

529537
if (indexService.hasShard(shardId)) {

0 commit comments

Comments
 (0)