From 0f9422d5756da2b05814cb24f235fc0fa9f5044b Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 22 Jan 2014 18:46:06 +0100 Subject: [PATCH] Cluster: update slaves lists in clusterSetMaster(). --- src/cluster.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cluster.c b/src/cluster.c index 78fdce9a..c3760861 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -2501,8 +2501,12 @@ void clusterSetMaster(clusterNode *n) { if (myself->flags & REDIS_NODE_MASTER) { myself->flags &= ~REDIS_NODE_MASTER; myself->flags |= REDIS_NODE_SLAVE; + } else { + if (myself->slaveof) + clusterNodeRemoveSlave(myself->slaveof,myself); } myself->slaveof = n; + clusterNodeAddSlave(n,myself); replicationSetMaster(n->ip, n->port); } -- GitLab