Skip to content

Commit

Permalink
Cluster: flush importing/migrating state when master is turned into s…
Browse files Browse the repository at this point in the history
…lave.
  • Loading branch information
antirez committed Mar 11, 2014
1 parent 2e8e0ad commit 8287945
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cluster.c
Expand Up @@ -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);
Expand Down

0 comments on commit 8287945

Please sign in to comment.