浏览代码

HDFS-14074. DataNode runs async disk checks maybe throws NullPointerException, and DataNode failed to register to NameSpace. Contributed by guangyi lu.

Wei-Chiu Chuang 6 年之前
父节点
当前提交
645d67bc4f

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/checker/ThrottledAsyncChecker.java

@@ -123,8 +123,8 @@ public class ThrottledAsyncChecker<K, V> implements AsyncChecker<K, V> {
       return Optional.empty();
     }
 
-    if (completedChecks.containsKey(target)) {
-      final LastCheckResult<V> result = completedChecks.get(target);
+    final LastCheckResult<V> 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 " +