YARN-3860. rmadmin -transitionToActive should check the state of non-target node. (Contributed by Masatake Iwasaki)

(cherry picked from commit a95d39f9d0)
This commit is contained in:
Junping Du 2015-06-28 22:26:47 -07:00
parent 4155bb565e
commit dbd2b18205
3 changed files with 16 additions and 1 deletions

View File

@ -517,6 +517,9 @@ Release 2.8.0 - UNRELEASED
YARN-3859. LeafQueue doesn't print user properly for application add. YARN-3859. LeafQueue doesn't print user properly for application add.
(Varun Saxena via devaraj) (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 Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -798,6 +798,14 @@ public class RMAdminCLI extends HAAdmin {
} }
} }
/**
* returns the list of all resourcemanager ids for the given configuration.
*/
@Override
protected Collection<String> getTargetIds(String targetNodeToActivate) {
return HAUtil.getRMHAIds(getConf());
}
@Override @Override
protected String getUsageString() { protected String getUsageString() {
return "Usage: rmadmin"; return "Usage: rmadmin";

View File

@ -27,6 +27,7 @@ import static org.mockito.Matchers.argThat;
import static org.mockito.Matchers.eq; import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never; import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -116,6 +117,7 @@ public class TestRMAdminCLI {
YarnConfiguration conf = new YarnConfiguration(); YarnConfiguration conf = new YarnConfiguration();
conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true); conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true);
conf.set(YarnConfiguration.RM_HA_IDS, "rm1,rm2");
rmAdminCLIWithHAEnabled = new RMAdminCLI(conf) { rmAdminCLIWithHAEnabled = new RMAdminCLI(conf) {
@Override @Override
@ -259,6 +261,8 @@ public class TestRMAdminCLI {
assertEquals(0, rmAdminCLIWithHAEnabled.run(args)); assertEquals(0, rmAdminCLIWithHAEnabled.run(args));
verify(haadmin).transitionToActive( verify(haadmin).transitionToActive(
any(HAServiceProtocol.StateChangeRequestInfo.class)); any(HAServiceProtocol.StateChangeRequestInfo.class));
// HAAdmin#isOtherTargetNodeActive should check state of non-target node.
verify(haadmin, times(1)).getServiceStatus();
} }
@Test(timeout = 500) @Test(timeout = 500)