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

This commit is contained in:
Weiwei Yang 2017-09-28 14:32:43 +08:00 committed by Owen O'Malley
parent 13fdb58490
commit 7363c8fc09
2 changed files with 6 additions and 6 deletions

View File

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

View File

@ -896,7 +896,7 @@ public class TestNodeManager {
nodeManager.sendHeartbeat(datanodeID, null); nodeManager.sendHeartbeat(datanodeID, null);
String status = nodeManager.getChillModeStatus(); String status = nodeManager.getChillModeStatus();
Assert.assertThat(status, CoreMatchers.containsString("Still in chill " + 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. // Should not exit chill mode since 10 nodes have not heartbeat yet.
assertFalse(nodeManager.isOutOfNodeChillMode()); assertFalse(nodeManager.isOutOfNodeChillMode());