Skip to content

Commit 041e7a7

Browse files
committed
HDFS-14598. Findbugs warning caused by HDFS-12487.
Contributed by He Xiaoqiao.
1 parent b76b843 commit 041e7a7

File tree

1 file changed

+9
-16
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode

1 file changed

+9
-16
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancer.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -908,24 +908,17 @@ private ExtendedBlock getBlockToCopy(FsVolumeSpi.BlockIterator iter,
908908
if(null == block){
909909
LOG.info("NextBlock call returned null.No valid block to copy. {}",
910910
item.toJson());
911-
return block;
911+
return null;
912912
}
913-
914-
if (block != null) {
915-
// A valid block is a finalized block, we iterate until we get
916-
// finalized blocks
917-
if (!this.dataset.isValidBlock(block)) {
918-
continue;
919-
}
920-
921-
// We don't look for the best, we just do first fit
922-
if (isLessThanNeeded(block.getNumBytes(), item)) {
923-
return block;
924-
}
925-
} else {
926-
LOG.info("There are no blocks in the blockPool {}", iter.getBlockPoolId());
913+
// A valid block is a finalized block, we iterate until we get
914+
// finalized blocks
915+
if (!this.dataset.isValidBlock(block)) {
916+
continue;
917+
}
918+
// We don't look for the best, we just do first fit
919+
if (isLessThanNeeded(block.getNumBytes(), item)) {
920+
return block;
927921
}
928-
929922
} catch (IOException e) {
930923
item.incErrorCount();
931924
}

0 commit comments

Comments
 (0)