diff --git a/src/server.c b/src/server.c index 56a49c85a..d9f7d7384 100644 --- a/src/server.c +++ b/src/server.c @@ -3891,7 +3891,7 @@ int processCommand(client *c) { (c->cmd->proc == execCommand && (c->mstate.cmd_flags & (CMD_WRITE | CMD_MAY_REPLICATE))); int is_deny_async_loading_command = (cmd_flags & CMD_NO_ASYNC_LOADING) || (c->cmd->proc == execCommand && (c->mstate.cmd_flags & CMD_NO_ASYNC_LOADING)); - int obey_client = mustObeyClient(c); + const int obey_client = mustObeyClient(c); if (authRequired(c)) { /* AUTH and HELLO and no auth commands are valid even in @@ -3924,7 +3924,7 @@ int processCommand(client *c) { * However we don't perform the redirection if: * 1) The sender of this command is our primary. * 2) The command has no key arguments. */ - if (server.cluster_enabled && !mustObeyClient(c) && + if (server.cluster_enabled && !obey_client && !(!(c->cmd->flags & CMD_MOVABLE_KEYS) && c->cmd->key_specs_num == 0 && c->cmd->proc != execCommand)) { int error_code; clusterNode *n = getNodeByQuery(c, c->cmd, c->argv, c->argc, &c->slot, &error_code); @@ -3941,7 +3941,7 @@ int processCommand(client *c) { } } - if (!server.cluster_enabled && c->capa & CLIENT_CAPA_REDIRECT && server.primary_host && !mustObeyClient(c) && + if (!server.cluster_enabled && c->capa & CLIENT_CAPA_REDIRECT && server.primary_host && !obey_client && (is_write_command || (is_read_command && !c->flag.readonly))) { if (server.failover_state == FAILOVER_IN_PROGRESS) { /* During the FAILOVER process, when conditions are met (such as