diff --git a/server/src/main/java/org/opensearch/index/IndexSettings.java b/server/src/main/java/org/opensearch/index/IndexSettings.java index 8af0f3f33d364..00e765d73f77f 100644 --- a/server/src/main/java/org/opensearch/index/IndexSettings.java +++ b/server/src/main/java/org/opensearch/index/IndexSettings.java @@ -1312,7 +1312,7 @@ public TimeValue getRemoteTranslogUploadBufferInterval() { } public int getRemoteTranslogExtraKeep() { - return INDEX_REMOTE_TRANSLOG_KEEP_EXTRA_GEN_SETTING.get(settings); + return remoteTranslogKeepExtraGen; } /** diff --git a/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java b/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java index 0f5275c9d96b5..24f9486ffd11a 100644 --- a/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java +++ b/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java @@ -431,12 +431,12 @@ public void trimUnreferencedReaders() throws IOException { } generationsToDelete.add(generation); } - translogTransferManager.deleteStaleTranslogMetadataFilesAsync(remoteGenerationDeletionPermits::release); if (generationsToDelete.isEmpty() == false) { deleteRemoteGeneration(generationsToDelete); + translogTransferManager.deleteStaleTranslogMetadataFilesAsync(remoteGenerationDeletionPermits::release); deleteStaleRemotePrimaryTerms(); } else { - remoteGenerationDeletionPermits.release(); + remoteGenerationDeletionPermits.release(REMOTE_DELETION_PERMITS); } }