Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
3c039996
Commit
3c039996
authored
May 11, 2018
by
artix
Browse files
- Fixed mistyped redis command (clusterManagerGetNodeWithMostKeysInSlot)
- Cluster node structure is now updated after ADDSLOTS
parent
3312de06
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
3c039996
...
@@ -3316,7 +3316,7 @@ static clusterManagerNode * clusterManagerGetNodeWithMostKeysInSlot(list *nodes,
...
@@ -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 COUNTKEYSINSLOT
i
%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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment