diff --git a/server/src/main/java/org/opensearch/index/shard/IndexShard.java b/server/src/main/java/org/opensearch/index/shard/IndexShard.java index 8b600cf14c40d..12bc507d9eda7 100644 --- a/server/src/main/java/org/opensearch/index/shard/IndexShard.java +++ b/server/src/main/java/org/opensearch/index/shard/IndexShard.java @@ -4659,15 +4659,6 @@ public void syncSegmentsFromRemoteSegmentStore(boolean overrideLocal, boolean re ); long processedLocalCheckpoint = Long.parseLong(infosSnapshot.getUserData().get(LOCAL_CHECKPOINT_KEY)); store.commitSegmentInfos(infosSnapshot, processedLocalCheckpoint, processedLocalCheckpoint); - Collection currentInfoFiles = infosSnapshot.files(true); - // For recovering shards, clean up un-usable incremental refresh files and commit points. - if (state() != IndexShardState.STARTED) { - for (String localFile : storeDirectory.listAll()) { - if (Store.isAutogenerated(localFile) == false && currentInfoFiles.contains(localFile) == false) { - storeDirectory.deleteFile(localFile); - } - } - } } } } catch (IOException e) {