Skip to content

Commit

Permalink
Segment Replication - Recover all translog ops when flipping to write…
Browse files Browse the repository at this point in the history
…able engine. (opensearch-project#6352)

Signed-off-by: Marc Handalian <[email protected]>
  • Loading branch information
mch2 authored and dreamer-89 committed Feb 18, 2023
1 parent dd2727f commit b64f5cd
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4323,7 +4323,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().recoverFromTranslog(translogRunner, recoverUpto);
newEngineReference.get().refresh("reset_engine");
synchronized (engineMutex) {
Expand Down

0 comments on commit b64f5cd

Please sign in to comment.