Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
53774e69
Unverified
Commit
53774e69
authored
Mar 09, 2021
by
uriyage
Committed by
GitHub
Mar 09, 2021
Browse files
remove redundant check for evalCommand (#8565)
parent
1ccfd6a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
53774e69
...
@@ -5824,18 +5824,14 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
...
@@ -5824,18 +5824,14 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
* cluster is down. */
* 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_WRITE
)
&&
!
(
cmd
->
proc
==
evalCommand
)
}
else
if
(
cmd
->
flags
&
CMD_WRITE
)
{
&&
!
(
cmd
->
proc
==
evalShaCommand
))
/* The cluster is configured to allow read only commands */
{
/* 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
{
}
else
{
/* Fall through and allow the command to be executed:
/* Fall through and allow the command to be executed:
* this happens when server.cluster_allow_reads_when_down is
* this happens when server.cluster_allow_reads_when_down is
* true and the command is
a readonly command or EVAL / EVALSHA.
*/
* true and the command is
not a write command
*/
}
}
}
}
...
@@ -5876,7 +5872,7 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
...
@@ -5876,7 +5872,7 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
int
is_write_command
=
(
c
->
cmd
->
flags
&
CMD_WRITE
)
||
int
is_write_command
=
(
c
->
cmd
->
flags
&
CMD_WRITE
)
||
(
c
->
cmd
->
proc
==
execCommand
&&
(
c
->
mstate
.
cmd_flags
&
CMD_WRITE
));
(
c
->
cmd
->
proc
==
execCommand
&&
(
c
->
mstate
.
cmd_flags
&
CMD_WRITE
));
if
(
c
->
flags
&
CLIENT_READONLY
&&
if
(
c
->
flags
&
CLIENT_READONLY
&&
(
!
is_write_command
||
cmd
->
proc
==
evalCommand
||
cmd
->
proc
==
evalShaCommand
)
&&
!
is_write_command
&&
nodeIsSlave
(
myself
)
&&
nodeIsSlave
(
myself
)
&&
myself
->
slaveof
==
n
)
myself
->
slaveof
==
n
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment