From d8165a3439bcf4baf7a03a03097182de323c4c6b Mon Sep 17 00:00:00 2001 From: Nhat Nguyen Date: Fri, 22 May 2020 09:05:05 -0400 Subject: [PATCH] Turn off translog retention only when shard started (#57063) We should only turn off the translog retention when a shard is started; otherwise, we can issue unnecessary warn logs. --- .../src/main/java/org/elasticsearch/index/shard/IndexShard.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java b/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java index 9ba027091cf..92abbf0710e 100644 --- a/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java +++ b/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java @@ -609,7 +609,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl indexEventListener.shardRoutingChanged(this, currentRouting, newRouting); } - if (indexSettings.isSoftDeleteEnabled() && useRetentionLeasesInPeerRecovery == false) { + if (indexSettings.isSoftDeleteEnabled() && useRetentionLeasesInPeerRecovery == false && state() == IndexShardState.STARTED) { final RetentionLeases retentionLeases = replicationTracker.getRetentionLeases(); final Set shardRoutings = new HashSet<>(routingTable.getShards()); shardRoutings.addAll(routingTable.assignedShards()); // include relocation targets