diff --git a/server/src/main/java/org/opensearch/index/shard/IndexShard.java b/server/src/main/java/org/opensearch/index/shard/IndexShard.java index f1e1b67f02e10..7abbc6148eeb3 100644 --- a/server/src/main/java/org/opensearch/index/shard/IndexShard.java +++ b/server/src/main/java/org/opensearch/index/shard/IndexShard.java @@ -1439,7 +1439,6 @@ public ReplicationCheckpoint getLatestReplicationCheckpoint() { } } - /** * Checks if this shard is able to perform segment replication. * @return - True if the shard is able to perform segment replication. @@ -1456,12 +1455,24 @@ public boolean isSegmentReplicationAllowed() { logger.warn("Ignoring new replication checkpoint - primary shard cannot receive any checkpoints."); return false; } - if (state().equals(IndexShardState.STARTED) == false && (state() == IndexShardState.POST_RECOVERY && shardRouting.state() == ShardRoutingState.INITIALIZING) == false) { - logger.warn(() -> new ParameterizedMessage("Ignoring new replication checkpoint - shard is not started or recovering {} {}", state(), shardRouting.state())); + if (state().equals(IndexShardState.STARTED) == false + && (state() == IndexShardState.POST_RECOVERY && shardRouting.state() == ShardRoutingState.INITIALIZING) == false) { + logger.warn( + () -> new ParameterizedMessage( + "Ignoring new replication checkpoint - shard is not started or recovering {} {}", + state(), + shardRouting.state() + ) + ); return false; } if (getReplicationEngine().isEmpty()) { - logger.warn(() -> new ParameterizedMessage("Ignoring checkpoint, attempting to perform segrep with wrong engine type {}", getEngine().getClass())); + logger.warn( + () -> new ParameterizedMessage( + "Ignoring checkpoint, attempting to perform segrep with wrong engine type {}", + getEngine().getClass() + ) + ); return false; } return true;