File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
server/src/main/java/org/opensearch/indices/replication Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,20 @@ public void startReplication(ActionListener<Void> listener) {
177177 source .getCheckpointMetadata (getId (), checkpoint , checkpointInfoListener );
178178
179179 checkpointInfoListener .whenComplete (checkpointInfo -> {
180+ ReplicationCheckpoint getMetadataCheckpoint = checkpointInfo .getCheckpoint ();
181+ if (indexShard .indexSettings ().isSegRepLocalEnabled () && checkpoint .isAheadOf (getMetadataCheckpoint )) {
182+ // Fixes https://github.com/opensearch-project/OpenSearch/issues/18490
183+ listener .onFailure (
184+ new ReplicationFailedException (
185+ "Rejecting stale metadata checkpoint ["
186+ + getMetadataCheckpoint
187+ + "] since initial checkpoint ["
188+ + checkpoint
189+ + "] is ahead of it"
190+ )
191+ );
192+ return ;
193+ }
180194 final List <StoreFileMetadata > filesToFetch = getFiles (checkpointInfo );
181195 state .setStage (SegmentReplicationState .Stage .GET_FILES );
182196 cancellableThreads .checkForCancel ();
You can’t perform that action at this time.
0 commit comments