Skip to content

Commit 9251f1c

Browse files
JohnSullyJohn Sully
authored andcommitted
Permit keys of differing slots as long as they are served by this cluster and we are not migrating
1 parent 7b7c0ba commit 9251f1c

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/cluster.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5952,6 +5952,7 @@ 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;
59555956
for (j = 0; j < numkeys; j++) {
59565957
robj *thiskey = margv[keyindex[j]];
59575958
int thisslot = keyHashSlot((char*)ptrFromObj(thiskey),
@@ -5987,10 +5988,19 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
59875988
} else if (g_pserver->cluster->importing_slots_from[slot] != NULL) {
59885989
importing_slot = 1;
59895990
}
5991+
5992+
if (n == myself && !importing_slot && !migrating_slot) {
5993+
fFirstKeyThisServer = true;
5994+
}
59905995
} else {
59915996
/* If it is not the first key, make sure it is exactly
59925997
* the same key as the first we saw. */
59935998
if (!equalStringObjects(firstkey,thiskey)) {
5999+
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+
}
6003+
59946004
if (slot != thisslot) {
59956005
/* Error: multiple keys from different slots. */
59966006
getKeysFreeResult(&result);

src/server.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5663,7 +5663,8 @@ sds genRedisInfoString(const char *section) {
56635663
"lru_clock:%u\r\n"
56645664
"executable:%s\r\n"
56655665
"config_file:%s\r\n"
5666-
"availability_zone:%s\r\n",
5666+
"availability_zone:%s\r\n"
5667+
"features:%s\r\n",
56675668
KEYDB_SET_VERSION,
56685669
redisGitSHA1(),
56695670
strtol(redisGitDirty(),NULL,10) > 0,
@@ -5690,7 +5691,8 @@ sds genRedisInfoString(const char *section) {
56905691
lruclock,
56915692
cserver.executable ? cserver.executable : "",
56925693
cserver.configfile ? cserver.configfile : "",
5693-
g_pserver->sdsAvailabilityZone);
5694+
g_pserver->sdsAvailabilityZone,
5695+
"cluster_mget");
56945696
}
56955697

56965698
/* Clients */

0 commit comments

Comments
 (0)