diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 714bfdc0e4..3ebf799ea4 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -565,6 +565,9 @@ Release 2.8.0 - UNRELEASED YARN-3859. LeafQueue doesn't print user properly for application add. (Varun Saxena via devaraj) + YARN-3860. rmadmin -transitionToActive should check the state of non-target node. + (Masatake Iwasaki via junping_du) + Release 2.7.2 - UNRELEASED 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 932b62d008..36d29d6589 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 @@ -797,7 +797,15 @@ public class RMAdminCLI extends HAAdmin { "Could not connect to RM HA Admin for node " + rmId); } } - + + /** + * returns the list of all resourcemanager ids for the given configuration. + */ + @Override + protected Collection getTargetIds(String targetNodeToActivate) { + return HAUtil.getRMHAIds(getConf()); + } + @Override protected String getUsageString() { return "Usage: rmadmin"; 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 a95412c974..6dc326a929 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 @@ -27,6 +27,7 @@ import static org.mockito.Matchers.argThat; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -116,6 +117,7 @@ public class TestRMAdminCLI { YarnConfiguration conf = new YarnConfiguration(); conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true); + conf.set(YarnConfiguration.RM_HA_IDS, "rm1,rm2"); rmAdminCLIWithHAEnabled = new RMAdminCLI(conf) { @Override @@ -259,6 +261,8 @@ public class TestRMAdminCLI { assertEquals(0, rmAdminCLIWithHAEnabled.run(args)); verify(haadmin).transitionToActive( any(HAServiceProtocol.StateChangeRequestInfo.class)); + // HAAdmin#isOtherTargetNodeActive should check state of non-target node. + verify(haadmin, times(1)).getServiceStatus(); } @Test(timeout = 500)