diff --git a/src/server.c b/src/server.c index 9c2126bc0..eee3391d9 100644 --- a/src/server.c +++ b/src/server.c @@ -3430,6 +3430,12 @@ void rejectCommandFormat(client *c, const char *fmt, ...) { sdsfree(s); } +/* A command that uses keys but has no pre-determined key position arguments. */ +static int cmdHasMovableKeys(struct redisCommand *cmd) { + return (cmd->getkeys_proc && !(cmd->flags & CMD_MODULE)) || + cmd->flags & CMD_MODULE_GETKEYS; +} + /* If this function gets called we already read a whole * command, arguments are in the client argv/argc fields. * processCommand() execute the command or prepare the @@ -3518,7 +3524,7 @@ int processCommand(client *c) { !(c->flags & CLIENT_MASTER) && !(c->flags & CLIENT_LUA && server.lua_caller->flags & CLIENT_MASTER) && - !(c->cmd->getkeys_proc == NULL && c->cmd->firstkey == 0 && + !(!cmdHasMovableKeys(c->cmd) && c->cmd->firstkey == 0 && c->cmd->proc != execCommand)) { int hashslot; @@ -3901,9 +3907,7 @@ void addReplyCommand(client *c, struct redisCommand *cmd) { flagcount += addReplyCommandFlag(c,cmd,CMD_ASKING, "asking"); flagcount += addReplyCommandFlag(c,cmd,CMD_FAST, "fast"); flagcount += addReplyCommandFlag(c,cmd,CMD_NO_AUTH, "no_auth"); - if ((cmd->getkeys_proc && !(cmd->flags & CMD_MODULE)) || - cmd->flags & CMD_MODULE_GETKEYS) - { + if (cmdHasMovableKeys(cmd)) { addReplyStatus(c, "movablekeys"); flagcount += 1; }