Skip to content

Commit

Permalink
Add log for failover time (#10952)
Browse files Browse the repository at this point in the history
Signed-off-by: Poojita Raj <[email protected]>
  • Loading branch information
Poojita-Raj authored Oct 26, 2023
1 parent 5ae9333 commit 0c9fc21
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/src/main/java/org/opensearch/index/shard/IndexShard.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
import org.opensearch.indices.recovery.RecoveryTarget;
import org.opensearch.indices.replication.checkpoint.ReplicationCheckpoint;
import org.opensearch.indices.replication.checkpoint.SegmentReplicationCheckpointPublisher;
import org.opensearch.indices.replication.common.ReplicationTimer;
import org.opensearch.repositories.RepositoriesService;
import org.opensearch.repositories.Repository;
import org.opensearch.search.suggest.completion.CompletionStats;
Expand Down Expand Up @@ -698,7 +699,16 @@ public void updateShardState(
if (indexSettings.isSegRepEnabled()) {
// this Shard's engine was read only, we need to update its engine before restoring local history from xlog.
assert newRouting.primary() && currentRouting.primary() == false;
ReplicationTimer timer = new ReplicationTimer();
timer.start();
logger.debug(
"Resetting engine on promotion of shard [{}] to primary, startTime {}\n",
shardId,
timer.startTime()
);
resetEngineToGlobalCheckpoint();
timer.stop();
logger.info("Completed engine failover for shard [{}] in: {} ms", shardId, timer.time());
// It is possible an engine can open with a SegmentInfos on a higher gen but the reader does not refresh to
// trigger our refresh listener.
// Force update the checkpoint post engine reset.
Expand Down

0 comments on commit 0c9fc21

Please sign in to comment.