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 4e345b05ab267..db8720acf95a5 100644 --- a/server/src/main/java/org/opensearch/index/shard/IndexShard.java +++ b/server/src/main/java/org/opensearch/index/shard/IndexShard.java @@ -4311,9 +4311,13 @@ public void close() throws IOException { // TODO: add a dedicate recovery stats for the reset translog } ); + + // 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; newEngineReference.get() .translogManager() - .recoverFromTranslog(translogRunner, newEngineReference.get().getProcessedLocalCheckpoint(), globalCheckpoint); + .recoverFromTranslog(translogRunner, newEngineReference.get().getProcessedLocalCheckpoint(), recoverUpto); newEngineReference.get().refresh("reset_engine"); synchronized (engineMutex) { verifyNotClosed();