HDFS-12363. Possible NPE in BlockManager$StorageInfoDefragmenter#scanAndCompactStorages. Contributed by Xiao Chen

This commit is contained in:
Mingliang Liu 2017-08-31 22:36:56 -07:00
parent 7ecc6dbed6
commit 1fbb662c70
1 changed files with 6 additions and 2 deletions

View File

@ -4487,8 +4487,12 @@ public class BlockManager implements BlockStatsMXBean {
for (int i = 0; i < datanodesAndStorages.size(); i += 2) {
namesystem.writeLock();
try {
DatanodeStorageInfo storage = datanodeManager.
getDatanode(datanodesAndStorages.get(i)).
final DatanodeDescriptor dn = datanodeManager.
getDatanode(datanodesAndStorages.get(i));
if (dn == null) {
continue;
}
final DatanodeStorageInfo storage = dn.
getStorageInfo(datanodesAndStorages.get(i + 1));
if (storage != null) {
boolean aborted =