From 645d67bc4f4e29d10ef810386c89e6a7c8c61862 Mon Sep 17 00:00:00 2001 From: Wei-Chiu Chuang Date: Fri, 21 Jun 2019 18:27:03 -0700 Subject: [PATCH] HDFS-14074. DataNode runs async disk checks maybe throws NullPointerException, and DataNode failed to register to NameSpace. Contributed by guangyi lu. --- .../hdfs/server/datanode/checker/ThrottledAsyncChecker.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/datanode/checker/ThrottledAsyncChecker.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/checker/ThrottledAsyncChecker.java index 88444539337..032379a4d12 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/checker/ThrottledAsyncChecker.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/checker/ThrottledAsyncChecker.java @@ -123,8 +123,8 @@ public class ThrottledAsyncChecker implements AsyncChecker { return Optional.empty(); } - if (completedChecks.containsKey(target)) { - final LastCheckResult result = completedChecks.get(target); + final LastCheckResult result = completedChecks.get(target); + if (result != null) { final long msSinceLastCheck = timer.monotonicNow() - result.completedAt; if (msSinceLastCheck < minMsBetweenChecks) { LOG.debug("Skipped checking {}. Time since last check {}ms " +