hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xg...@apache.org
Subject git commit: YARN-2723. Fix rmadmin -replaceLabelsOnNode does not correctly parse port. Contributed by Naganarasimha G R
Date Sat, 25 Oct 2014 19:45:54 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 28051e415 -> 65d95b1a5


YARN-2723. Fix rmadmin -replaceLabelsOnNode does not correctly parse
port. Contributed by Naganarasimha G R


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/65d95b1a
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/65d95b1a
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/65d95b1a

Branch: refs/heads/trunk
Commit: 65d95b1a520d4ffdf024dbdfcf11d855a3948056
Parents: 28051e41
Author: Xuan <xgong@apache.org>
Authored: Sat Oct 25 12:45:14 2014 -0700
Committer: Xuan <xgong@apache.org>
Committed: Sat Oct 25 12:45:14 2014 -0700

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                       |  3 +++
 .../org/apache/hadoop/yarn/client/cli/RMAdminCLI.java |  2 +-
 .../apache/hadoop/yarn/client/cli/TestRMAdminCLI.java | 14 ++++++++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/65d95b1a/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 19e82c1..cafb876 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

http://git-wip-us.apache.org/repos/asf/hadoop/blob/65d95b1a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java
----------------------------------------------------------------------
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 5e3f2a8..cd884f2 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;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/65d95b1a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java
----------------------------------------------------------------------
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 b4d29b6..4cabeb7 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 {


Mime
View raw message