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. */
| 1651 | * a node that we believed to be a slave is now acting as master in order to |
| 1652 | * update the state of the node. */ |
| 1653 | void clusterSetNodeAsMaster(clusterNode *n) { |
| 1654 | if (nodeIsMaster(n)) return; |
| 1655 | |
| 1656 | if (n->slaveof) { |
| 1657 | clusterNodeRemoveSlave(n->slaveof,n); |
| 1658 | if (n != myself) n->flags |= CLUSTER_NODE_MIGRATE_TO; |
| 1659 | } |
| 1660 | n->flags &= ~CLUSTER_NODE_SLAVE; |
| 1661 | n->flags |= CLUSTER_NODE_MASTER; |
| 1662 | n->slaveof = NULL; |
| 1663 | |
| 1664 | /* Update config and state. */ |
| 1665 | clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG| |
| 1666 | CLUSTER_TODO_UPDATE_STATE); |
| 1667 | } |
| 1668 | |
| 1669 | /* This function is called when we receive a master configuration via a |
| 1670 | * PING, PONG or UPDATE packet. What we receive is a node, a configEpoch of the |
no test coverage detected