Cluster: update slaves lists in clusterSetMaster().

This commit is contained in:
antirez 2014-01-22 18:46:06 +01:00
parent 5383ab0bc6
commit 0f9422d575

View File

@ -2501,8 +2501,12 @@ void clusterSetMaster(clusterNode *n) {
if (myself->flags & REDIS_NODE_MASTER) { if (myself->flags & REDIS_NODE_MASTER) {
myself->flags &= ~REDIS_NODE_MASTER; myself->flags &= ~REDIS_NODE_MASTER;
myself->flags |= REDIS_NODE_SLAVE; myself->flags |= REDIS_NODE_SLAVE;
} else {
if (myself->slaveof)
clusterNodeRemoveSlave(myself->slaveof,myself);
} }
myself->slaveof = n; myself->slaveof = n;
clusterNodeAddSlave(n,myself);
replicationSetMaster(n->ip, n->port); replicationSetMaster(n->ip, n->port);
} }