Permit keys of differing slots as long as they are served by this cluster and we are not migrating

This commit is contained in:
John Sully 2023-09-14 21:49:33 +00:00 committed by John Sully
parent 7b7c0ba192
commit 9251f1c244
2 changed files with 14 additions and 2 deletions

View File

@ -5952,6 +5952,7 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
numkeys = getKeysFromCommand(mcmd,margv,margc,&result);
keyindex = result.keys;
bool fFirstKeyThisServer = false;
for (j = 0; j < numkeys; j++) {
robj *thiskey = margv[keyindex[j]];
int thisslot = keyHashSlot((char*)ptrFromObj(thiskey),
@ -5987,10 +5988,19 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
} else if (g_pserver->cluster->importing_slots_from[slot] != NULL) {
importing_slot = 1;
}
if (n == myself && !importing_slot && !migrating_slot) {
fFirstKeyThisServer = true;
}
} else {
/* If it is not the first key, make sure it is exactly
* the same key as the first we saw. */
if (!equalStringObjects(firstkey,thiskey)) {
clusterNode* nThisKey = g_pserver->cluster->slots[slot];
if (fFirstKeyThisServer && nThisKey == myself && g_pserver->cluster->migrating_slots_to[slot] == nullptr && g_pserver->cluster->importing_slots_from[slot] == nullptr) {
continue;
}
if (slot != thisslot) {
/* Error: multiple keys from different slots. */
getKeysFreeResult(&result);

View File

@ -5663,7 +5663,8 @@ sds genRedisInfoString(const char *section) {
"lru_clock:%u\r\n"
"executable:%s\r\n"
"config_file:%s\r\n"
"availability_zone:%s\r\n",
"availability_zone:%s\r\n"
"features:%s\r\n",
KEYDB_SET_VERSION,
redisGitSHA1(),
strtol(redisGitDirty(),NULL,10) > 0,
@ -5690,7 +5691,8 @@ sds genRedisInfoString(const char *section) {
lruclock,
cserver.executable ? cserver.executable : "",
cserver.configfile ? cserver.configfile : "",
g_pserver->sdsAvailabilityZone);
g_pserver->sdsAvailabilityZone,
"cluster_mget");
}
/* Clients */