From 5d35393912f40945f3da14af966f7bdf4eee2132 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 (cherry picked from commit f86de6f76a3079c2655df9b242fc968edfb17b9d) (cherry picked from commit 555b56c0421be84efd09221db2b3f26c8b44ed45) --- .../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 39d5e73f0ba..55580676deb 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 @@ -262,9 +262,9 @@ public class TrashPolicyDefault extends TrashPolicy { 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);