change order of check since routing entry might be null when the shard is just created

This commit is contained in:
Shay Banon 2012-03-10 20:41:28 +02:00
parent 752ae6e206
commit e7a892f6f0
1 changed files with 1 additions and 1 deletions

View File

@ -153,7 +153,7 @@ public class IndicesTTLService extends AbstractLifecycleComponent<IndicesTTLServ
} }
if (hasTTLEnabled) { if (hasTTLEnabled) {
for (IndexShard indexShard : indexService) { for (IndexShard indexShard : indexService) {
if (indexShard.routingEntry().primary() && indexShard.state() == IndexShardState.STARTED && indexShard.routingEntry().started()) { if (indexShard.state() == IndexShardState.STARTED && indexShard.routingEntry().primary() && indexShard.routingEntry().started()) {
shardsToPurge.add(indexShard); shardsToPurge.add(indexShard);
} }
} }