MCPcopy Create free account
hub / github.com/F-Stack/f-stack / clusterRequestFailoverAuth

Function clusterRequestFailoverAuth

app/redis-6.2.6/src/cluster.c:2852–2865  ·  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

2850 * Note that we send the failover request to everybody, master and slave nodes,
2851 * but only the masters are supposed to reply to our query. */
2852void clusterRequestFailoverAuth(void) {
2853 clusterMsg buf[1];
2854 clusterMsg *hdr = (clusterMsg*) buf;
2855 uint32_t totlen;
2856
2857 clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_FAILOVER_AUTH_REQUEST);
2858 /* If this is a manual failover, set the CLUSTERMSG_FLAG0_FORCEACK bit
2859 * in the header to communicate the nodes receiving the message that
2860 * they should authorized the failover even if the master is working. */
2861 if (server.cluster->mf_end) hdr->mflags[0] |= CLUSTERMSG_FLAG0_FORCEACK;
2862 totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData);
2863 hdr->totlen = htonl(totlen);
2864 clusterBroadcastMessage(buf,totlen);
2865}
2866
2867/* Send a FAILOVER_AUTH_ACK message to the specified node. */
2868void clusterSendFailoverAuth(clusterNode *node) {

Callers 1

Calls 2

clusterBuildMessageHdrFunction · 0.85
clusterBroadcastMessageFunction · 0.85

Tested by

no test coverage detected