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 ea7e71a6dd938..4dcf7f5ab965a 100644 --- a/server/src/main/java/org/opensearch/index/shard/IndexShard.java +++ b/server/src/main/java/org/opensearch/index/shard/IndexShard.java @@ -2721,9 +2721,11 @@ public void updateGlobalCheckpointForShard(final String allocationId, final long * @param visibleCheckpoint the visible checkpoint */ public void updateVisibleCheckpointForShard(final String allocationId, final ReplicationCheckpoint visibleCheckpoint) { - assert assertPrimaryMode(); - verifyNotClosed(); - replicationTracker.updateVisibleCheckpointForShard(allocationId, visibleCheckpoint); + // Update target replication checkpoint only when in active primary mode + if (shardRouting.primary() && replicationTracker.isPrimaryMode()) { + verifyNotClosed(); + replicationTracker.updateVisibleCheckpointForShard(allocationId, visibleCheckpoint); + } } /**