HDFS-10525. Fix NPE in CacheReplicationMonitor#rescanCachedBlockMap (Xiao Chen via cmccabe)

This commit is contained in:
Colin Patrick Mccabe 2016-06-15 22:47:01 -07:00
parent 2449db507d
commit 2ca73445f5
1 changed files with 8 additions and 0 deletions

View File

@ -502,6 +502,14 @@ public class CacheReplicationMonitor extends Thread implements Closeable {
CachedBlock cblock = it.next(); CachedBlock cblock = it.next();
BlockInfo blockInfo = blockManager. BlockInfo blockInfo = blockManager.
getStoredBlock(new Block(cblock.getBlockId())); getStoredBlock(new Block(cblock.getBlockId()));
if (blockInfo == null) {
// Cannot find this block on the NameNode, skip this block from
// capacity calculation. Later logic will handle this block.
LOG.debug("Block {}: cannot be found in block manager and hence"
+ " skipped from calculation for node {}.", cblock.getBlockId(),
dn.getDatanodeUuid());
continue;
}
if (blockInfo.getNumBytes() > remaining) { if (blockInfo.getNumBytes() > remaining) {
LOG.debug("Block {}: removing from PENDING_CACHED for node {} " LOG.debug("Block {}: removing from PENDING_CACHED for node {} "
+ "because it cannot fit in remaining cache size {}.", + "because it cannot fit in remaining cache size {}.",