Reconfigure the specified node 'n' as a master. This function is called when * a node that we believed to be a slave is now acting as master in order to * update the state of the node. */
| 1606 | * a node that we believed to be a slave is now acting as master in order to |
| 1607 | * update the state of the node. */ |
| 1608 | void clusterSetNodeAsMaster(clusterNode *n) { |
| 1609 | if (nodeIsMaster(n)) return; |
| 1610 | |
| 1611 | if (n->slaveof) { |
| 1612 | clusterNodeRemoveSlave(n->slaveof,n); |
| 1613 | if (n != myself) n->flags |= CLUSTER_NODE_MIGRATE_TO; |
| 1614 | } |
| 1615 | n->flags &= ~CLUSTER_NODE_SLAVE; |
| 1616 | n->flags |= CLUSTER_NODE_MASTER; |
| 1617 | n->slaveof = NULL; |
| 1618 | |
| 1619 | /* Update config and state. */ |
| 1620 | clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG| |
| 1621 | CLUSTER_TODO_UPDATE_STATE); |
| 1622 | } |
| 1623 | |
| 1624 | /* This function is called when we receive a master configuration via a |
| 1625 | * PING, PONG or UPDATE packet. What we receive is a node, a configEpoch of the |
no test coverage detected