From 20fbf0bf6f6317591f1aea23b0ae82e94fe13918 Mon Sep 17 00:00:00 2001 From: Sachin Kale Date: Tue, 20 Aug 2024 23:30:26 +0530 Subject: [PATCH] Fix filtering based on age Signed-off-by: Sachin Kale --- .../java/org/opensearch/index/translog/RemoteFsTranslog.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 bc28b5074d556..e6ca6c94807f9 100644 --- a/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java +++ b/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java @@ -17,7 +17,6 @@ import org.opensearch.common.lease.Releasable; import org.opensearch.common.lease.Releasables; import org.opensearch.common.logging.Loggers; -import org.opensearch.common.unit.TimeValue; import org.opensearch.common.util.concurrent.ReleasableLock; import org.opensearch.common.util.io.IOUtils; import org.opensearch.core.action.ActionListener; @@ -674,13 +673,13 @@ public void onResponse(List blobMetadata) { // 4. we need to keep files since last successful run of scheduler long lastSuccessfulFetchOfPinnedTimestamps = pinnedTimestampsState.v1(); - long minimumAgeInMillis = lastSuccessfulFetchOfPinnedTimestamps + RemoteStoreSettings + long maximumAllowedTimestamp = lastSuccessfulFetchOfPinnedTimestamps - RemoteStoreSettings .getPinnedTimestampsLookbackInterval() .getMillis(); List metadataFilesToBeDeleted = RemoteStoreUtils.filterOutMetadataFilesBasedOnAge( metadataFiles, file -> RemoteStoreUtils.invertLong(file.split(METADATA_SEPARATOR)[3]), - TimeValue.timeValueMillis(minimumAgeInMillis) + maximumAllowedTimestamp ); // 5. Filter out metadata files matching pinned timestamps