summaryrefslogtreecommitdiff
path: root/src/cluster.c
diff options
context:
space:
mode:
authorjudeng <abc3844@126.com>2022-08-05 11:42:56 +0800
committerGitHub <noreply@github.com>2022-08-04 20:42:56 -0700
commit7d8911d22a588c78098e2df080d954cc889d5529 (patch)
tree18dadd7938944b10d211711c814deff77ee7a25f /src/cluster.c
parent6a7dd00cdda8c3f113beecdc9d44ade82886b472 (diff)
downloadredis-7d8911d22a588c78098e2df080d954cc889d5529.tar.gz
Optimize the performance of multi-key commands in cluster mode (#11044)
* Optimize the performance of multi-key commands in cluster mode * add note
Diffstat (limited to 'src/cluster.c')
-rw-r--r--src/cluster.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/cluster.c b/src/cluster.c
index 7affc838e..2677d3503 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -6747,18 +6747,17 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
} else {
/* If it is not the first key/channel, make sure it is exactly
* the same key/channel as the first we saw. */
- if (!equalStringObjects(firstkey,thiskey)) {
- if (slot != thisslot) {
- /* Error: multiple keys from different slots. */
- getKeysFreeResult(&result);
- if (error_code)
- *error_code = CLUSTER_REDIR_CROSS_SLOT;
- return NULL;
- } else {
- /* Flag this request as one with multiple different
- * keys/channels. */
- multiple_keys = 1;
- }
+ if (slot != thisslot) {
+ /* Error: multiple keys from different slots. */
+ getKeysFreeResult(&result);
+ if (error_code)
+ *error_code = CLUSTER_REDIR_CROSS_SLOT;
+ return NULL;
+ }
+ if (importing_slot && !multiple_keys && !equalStringObjects(firstkey,thiskey)) {
+ /* Flag this request as one with multiple different
+ * keys/channels when the slot is in importing state. */
+ multiple_keys = 1;
}
}