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 eb3999718ca5b..2967cf9c036db 100644 --- a/server/src/main/java/org/opensearch/index/shard/IndexShard.java +++ b/server/src/main/java/org/opensearch/index/shard/IndexShard.java @@ -5031,7 +5031,7 @@ public void deleteTranslogFilesFromRemoteTranslog() throws IOException { */ public void deleteRemoteStoreContents() throws IOException { deleteTranslogFilesFromRemoteTranslog(); - getRemoteDirectory().deleteStaleSegments(0); + getRemoteDirectory().delete(); } public void syncTranslogFilesFromRemoteTranslog() throws IOException { diff --git a/server/src/main/java/org/opensearch/index/store/RemoteSegmentStoreDirectory.java b/server/src/main/java/org/opensearch/index/store/RemoteSegmentStoreDirectory.java index d51fe0643575e..9dae38a41f927 100644 --- a/server/src/main/java/org/opensearch/index/store/RemoteSegmentStoreDirectory.java +++ b/server/src/main/java/org/opensearch/index/store/RemoteSegmentStoreDirectory.java @@ -1038,7 +1038,7 @@ private boolean deleteIfEmpty() throws IOException { return delete(); } - private boolean delete() { + public boolean delete() { try { remoteDataDirectory.delete(); remoteMetadataDirectory.delete();