From 7363c8fc092762c718c746e3fda0495917ea3279 Mon Sep 17 00:00:00 2001 From: Weiwei Yang Date: Thu, 28 Sep 2017 14:32:43 +0800 Subject: [PATCH] HDFS-12540. Ozone: node status text reported by SCM is a bit confusing. Contributed by Weiwei Yang. --- .../apache/hadoop/ozone/scm/node/SCMNodeManager.java | 10 +++++----- .../apache/hadoop/ozone/scm/node/TestNodeManager.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java index 6e2805a5d3b..9f736060f4d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java @@ -320,7 +320,7 @@ public String getChillModeStatus() { 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 String getChillModeStatus() { * @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()); } /** diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/node/TestNodeManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/node/TestNodeManager.java index c29616932be..e8bf0adcd8d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/node/TestNodeManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/node/TestNodeManager.java @@ -896,7 +896,7 @@ public void testScmEnterAndExitChillMode() throws IOException, 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());