From 88221f88c05bd9b0ff6e7941006661e630507659 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 19 Mar 2013 09:58:05 +0100 Subject: [PATCH] Cluster: new command CLUSTER FLUSHSLOTS. It's just a simpler way to CLUSTER DELSLOTS with all the slots as arguments, in order to obtain a node without assigned slots for reconfiguration. --- src/cluster.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cluster.c b/src/cluster.c index 7b6461f8..d066c52a 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -1961,6 +1961,16 @@ void clusterCommand(redisClient *c) { o = createObject(REDIS_STRING,ci); addReplyBulk(c,o); decrRefCount(o); + } else if (!strcasecmp(c->argv[1]->ptr,"flushslots") && c->argc == 2) { + /* CLUSTER FLUSHSLOTS */ + if (dictSize(server.db[0].dict) != 0) { + addReplyError(c,"DB must be empty to perform CLUSTER FLUSHSLOTS."); + return; + } + clusterDelNodeSlots(server.cluster->myself); + clusterUpdateState(); + clusterSaveConfigOrDie(); + addReply(c,shared.ok); } else if ((!strcasecmp(c->argv[1]->ptr,"addslots") || !strcasecmp(c->argv[1]->ptr,"delslots")) && c->argc >= 3) { -- GitLab