Browse Source

HDFS-8548. Minicluster throws NPE on shutdown. Contributed by surendra singh lilhore.

(cherry picked from commit 6a76250b39f33466bdc8dabab33070c90aa1a389)
Xiaoyu Yao 10 năm trước cách đây
mục cha
commit
97e79662b6

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -181,6 +181,9 @@ Release 2.7.3 - UNRELEASED
     HDFS-9476. TestDFSUpgradeFromImage#testUpgradeFromRel1BBWImage
     HDFS-9476. TestDFSUpgradeFromImage#testUpgradeFromRel1BBWImage
     occasionally fail. (Masatake Iwasaki via aajisaka)
     occasionally fail. (Masatake Iwasaki via aajisaka)
 
 
+    HDFS-8548. Minicluster throws NPE on shutdown.
+    (surendra singh lilhore via xyao)
+
 Release 2.7.2 - 2016-01-25
 Release 2.7.2 - 2016-01-25
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 5 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlocksMap.java

@@ -200,7 +200,11 @@ class BlocksMap {
   }
   }
 
 
   int size() {
   int size() {
-    return blocks.size();
+    if (blocks != null) {
+      return blocks.size();
+    } else {
+      return 0;
+    }
   }
   }
 
 
   Iterable<BlockInfoContiguous> getBlocks() {
   Iterable<BlockInfoContiguous> getBlocks() {