diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 19e82c1fd5d..cafb8765715 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -753,6 +753,9 @@ Release 2.6.0 - UNRELEASED prevent creating thousands of threads in a large cluster. (Jason Lowe via jianhe) + YARN-2723. Fix rmadmin -replaceLabelsOnNode does not correctly parse port. + (Naganarasimha G R via xgong) + Release 2.5.1 - 2014-09-05 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java index 5e3f2a849be..cd884f2ea2b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java @@ -454,7 +454,7 @@ public class RMAdminCLI extends HAAdmin { int port; if (nodeIdStr.contains(":")) { nodeName = nodeIdStr.substring(0, nodeIdStr.indexOf(":")); - port = Integer.valueOf(nodeIdStr.substring(nodeIdStr.indexOf(":"))); + port = Integer.valueOf(nodeIdStr.substring(nodeIdStr.indexOf(":") + 1)); } else { nodeName = nodeIdStr; port = 0; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java index b4d29b6820a..4cabeb7287f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java @@ -488,6 +488,20 @@ public class TestRMAdminCLI { "-directlyAccessNodeLabelStore" }; assertTrue(0 != rmAdminCLI.run(args)); } + + @Test + public void testReplaceLabelsOnNodeWithPort() throws Exception { + // Successfully replace labels + dummyNodeLabelsManager.addToCluserNodeLabels(ImmutableSet.of("x", "y")); + String[] args = + { "-replaceLabelsOnNode", "node1:8000,x,y node2:8000,y", + "-directlyAccessNodeLabelStore" }; + assertEquals(0, rmAdminCLI.run(args)); + assertTrue(dummyNodeLabelsManager.getNodeLabels().containsKey( + NodeId.newInstance("node1", 8000))); + assertTrue(dummyNodeLabelsManager.getNodeLabels().containsKey( + NodeId.newInstance("node2", 8000))); + } @Test public void testGetClusterNodeLabels() throws Exception {