提交 8c1bc8e8 编写于 作者: A antirez

Cluster: clear the PROMOTED slave directly into clusterSetMaster().

This way we make sure every time a master is turned into a replica
the flag will be cleared.
上级 e006407f
......@@ -1849,6 +1849,9 @@ void clusterSetMaster(clusterNode *n) {
myself->flags &= ~REDIS_NODE_MASTER;
myself->flags |= REDIS_NODE_SLAVE;
}
/* Clear the promoted flag anyway if we are a slave, to ensure it will
* be set only when the node turns into a master because of fail over. */
myself->flags &= ~REDIS_NODE_PROMOTED;
myself->slaveof = n;
replicationSetMaster(n->ip, n->port);
}
......@@ -2247,7 +2250,6 @@ void clusterCommand(redisClient *c) {
}
/* Set the master. */
server.cluster->myself->flags &= ~REDIS_NODE_PROMOTED;
clusterSetMaster(n);
clusterUpdateState();
clusterSaveConfigOrDie();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册