CLUSTER BUMPEPOCH initial implementation fixed.

This commit is contained in:
antirez
2016-01-11 15:39:09 +01:00
parent e4eb6c7a5d
commit 02c40c9dc2
2 changed files with 25 additions and 14 deletions

View File

@ -4022,13 +4022,6 @@ void clusterCommand(client *c) {
}
clusterDelSlot(slot);
clusterAddSlot(n,slot);
} else if (!strcasecmp(c->argv[3]->ptr,"bumpepoch") && c->argc == 2) {
/* CLUSTER BUMPEPOCH */
int retval = clusterBumpConfigEpochWithoutConsensus();
sds reply = sdscatprintf(sdsempty(),"%s %llu\r\n",
(retval == C_OK) ? "BUMPED" : "STILL",
(unsigned long long) myself->configEpoch);
addReplySds(c,reply);
} else {
addReplyError(c,
"Invalid CLUSTER SETSLOT action or number of arguments");
@ -4036,6 +4029,13 @@ void clusterCommand(client *c) {
}
clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG|CLUSTER_TODO_UPDATE_STATE);
addReply(c,shared.ok);
} else if (!strcasecmp(c->argv[1]->ptr,"bumpepoch") && c->argc == 2) {
/* CLUSTER BUMPEPOCH */
int retval = clusterBumpConfigEpochWithoutConsensus();
sds reply = sdscatprintf(sdsempty(),"+%s %llu\r\n",
(retval == C_OK) ? "BUMPED" : "STILL",
(unsigned long long) myself->configEpoch);
addReplySds(c,reply);
} else if (!strcasecmp(c->argv[1]->ptr,"info") && c->argc == 2) {
/* CLUSTER INFO */
char *statestr[] = {"ok","fail","needhelp"};