From f86de6f76a3079c2655df9b242fc968edfb17b9d Mon Sep 17 00:00:00 2001 From: He Xiaoqiao Date: Thu, 1 Aug 2019 14:53:56 -0700 Subject: [PATCH] HDFS-13529. Fix default trash policy emptier trigger time correctly. Contributed by He Xiaoqiao. Signed-off-by: Wei-Chiu Chuang --- .../main/java/org/apache/hadoop/fs/TrashPolicyDefault.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicyDefault.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicyDefault.java index 9f07d3de1e..18972ea3ec 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicyDefault.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicyDefault.java @@ -271,9 +271,9 @@ protected class Emptier implements Runnable { public void run() { if (emptierInterval == 0) return; // trash disabled - long now = Time.now(); - long end; + long now, end; while (true) { + now = Time.now(); end = ceiling(now, emptierInterval); try { // sleep for interval Thread.sleep(end - now);