Fix NPE in LazyPersistFileScrubber. Contributed by Inigo Goiri.

(cherry picked from commit 303c8dc9b6)
This commit is contained in:
Inigo Goiri 2017-05-26 13:15:44 -07:00 committed by Konstantin V Shvachko
parent b89d59e21e
commit a20789f299
1 changed files with 7 additions and 3 deletions

View File

@ -3895,9 +3895,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);
}
}
}