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

Function sentinelAbortFailover

src/sentinel.cpp:5003–5014  ·  view source on GitHub ↗

Abort a failover in progress: * * This function can only be called before the promoted slave acknowledged * the slave -> master switch. Otherwise the failover can't be aborted and * will reach its end (possibly by timeout). */

Source from the content-addressed store, hash-verified

5001 * the slave -> master switch. Otherwise the failover can't be aborted and
5002 * will reach its end (possibly by timeout). */
5003void sentinelAbortFailover(sentinelRedisInstance *ri) {
5004 serverAssert(ri->flags & SRI_FAILOVER_IN_PROGRESS);
5005 serverAssert(ri->failover_state <= SENTINEL_FAILOVER_STATE_WAIT_PROMOTION);
5006
5007 ri->flags &= ~(SRI_FAILOVER_IN_PROGRESS|SRI_FORCE_FAILOVER);
5008 ri->failover_state = SENTINEL_FAILOVER_STATE_NONE;
5009 ri->failover_state_change_time = mstime();
5010 if (ri->promoted_slave) {
5011 ri->promoted_slave->flags &= ~SRI_PROMOTED;
5012 ri->promoted_slave = NULL;
5013 }
5014}
5015
5016/* ======================== SENTINEL timer handler ==========================
5017 * This is the "main" our Sentinel, being sentinel completely non blocking

Calls 1

mstimeFunction · 0.70

Tested by

no test coverage detected