From 85f3940ef95f1a7db9e486fbc260aa07014c0bb7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 20 Mar 2023 19:26:53 +0000 Subject: [PATCH] [Segment Replication] Handle update target cp for relocating primary (#6757) Signed-off-by: Suraj Singh (cherry picked from commit 7628de883c1009f8d6fe52263ec628ba29bc8a4b) Signed-off-by: github-actions[bot] --- .../main/java/org/opensearch/index/shard/IndexShard.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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); + } } /**