Skip to content

Commit c6e20ea

Browse files
JohnSullyJohn Sully
authored andcommitted
Fix over pessimistic checks that prevent replicas from serving mget
1 parent 9251f1c commit c6e20ea

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

src/cluster.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5952,7 +5952,6 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
59525952
numkeys = getKeysFromCommand(mcmd,margv,margc,&result);
59535953
keyindex = result.keys;
59545954

5955-
bool fFirstKeyThisServer = false;
59565955
for (j = 0; j < numkeys; j++) {
59575956
robj *thiskey = margv[keyindex[j]];
59585957
int thisslot = keyHashSlot((char*)ptrFromObj(thiskey),
@@ -5988,20 +5987,13 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
59885987
} else if (g_pserver->cluster->importing_slots_from[slot] != NULL) {
59895988
importing_slot = 1;
59905989
}
5991-
5992-
if (n == myself && !importing_slot && !migrating_slot) {
5993-
fFirstKeyThisServer = true;
5994-
}
59955990
} else {
59965991
/* If it is not the first key, make sure it is exactly
59975992
* the same key as the first we saw. */
59985993
if (!equalStringObjects(firstkey,thiskey)) {
59995994
clusterNode* nThisKey = g_pserver->cluster->slots[slot];
6000-
if (fFirstKeyThisServer && nThisKey == myself && g_pserver->cluster->migrating_slots_to[slot] == nullptr && g_pserver->cluster->importing_slots_from[slot] == nullptr) {
6001-
continue;
6002-
}
60035995

6004-
if (slot != thisslot) {
5996+
if (nThisKey != n || migrating_slot || importing_slot || (g_pserver->cluster->migrating_slots_to[slot] != nullptr && g_pserver->cluster->importing_slots_from[slot] != nullptr)) {
60055997
/* Error: multiple keys from different slots. */
60065998
getKeysFreeResult(&result);
60075999
if (error_code)

0 commit comments

Comments
 (0)