This is an automated email from the ASF dual-hosted git repository.

weichiu pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 1bae5c7  HDFS-14598. Findbugs warning caused by HDFS-12487. 
Contributed by He Xiaoqiao.
1bae5c7 is described below

commit 1bae5c7024feb20eb5d6e52f54aa402fdd77a396
Author: Anu Engineer <aengin...@apache.org>
AuthorDate: Mon Jun 24 15:34:11 2019 -0700

    HDFS-14598. Findbugs warning caused by HDFS-12487.
    Contributed by He Xiaoqiao.
    
    (cherry picked from commit 041e7a7dee4a17714f31952dc6364c77a65b1b73)
    (cherry picked from commit e7fce2104f28c48c817822bed9349d44b0694699)
---
 .../hadoop/hdfs/server/datanode/DiskBalancer.java  | 25 ++++++++--------------
 1 file changed, 9 insertions(+), 16 deletions(-)

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to