Skip to content

Commit

Permalink
Change System.nanoTime to System.currentTimeMillis
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 19, 2024
1 parent c287c0b commit c68d940
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -502,7 +501,7 @@ public static List<String> filterOutMetadataFilesBasedOnAge(
Function<String, Long> getTimestampFunction,
TimeValue minimumAge
) {
long maxTimestampAllowed = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) - minimumAge.getMillis();
long maxTimestampAllowed = System.currentTimeMillis() - minimumAge.getMillis();
List<String> metadataFilesWithMinAge = new ArrayList<>();
for (String metadataFileName : metadataFiles) {
long metadataTimestamp = getTimestampFunction.apply(metadataFileName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void pinTimestamp(long timestamp, String pinningEntity, ActionListener<Vo
// If a caller uses current system time to pin the timestamp, following check will almost always fail.
// So, we allow pinning timestamp in the past upto some buffer
long lookbackIntervalInMills = pinnedTimestampsLookbackInterval.millis();
if (timestamp < TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) - lookbackIntervalInMills) {
if (timestamp < (System.currentTimeMillis() - lookbackIntervalInMills)) {
throw new IllegalArgumentException(
"Timestamp to be pinned is less than current timestamp - value of cluster.remote_store.pinned_timestamps.lookback_interval"
);
Expand Down

0 comments on commit c68d940

Please sign in to comment.