zeekling commented on code in PR #6957:
URL: https://github.com/apache/hadoop/pull/6957#discussion_r1707205446
##########
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:
Do we need to check whether args[1] is the primary? If it is the primary,
there is no need to switch.
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java:
##########
@@ -172,6 +175,14 @@ public class RMAdminCLI extends HAAdmin {
"Update resource on specific node."))
.build();
+ private final static Map<String, UsageInfo> YARN_HA_USAGE =
+ ImmutableMap.<String, UsageInfo> builder()
+ .put("-failover", new UsageInfo(
+ "<serviceId> <serviceId>",
Review Comment:
What does means?
--
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]