瀏覽代碼

HDFS-12540. Ozone: node status text reported by SCM is a bit confusing. Contributed by Weiwei Yang.

Weiwei Yang 7 年之前
父節點
當前提交
7363c8fc09

+ 5 - 5
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java

@@ -320,7 +320,7 @@ public class SCMNodeManager
     if (isOutOfNodeChillMode()) {
       return "Out of chill mode." + getNodeStatus();
     } else {
-      return "Still in chill mode. Waiting on nodes to report in."
+      return "Still in chill mode, waiting on nodes to report in."
           + getNodeStatus();
     }
   }
@@ -330,10 +330,10 @@ public class SCMNodeManager
    * @return - String
    */
   private String getNodeStatus() {
-    final String chillModeStatus = " %d of out of total "
-        + "%d nodes have reported in.";
-    return String.format(chillModeStatus, totalNodes.get(),
-        getMinimumChillModeNodes());
+    return isOutOfNodeChillMode() ?
+        String.format(" %d nodes have reported in.", totalNodes.get()) :
+        String.format(" %d nodes reported, minimal %d nodes required.",
+            totalNodes.get(), getMinimumChillModeNodes());
   }
 
   /**

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/node/TestNodeManager.java

@@ -896,7 +896,7 @@ public class TestNodeManager {
       nodeManager.sendHeartbeat(datanodeID, null);
       String status = nodeManager.getChillModeStatus();
       Assert.assertThat(status, CoreMatchers.containsString("Still in chill " +
-          "mode. Waiting on nodes to report in."));
+          "mode, waiting on nodes to report in."));
 
       // Should not exit chill mode since 10 nodes have not heartbeat yet.
       assertFalse(nodeManager.isOutOfNodeChillMode());