Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 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 @@ -795,6 +795,14 @@ public void updateShardState(
if (currentRouting.initializing() && currentRouting.isRelocationTarget() == false && newRouting.active()) {
// the cluster-manager started a recovering primary, activate primary mode.
replicationTracker.activatePrimaryMode(getLocalCheckpoint());
if (indexSettings.isSegRepLocalEnabled() && this.checkpointPublisher != null) {
// Force publish checkpoint so replicas catch up to segments that existed before
// the node restart. Without this, the internal refresh during engine construction
// may have already opened the latest reader, causing subsequent external refreshes
// to see no change and never trigger CheckpointRefreshListener.
updateReplicationCheckpoint();
checkpointPublisher.publish(this, getLatestReplicationCheckpoint());
}
postActivatePrimaryMode();
}
} else {
Expand Down Expand Up @@ -2291,6 +2299,10 @@ public void onCheckpointPublished(ReplicationCheckpoint checkpoint) {
*/
public void resetToWriteableEngine() throws IOException, InterruptedException, TimeoutException {
indexShardOperationPermits.blockOperations(30, TimeUnit.MINUTES, () -> { resetEngineToGlobalCheckpoint(); });
// Force update and publish checkpoint so replicas learn about segments that existed
// before the engine reset. See resetEngineToGlobalCheckpoint() in updateShardState()
// promotion path for the same pattern.
updateReplicationCheckpoint();
}

public MergedSegmentTransferTracker mergedSegmentTransferTracker() {
Expand Down
Loading