You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by we...@apache.org on 2020/05/05 01:07:41 UTC

[hadoop] branch branch-3.1 updated: HDFS-14599. HDFS-12487 breaks test TestDiskBalancer.testDiskBalancerWithFedClusterWithOneNameServiceEmpty. Contributed by He Xiaoqiao.

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 5612537  HDFS-14599. HDFS-12487 breaks test TestDiskBalancer.testDiskBalancerWithFedClusterWithOneNameServiceEmpty. Contributed by He Xiaoqiao.
5612537 is described below

commit 5612537df09e1ed942d1451d97755bce98d66aa8
Author: Inigo Goiri <in...@apache.org>
AuthorDate: Thu Jun 27 10:00:05 2019 -0700

    HDFS-14599. HDFS-12487 breaks test TestDiskBalancer.testDiskBalancerWithFedClusterWithOneNameServiceEmpty. Contributed by He Xiaoqiao.
    
    (cherry picked from commit 4a212242d99071d028b40c2f5d40afb7f337e471)
---
 .../org/apache/hadoop/hdfs/server/datanode/DiskBalancer.java  |  6 ++----
 .../hadoop/hdfs/server/diskbalancer/TestDiskBalancer.java     | 11 ++++-------
 2 files changed, 6 insertions(+), 11 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 9183344..ffa8524 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,8 +906,8 @@ public class DiskBalancer {
         try {
           ExtendedBlock block = iter.nextBlock();
           if(null == block){
-            LOG.info("NextBlock call returned null.No valid block to copy. {}",
-                    item.toJson());
+            LOG.info("NextBlock call returned null. No valid block to copy. {}",
+                item.toJson());
             return null;
           }
           // A valid block is a finalized block, we iterate until we get
@@ -923,13 +923,11 @@ public class DiskBalancer {
           item.incErrorCount();
         }
       }
-
       if (item.getErrorCount() >= getMaxError(item)) {
         item.setErrMsg("Error count exceeded.");
         LOG.info("Maximum error count exceeded. Error count: {} Max error:{} ",
             item.getErrorCount(), item.getMaxDiskErrors());
       }
-
       return null;
     }
 
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/diskbalancer/TestDiskBalancer.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/diskbalancer/TestDiskBalancer.java
index af17e3f..c948f9f 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/diskbalancer/TestDiskBalancer.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/diskbalancer/TestDiskBalancer.java
@@ -316,14 +316,12 @@ public class TestDiskBalancer {
     final Path filePath = new Path(fileName);
     long fileLen = blockCount * blockSize;
 
-
     //Writing data only to one nameservice.
     FileSystem fs = cluster.getFileSystem(0);
     TestBalancer.createFile(cluster, filePath, fileLen, (short) 1,
         0);
     DFSTestUtil.waitReplication(fs, filePath, (short) 1);
 
-
     GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer
         .captureLogs(DiskBalancer.LOG);
 
@@ -334,15 +332,14 @@ public class TestDiskBalancer {
       NodePlan plan = dataMover.generatePlan();
       dataMover.executePlan(plan);
       dataMover.verifyPlanExectionDone();
-      //Because here we have one nameservice empty, don't check
-      // blockPoolCount.
+      // Because here we have one nameservice empty, don't check blockPoolCount.
       dataMover.verifyAllVolumesHaveData(false);
     } finally {
-      Assert.assertTrue(logCapturer.getOutput().contains("There are no " +
-          "blocks in the blockPool"));
+      String logOut = logCapturer.getOutput();
+      Assert.assertTrue("Wrong log: " + logOut, logOut.contains(
+          "NextBlock call returned null. No valid block to copy."));
       cluster.shutdown();
     }
-
   }
 
   @Test


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