granewang commented on code in PR #6957:
URL: https://github.com/apache/hadoop/pull/6957#discussion_r1708899262
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java:
##########
@@ -757,6 +768,28 @@ private int replaceLabelsOnNodes(Map<NodeId, Set<String>>
map,
return 0;
}
+ private int failover(CommandLine cmd)
+ throws IOException, ServiceFailedException {
+ int numOpts = cmd.getOptions() == null ? 0 : cmd.getOptions().length;
+ final String[] args = cmd.getArgs();
+ if (numOpts > 1 || args.length != 2) {
+ errOut.println("failover: incorrect arguments");
+ printUsage(errOut, "-failover", YARN_HA_USAGE);
+ return -1;
+ }
+ HAServiceTarget fromNode = resolveTarget(args[0]);
+ HAServiceTarget toNode = resolveTarget(args[1]);
+ setRequestSource(HAServiceProtocol.RequestSource.REQUEST_BY_USER_FORCED);
+ HAServiceProtocol proto = fromNode.getProxy(
+ getConf(), 0);
+ HAServiceProtocolHelper.transitionToStandby(proto, createReqInfo());
+ HAServiceProtocol proto1 = toNode.getProxy(
+ getConf(), 0);
+ HAServiceProtocolHelper.transitionToActive(proto1, createReqInfo());
Review Comment:
If args[1] is the primary,it will return :
HAServiceProtocolHelper.transitionToActive
->AdminService.java(transitionToActive):
"
@Override
public synchronized void transitionToActive(
HAServiceProtocol.StateChangeRequestInfo reqInfo) throws IOException {
if (isRMActive()) {
**return;**
}
....
"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]