From b6551f7dafac82663da67f94ac9f265db55c7f36 Mon Sep 17 00:00:00 2001 From: Akira Ajisaka Date: Thu, 21 Sep 2017 19:27:48 +0900 Subject: [PATCH] HDFS-12526. FSDirectory should use Time.monotonicNow for durations. Contributed by Bharat Viswanadham. (cherry picked from commit 50849ec9eb9bad90586a95d2b2380ee6e8724d6b) --- .../org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java index 6604b5a407c..3c551129473 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java @@ -752,7 +752,7 @@ public class FSDirectory implements Closeable { try { int threads = (initThreads < 1) ? 1 : initThreads; LOG.info("Initializing quota with " + threads + " thread(s)"); - long start = Time.now(); + long start = Time.monotonicNow(); QuotaCounts counts = new QuotaCounts.Builder().build(); ForkJoinPool p = new ForkJoinPool(threads); RecursiveAction task = new InitQuotaTask(getBlockStoragePolicySuite(), @@ -760,7 +760,7 @@ public class FSDirectory implements Closeable { p.execute(task); task.join(); p.shutdown(); - LOG.info("Quota initialization completed in " + (Time.now() - start) + + LOG.info("Quota initialization completed in " + (Time.monotonicNow() - start) + " milliseconds\n" + counts); } finally { writeUnlock();