Cluster: flush importing/migrating state when master is turned into slave.
This commit is contained in:
parent
2e8e0ad44e
commit
8287945ff8
@ -2897,8 +2897,8 @@ int verifyClusterConfigWithData(void) {
|
|||||||
* SLAVE nodes handling
|
* SLAVE nodes handling
|
||||||
* -------------------------------------------------------------------------- */
|
* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Set the specified node 'n' as master. Setup the node as a slave if
|
/* Set the specified node 'n' as master for this node.
|
||||||
* needed. */
|
* If this node is currently a master, it is turned into a slave. */
|
||||||
void clusterSetMaster(clusterNode *n) {
|
void clusterSetMaster(clusterNode *n) {
|
||||||
redisAssert(n != myself);
|
redisAssert(n != myself);
|
||||||
redisAssert(myself->numslots == 0);
|
redisAssert(myself->numslots == 0);
|
||||||
@ -2906,6 +2906,7 @@ void clusterSetMaster(clusterNode *n) {
|
|||||||
if (nodeIsMaster(myself)) {
|
if (nodeIsMaster(myself)) {
|
||||||
myself->flags &= ~REDIS_NODE_MASTER;
|
myself->flags &= ~REDIS_NODE_MASTER;
|
||||||
myself->flags |= REDIS_NODE_SLAVE;
|
myself->flags |= REDIS_NODE_SLAVE;
|
||||||
|
clusterCloseAllSlots();
|
||||||
} else {
|
} else {
|
||||||
if (myself->slaveof)
|
if (myself->slaveof)
|
||||||
clusterNodeRemoveSlave(myself->slaveof,myself);
|
clusterNodeRemoveSlave(myself->slaveof,myself);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user