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 db8720acf95a5..71ec8a4decd38 100644 --- a/server/src/main/java/org/opensearch/index/shard/IndexShard.java +++ b/server/src/main/java/org/opensearch/index/shard/IndexShard.java @@ -4314,7 +4314,9 @@ public void close() throws IOException { // When the new engine is created, translogs are synced from remote store onto local. Since remote store is the source // of truth for translog, we play all translogs that exists locally. Otherwise, the recoverUpto happens upto global checkpoint. - long recoverUpto = this.isRemoteTranslogEnabled() ? Long.MAX_VALUE : globalCheckpoint; + // We also replay all local translog ops with Segment replication, because on engine swap our local translog may + // hold more ops than the global checkpoint. + long recoverUpto = this.isRemoteTranslogEnabled() || indexSettings().isSegRepEnabled() ? Long.MAX_VALUE : globalCheckpoint; newEngineReference.get() .translogManager() .recoverFromTranslog(translogRunner, newEngineReference.get().getProcessedLocalCheckpoint(), recoverUpto);