Clarification on the bug that was fixed in PR #7539. (#7541)

Before that PR, processCommand() did not notice that cmd could be a module
command in which case getkeys_proc member has a different meaning.

The outcome was that a module command which doesn't take any key names in its
arguments (similar to SLOWLOG) would be handled as if it might have key name arguments
(similar to MEMORY), would consider cluster redirect but will end up with 0 keys
after an excessive call to getKeysFromCommand, and eventually do the right thing.
This commit is contained in:
WuYunlong 2020-07-21 14:41:44 +08:00 committed by GitHub
parent 3f2fbc4c61
commit f7f77a746a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3430,7 +3430,8 @@ void rejectCommandFormat(client *c, const char *fmt, ...) {
sdsfree(s);
}
/* A command that uses keys but has no pre-determined key position arguments. */
/* Returns 1 for commands that may have key names in their arguments, but have
* no pre-determined key positions. */
static int cmdHasMovableKeys(struct redisCommand *cmd) {
return (cmd->getkeys_proc && !(cmd->flags & CMD_MODULE)) ||
cmd->flags & CMD_MODULE_GETKEYS;