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

Function sentinelFailoverSelectSlave

src/sentinel.cpp:4782–4800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4780}
4781
4782void sentinelFailoverSelectSlave(sentinelRedisInstance *ri) {
4783 serverAssert(GlobalLocksAcquired());
4784 sentinelRedisInstance *slave = sentinelSelectSlave(ri);
4785
4786 /* We don't handle the timeout in this state as the function aborts
4787 * the failover or go forward in the next state. */
4788 if (slave == NULL) {
4789 sentinelEvent(LL_WARNING,"-failover-abort-no-good-slave",ri,"%@");
4790 sentinelAbortFailover(ri);
4791 } else {
4792 sentinelEvent(LL_WARNING,"+selected-slave",slave,"%@");
4793 slave->flags |= SRI_PROMOTED;
4794 ri->promoted_slave = slave;
4795 ri->failover_state = SENTINEL_FAILOVER_STATE_SEND_SLAVEOF_NOONE;
4796 ri->failover_state_change_time = mstime();
4797 sentinelEvent(LL_NOTICE,"+failover-state-send-slaveof-noone",
4798 slave, "%@");
4799 }
4800}
4801
4802void sentinelFailoverSendSlaveOfNoOne(sentinelRedisInstance *ri) {
4803 int retval;

Callers 1

Calls 5

GlobalLocksAcquiredFunction · 0.85
sentinelSelectSlaveFunction · 0.85
sentinelEventFunction · 0.85
sentinelAbortFailoverFunction · 0.85
mstimeFunction · 0.70

Tested by

no test coverage detected