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

Function sentinelGetCurrentMasterAddress

app/redis-6.2.6/src/sentinel.c:1695–1709  ·  view source on GitHub ↗

Return the current master address, that is, its address or the address * of the promoted slave if already operational. */

Source from the content-addressed store, hash-verified

1693/* Return the current master address, that is, its address or the address
1694 * of the promoted slave if already operational. */
1695sentinelAddr *sentinelGetCurrentMasterAddress(sentinelRedisInstance *master) {
1696 /* If we are failing over the master, and the state is already
1697 * SENTINEL_FAILOVER_STATE_RECONF_SLAVES or greater, it means that we
1698 * already have the new configuration epoch in the master, and the
1699 * slave acknowledged the configuration switch. Advertise the new
1700 * address. */
1701 if ((master->flags & SRI_FAILOVER_IN_PROGRESS) &&
1702 master->promoted_slave &&
1703 master->failover_state >= SENTINEL_FAILOVER_STATE_RECONF_SLAVES)
1704 {
1705 return master->promoted_slave->addr;
1706 } else {
1707 return master->addr;
1708 }
1709}
1710
1711/* This function sets the down_after_period field value in 'master' to all
1712 * the slaves and sentinel instances connected to this master. */

Callers 3

sentinelSendHelloFunction · 0.85
sentinelCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected