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

Function sentinelFailoverSwitchToPromotedSlave

src/sentinel.cpp:4963–4972  ·  view source on GitHub ↗

This function is called when the slave is in * SENTINEL_FAILOVER_STATE_UPDATE_CONFIG state. In this state we need * to remove it from the master table and add the promoted slave instead. */

Source from the content-addressed store, hash-verified

4961 * SENTINEL_FAILOVER_STATE_UPDATE_CONFIG state. In this state we need
4962 * to remove it from the master table and add the promoted slave instead. */
4963void sentinelFailoverSwitchToPromotedSlave(sentinelRedisInstance *master) {
4964 sentinelRedisInstance *ref = master->promoted_slave ?
4965 master->promoted_slave : master;
4966
4967 sentinelEvent(LL_WARNING,"+switch-master",master,"%s %s %d %s %d",
4968 master->name, announceSentinelAddr(master->addr), master->addr->port,
4969 announceSentinelAddr(ref->addr), ref->addr->port);
4970
4971 sentinelResetMasterAndChangeAddress(master,ref->addr->hostname,ref->addr->port);
4972}
4973
4974void sentinelFailoverStateMachine(sentinelRedisInstance *ri) {
4975 serverAssert(ri->flags & SRI_MASTER);

Callers 1

Calls 3

sentinelEventFunction · 0.85
announceSentinelAddrFunction · 0.85

Tested by

no test coverage detected