You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/10/27 16:45:32 UTC
[GitHub] [incubator-kvrocks] tanruixiang commented on a diff in pull request #1047: fix: supports multiple rename-commands
tanruixiang commented on code in PR #1047:
URL: https://github.com/apache/incubator-kvrocks/pull/1047#discussion_r1007134298
##########
src/config/config.cc:
##########
@@ -273,23 +273,26 @@ void Config::initFieldValidator() {
}},
{"rename-command",
[](const std::string &k, const std::string &v) -> Status {
- std::vector<std::string> args = Util::Split(v, " \t");
- if (args.size() != 2) {
- return Status(Status::NotOK, "Invalid rename-command format");
- }
- auto commands = Redis::GetCommands();
- auto cmd_iter = commands->find(Util::ToLower(args[0]));
- if (cmd_iter == commands->end()) {
- return Status(Status::NotOK, "No such command in rename-command");
- }
- if (args[1] != "\"\"") {
- auto new_command_name = Util::ToLower(args[1]);
- if (commands->find(new_command_name) != commands->end()) {
- return Status(Status::NotOK, "Target command name already exists");
+ std::vector<std::string> all_args = Util::Split(v, "\n");
Review Comment:
This is because we store the rename-command in the vector, and the code logic is obtained with Tostring. So we used `\n` as delimiter to concat this vector. For example: `KEYS KEYSNEW \n GET GETNEW \n`
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org