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 11b62d981c..997fd920c9 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 @@ -3870,9 +3870,13 @@ private void clearCorruptLazyPersistFiles() 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); + } } }