Permalink
Browse files

Cluster: flush importing/migrating state when master is turned into s…

…lave.
  • Loading branch information...
1 parent 2e8e0ad commit 8287945ff862cfa578afe83e2f27fbe9fc1ba13f @antirez committed Mar 11, 2014
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/cluster.c
View
@@ -2897,15 +2897,16 @@ 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);
if (nodeIsMaster(myself)) {
myself->flags &= ~REDIS_NODE_MASTER;
myself->flags |= REDIS_NODE_SLAVE;
+ clusterCloseAllSlots();
} else {
if (myself->slaveof)
clusterNodeRemoveSlave(myself->slaveof,myself);

0 comments on commit 8287945

Please sign in to comment.