提交 4348d25f 编写于 作者: A antirez

Add some comment to PR #6144 changes.

上级 f3d67b38
...@@ -5599,14 +5599,22 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in ...@@ -5599,14 +5599,22 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
* if it is a read command and when allow_reads_when_down is enabled. */ * if it is a read command and when allow_reads_when_down is enabled. */
if (server.cluster->state != CLUSTER_OK) { if (server.cluster->state != CLUSTER_OK) {
if (!server.cluster_allow_reads_when_down) { if (!server.cluster_allow_reads_when_down) {
/* The cluster is configured to block commands when the
* cluster is down. */
if (error_code) *error_code = CLUSTER_REDIR_DOWN_STATE; if (error_code) *error_code = CLUSTER_REDIR_DOWN_STATE;
return NULL; return NULL;
} } else if (!(cmd->flags & CMD_READONLY) && !(cmd->proc == evalCommand)
&& !(cmd->proc == evalShaCommand))
if (!(cmd->flags & CMD_READONLY) && !(cmd->proc == evalCommand) {
&& !(cmd->proc == evalShaCommand)) { /* The cluster is configured to allow read only commands
* but this command is neither readonly, nor EVAL or
* EVALSHA. */
if (error_code) *error_code = CLUSTER_REDIR_DOWN_RO_STATE; if (error_code) *error_code = CLUSTER_REDIR_DOWN_RO_STATE;
return NULL; return NULL;
} else {
/* Fall through and allow the command to be executed:
* this happens when server.cluster_allow_reads_when_down is
* true and the command is a readonly command or EVAL / EVALSHA. */
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册