From 8ef716d19ae0859e02199d24d5f78bb2711861cf Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 11 Jan 2016 15:01:14 +0100 Subject: [PATCH] Cluster: CLUSTER BUMPEPOCH introduced to help redis-trib fix. Sometimes during "fixes" we have to setup a new configuration and assign slots to nodes. With BUMPEPOCH we can make sure the new configuration of the node will win if there are conflicting configurations (for example another node is *also* claiming the same slot because the cluster is totally messed up). --- src/cluster.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cluster.c b/src/cluster.c index a73220b1..6123a9fd 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -4027,6 +4027,13 @@ void clusterCommand(redisClient *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");