From 8287945ff862cfa578afe83e2f27fbe9fc1ba13f Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 11 Mar 2014 11:22:06 +0100 Subject: [PATCH] Cluster: flush importing/migrating state when master is turned into slave. --- src/cluster.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cluster.c b/src/cluster.c index b9737490..67fbf3df 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -2897,8 +2897,8 @@ int verifyClusterConfigWithData(void) { * SLAVE nodes handling * -------------------------------------------------------------------------- */ -/* Set the specified node 'n' as master. Setup the node as a slave if - * needed. */ +/* Set the specified node 'n' as master for this node. + * If this node is currently a master, it is turned into a slave. */ void clusterSetMaster(clusterNode *n) { redisAssert(n != myself); redisAssert(myself->numslots == 0); @@ -2906,6 +2906,7 @@ void clusterSetMaster(clusterNode *n) { if (nodeIsMaster(myself)) { myself->flags &= ~REDIS_NODE_MASTER; myself->flags |= REDIS_NODE_SLAVE; + clusterCloseAllSlots(); } else { if (myself->slaveof) clusterNodeRemoveSlave(myself->slaveof,myself);