HDFS-14598. Findbugs warning caused by HDFS-12487.

Contributed by He Xiaoqiao.

(cherry picked from commit 041e7a7dee)
This commit is contained in:
Anu Engineer 2019-06-24 15:34:11 -07:00 committed by Wei-Chiu Chuang
parent 9637124535
commit e7fce2104f
1 changed files with 9 additions and 16 deletions

View File

@ -906,24 +906,17 @@ public class DiskBalancer {
if(null == block){ if(null == block){
LOG.info("NextBlock call returned null.No valid block to copy. {}", LOG.info("NextBlock call returned null.No valid block to copy. {}",
item.toJson()); item.toJson());
return block; return null;
} }
if (block != null) {
// A valid block is a finalized block, we iterate until we get // A valid block is a finalized block, we iterate until we get
// finalized blocks // finalized blocks
if (!this.dataset.isValidBlock(block)) { if (!this.dataset.isValidBlock(block)) {
continue; continue;
} }
// We don't look for the best, we just do first fit // We don't look for the best, we just do first fit
if (isLessThanNeeded(block.getNumBytes(), item)) { if (isLessThanNeeded(block.getNumBytes(), item)) {
return block; return block;
} }
} else {
LOG.info("There are no blocks in the blockPool {}", iter.getBlockPoolId());
}
} catch (IOException e) { } catch (IOException e) {
item.incErrorCount(); item.incErrorCount();
} }