Setup the master state to start a failover. */
| 4587 | |
| 4588 | /* Setup the master state to start a failover. */ |
| 4589 | void 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: |
no test coverage detected