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.

Signed-off-by: Marc Handalian <[email protected]>
  • Loading branch information
mch2 committed Feb 17, 2023
1 parent 1cdff3b commit 3af9016
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3af9016

Please sign in to comment.