mirror of
https://github.com/fluencelabs/redis
synced 2025-03-23 11:00:50 +00:00
Cluster: use CountKeysInSlot() when we just need the count.
This commit is contained in:
parent
ad3bca1fdf
commit
c2eb4a606f
@ -1534,13 +1534,7 @@ void clusterCommand(redisClient *c) {
|
|||||||
if (server.cluster->slots[slot] == server.cluster->myself &&
|
if (server.cluster->slots[slot] == server.cluster->myself &&
|
||||||
n != server.cluster->myself)
|
n != server.cluster->myself)
|
||||||
{
|
{
|
||||||
int numkeys;
|
if (CountKeysInSlot(slot) != 0) {
|
||||||
robj **keys;
|
|
||||||
|
|
||||||
keys = zmalloc(sizeof(robj*)*1);
|
|
||||||
numkeys = GetKeysInSlot(slot, keys, 1);
|
|
||||||
zfree(keys);
|
|
||||||
if (numkeys != 0) {
|
|
||||||
addReplyErrorFormat(c, "Can't assign hashslot %d to a different node while I still hold keys for this hash slot.", slot);
|
addReplyErrorFormat(c, "Can't assign hashslot %d to a different node while I still hold keys for this hash slot.", slot);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1227,6 +1227,7 @@ int selectDb(redisClient *c, int id);
|
|||||||
void signalModifiedKey(redisDb *db, robj *key);
|
void signalModifiedKey(redisDb *db, robj *key);
|
||||||
void signalFlushedDb(int dbid);
|
void signalFlushedDb(int dbid);
|
||||||
unsigned int GetKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count);
|
unsigned int GetKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count);
|
||||||
|
unsigned int CountKeysInSlot(unsigned int hashslot);
|
||||||
int verifyClusterConfigWithData(void);
|
int verifyClusterConfigWithData(void);
|
||||||
|
|
||||||
/* API to get key arguments from commands */
|
/* API to get key arguments from commands */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user