Skip to content

Commit

Permalink
Fix filtering based on age
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Kale <[email protected]>
  • Loading branch information
Sachin Kale committed Aug 20, 2024
1 parent 01f3b2d commit 20fbf0b
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -674,13 +673,13 @@ public void onResponse(List<BlobMetadata> 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<String> metadataFilesToBeDeleted = RemoteStoreUtils.filterOutMetadataFilesBasedOnAge(
metadataFiles,
file -> RemoteStoreUtils.invertLong(file.split(METADATA_SEPARATOR)[3]),
TimeValue.timeValueMillis(minimumAgeInMillis)
maximumAllowedTimestamp
);

// 5. Filter out metadata files matching pinned timestamps
Expand Down

0 comments on commit 20fbf0b

Please sign in to comment.