MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / clusterRequestFailoverAuth

Function clusterRequestFailoverAuth

src/cluster.cpp:2910–2923  ·  view source on GitHub ↗

This function sends a FAILOVER_AUTH_REQUEST message to every node in order to * see if there is the quorum for this slave instance to failover its failing * master. * * Note that we send the failover request to everybody, master and slave nodes, * but only the masters are supposed to reply to our query. */

Source from the content-addressed store, hash-verified

2908 * Note that we send the failover request to everybody, master and slave nodes,
2909 * but only the masters are supposed to reply to our query. */
2910void clusterRequestFailoverAuth(void) {
2911 clusterMsg buf[1];
2912 clusterMsg *hdr = (clusterMsg*) buf;
2913 uint32_t totlen;
2914
2915 clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_FAILOVER_AUTH_REQUEST);
2916 /* If this is a manual failover, set the CLUSTERMSG_FLAG0_FORCEACK bit
2917 * in the header to communicate the nodes receiving the message that
2918 * they should authorized the failover even if the master is working. */
2919 if (g_pserver->cluster->mf_end) hdr->mflags[0] |= CLUSTERMSG_FLAG0_FORCEACK;
2920 totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData);
2921 hdr->totlen = htonl(totlen);
2922 clusterBroadcastMessage(buf,totlen);
2923}
2924
2925/* Send a FAILOVER_AUTH_ACK message to the specified node. */
2926void clusterSendFailoverAuth(clusterNode *node) {

Callers 1

Calls 2

clusterBuildMessageHdrFunction · 0.85
clusterBroadcastMessageFunction · 0.85

Tested by

no test coverage detected