Fix NPE in LazyPersistFileScrubber. Contributed by Inigo Goiri. (cherry picked from commit 303c8dc9b6c853c0939ea9ba14388897cc258071)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e336d92b Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e336d92b Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e336d92b Branch: refs/heads/branch-2 Commit: e336d92b99bfdf2382c4ccd05911c251d5c1ca12 Parents: 3c0eb9c Author: Inigo Goiri <[email protected]> Authored: Fri May 26 13:15:44 2017 -0700 Committer: Konstantin V Shvachko <[email protected]> Committed: Fri May 26 13:40:16 2017 -0700 ---------------------------------------------------------------------- .../apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/e336d92b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 63d2af9..5834164 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -3838,9 +3838,13 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, while (it.hasNext()) { Block b = it.next(); BlockInfo blockInfo = blockManager.getStoredBlock(b); - BlockCollection bc = getBlockCollection(blockInfo); - if (bc.getStoragePolicyID() == lpPolicy.getId()) { - filesToDelete.add(bc); + if (blockInfo == null) { + LOG.info("Cannot find block info for block " + b); + } else { + BlockCollection bc = getBlockCollection(blockInfo); + if (bc.getStoragePolicyID() == lpPolicy.getId()) { + filesToDelete.add(bc); + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
