mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
- Fixed mistyped redis command (clusterManagerGetNodeWithMostKeysInSlot)
- Cluster node structure is now updated after ADDSLOTS
This commit is contained in:
parent
3312de067c
commit
3c039996b5
@ -3316,7 +3316,7 @@ static clusterManagerNode * clusterManagerGetNodeWithMostKeysInSlot(list *nodes,
|
|||||||
if (n->flags & CLUSTER_MANAGER_FLAG_SLAVE || n->replicate)
|
if (n->flags & CLUSTER_MANAGER_FLAG_SLAVE || n->replicate)
|
||||||
continue;
|
continue;
|
||||||
redisReply *r =
|
redisReply *r =
|
||||||
CLUSTER_MANAGER_COMMAND(n, "CLUSTER COUNTKEYSINSLOTi %d", slot);
|
CLUSTER_MANAGER_COMMAND(n, "CLUSTER COUNTKEYSINSLOT %d", slot);
|
||||||
int success = clusterManagerCheckRedisReply(n, r, err);
|
int success = clusterManagerCheckRedisReply(n, r, err);
|
||||||
if (success) {
|
if (success) {
|
||||||
if (r->integer > numkeys || node == NULL) {
|
if (r->integer > numkeys || node == NULL) {
|
||||||
@ -3446,6 +3446,9 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
|
|||||||
if (!clusterManagerCheckRedisReply(n, r, NULL)) fixed = -1;
|
if (!clusterManagerCheckRedisReply(n, r, NULL)) fixed = -1;
|
||||||
if (r) freeReplyObject(r);
|
if (r) freeReplyObject(r);
|
||||||
if (fixed < 0) goto cleanup;
|
if (fixed < 0) goto cleanup;
|
||||||
|
/* Since CLUSTER ADDSLOTS succeded, we also update the slot
|
||||||
|
* info into the node struct, in order to keep it synced */
|
||||||
|
n->slots[atoi(slot)] = 1;
|
||||||
fixed++;
|
fixed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3474,6 +3477,9 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
|
|||||||
if (!clusterManagerCheckRedisReply(n, r, NULL)) fixed = -1;
|
if (!clusterManagerCheckRedisReply(n, r, NULL)) fixed = -1;
|
||||||
if (r) freeReplyObject(r);
|
if (r) freeReplyObject(r);
|
||||||
if (fixed < 0) goto cleanup;
|
if (fixed < 0) goto cleanup;
|
||||||
|
/* Since CLUSTER ADDSLOTS succeded, we also update the slot
|
||||||
|
* info into the node struct, in order to keep it synced */
|
||||||
|
n->slots[atoi(slot)] = 1;
|
||||||
fixed++;
|
fixed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3513,6 +3519,9 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
|
|||||||
if (!clusterManagerCheckRedisReply(target, r, NULL)) fixed = -1;
|
if (!clusterManagerCheckRedisReply(target, r, NULL)) fixed = -1;
|
||||||
if (r) freeReplyObject(r);
|
if (r) freeReplyObject(r);
|
||||||
if (fixed < 0) goto cleanup;
|
if (fixed < 0) goto cleanup;
|
||||||
|
/* Since CLUSTER ADDSLOTS succeded, we also update the slot
|
||||||
|
* info into the node struct, in order to keep it synced */
|
||||||
|
target->slots[atoi(slot)] = 1;
|
||||||
listIter nli;
|
listIter nli;
|
||||||
listNode *nln;
|
listNode *nln;
|
||||||
listRewind(nodes, &nli);
|
listRewind(nodes, &nli);
|
||||||
@ -3633,6 +3642,9 @@ static int clusterManagerFixOpenSlot(int slot) {
|
|||||||
success = clusterManagerCheckRedisReply(owner, reply, NULL);
|
success = clusterManagerCheckRedisReply(owner, reply, NULL);
|
||||||
if (reply) freeReplyObject(reply);
|
if (reply) freeReplyObject(reply);
|
||||||
if (!success) goto cleanup;
|
if (!success) goto cleanup;
|
||||||
|
/* Since CLUSTER ADDSLOTS succeded, we also update the slot
|
||||||
|
* info into the node struct, in order to keep it synced */
|
||||||
|
owner->slots[slot] = 1;
|
||||||
/* Make sure this information will propagate. Not strictly needed
|
/* Make sure this information will propagate. Not strictly needed
|
||||||
* since there is no past owner, so all the other nodes will accept
|
* since there is no past owner, so all the other nodes will accept
|
||||||
* whatever epoch this node will claim the slot with. */
|
* whatever epoch this node will claim the slot with. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user