yuzegao commented on code in PR #3295:
URL: https://github.com/apache/kvrocks/pull/3295#discussion_r2637669551
##########
src/commands/cmd_cluster.cc:
##########
@@ -237,7 +238,29 @@ class CommandClusterX : public Commander {
return Status::OK();
}
- return {Status::RedisParseErr, "CLUSTERX command, CLUSTERX
VERSION|MYID|SETNODEID|SETNODES|SETSLOT|MIGRATE"};
+ if (subcommand_ == "failover") {
+ if (args.size() != 3 && args.size() != 4) return {Status::RedisParseErr,
errWrongNumOfArguments};
+
+ slave_node_id_ = args_[2];
+
+ if (args.size() == 4) {
+ auto parse_result = ParseInt<int>(args_[3], 10);
+ if (!parse_result) return {Status::RedisParseErr, "Invalid timeout"};
+ if (*parse_result < 0) return {Status::RedisParseErr,
errTimeoutIsNegative};
+ failover_timeout_ = *parse_result;
+ } else {
+ failover_timeout_ = 1000;
+ }
+ return Status::OK();
+ }
+
+ if (subcommand_ == "takeover") {
+ if (args.size() != 2) return {Status::RedisParseErr,
errWrongNumOfArguments};
+ return Status::OK();
+ }
+
+ return {Status::RedisParseErr,
+ "CLUSTERX command, CLUSTERX
VERSION|MYID|SETNODEID|SETNODES|SETSLOT|MIGRATE|FAILOVER"};
Review Comment:
The TAKEOVER is inner command, don't need to declare here.
--
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]