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
8fadebfc
Commit
8fadebfc
authored
Mar 08, 2019
by
artix
Browse files
Redis Benchmark: handle CLUSTERDOWN error
parent
c389ad0d
Changes
1
Show whitespace changes
Inline
Side-by-side
src/redis-benchmark.c
View file @
8fadebfc
...
@@ -449,27 +449,27 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
...
@@ -449,27 +449,27 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
}
}
}
}
if (config.cluster_mode && is_err && c->cluster_node &&
/* Try to update slots configuration if reply error is
(!strncmp(r->str,"MOVED",5) ||
* MOVED/ASK/CLUSTERDOWN and the key(s) used by the command
!strcmp(r->str,"ASK")))
* contain(s) the slot hash tag. */
{
if (is_err && c->cluster_node && c->staglen) {
/* Try to update slots configuration if the key of the
int fetch_slots = 0, do_wait = 0;
* command is using the slot hash tag. */
if (!strncmp(r->str,"MOVED",5) || !strncmp(r->str,"ASK",3))
if (c->staglen && !fetchClusterSlotsConfiguration(c))
fetch_slots = 1;
exit(1);
else if (!strncmp(r->str,"CLUSTERDOWN",11)) {
/*
/* Usually the cluster is able to recover itself after
clusterNode *node = c->cluster_node;
* a CLUSTERDOWN error, so try to sleep one second
assert(node);
* before requesting the new configuration. */
if (++node->current_slot_index >= node->slots_count) {
fetch_slots = 1;
if (config.showerrors) {
do_wait = 1;
fprintf(stderr, "WARN: No more available slots in "
printf("Error from server %s:%d: %s\n",
"node %s:%d\n", node->ip, node->port);
c->cluster_node->ip,
}
c->cluster_node->port,
freeReplyObject(reply);
r->str);
freeClient(c);
return;
}
}
*/
if (do_wait) sleep(1);
if (fetch_slots && !fetchClusterSlotsConfiguration(c))
exit(1);
}
}
freeReplyObject(reply);
freeReplyObject(reply);
...
...
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