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

Function sentinelStartFailover

src/sentinel.cpp:4589–4601  ·  view source on GitHub ↗

Setup the master state to start a failover. */

Source from the content-addressed store, hash-verified

4587
4588/* Setup the master state to start a failover. */
4589void sentinelStartFailover(sentinelRedisInstance *master) {
4590 serverAssert(GlobalLocksAcquired());
4591 serverAssert(master->flags & SRI_MASTER);
4592
4593 master->failover_state = SENTINEL_FAILOVER_STATE_WAIT_START;
4594 master->flags |= SRI_FAILOVER_IN_PROGRESS;
4595 master->failover_epoch = ++sentinel.current_epoch;
4596 sentinelEvent(LL_WARNING,"+new-epoch",master,"%llu",
4597 (unsigned long long) sentinel.current_epoch);
4598 sentinelEvent(LL_WARNING,"+try-failover",master,"%@");
4599 master->failover_start_time = mstime()+rand()%SENTINEL_MAX_DESYNC;
4600 master->failover_state_change_time = mstime();
4601}
4602
4603/* This function checks if there are the conditions to start the failover,
4604 * that is:

Callers 2

sentinelCommandFunction · 0.85

Calls 3

GlobalLocksAcquiredFunction · 0.85
sentinelEventFunction · 0.85
mstimeFunction · 0.70

Tested by

no test coverage detected