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

This commit is contained in:
Junping Du 2015-06-28 22:26:47 -07:00
parent aad6a7d5db
commit a95d39f9d0
3 changed files with 16 additions and 1 deletions

View File

@ -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

View File

@ -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<String> getTargetIds(String targetNodeToActivate) {
return HAUtil.getRMHAIds(getConf());
}
@Override
protected String getUsageString() {
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.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)