| 4800 | } |
| 4801 | |
| 4802 | void sentinelFailoverSendSlaveOfNoOne(sentinelRedisInstance *ri) { |
| 4803 | int retval; |
| 4804 | |
| 4805 | /* We can't send the command to the promoted slave if it is now |
| 4806 | * disconnected. Retry again and again with this state until the timeout |
| 4807 | * is reached, then abort the failover. */ |
| 4808 | if (ri->promoted_slave->link->disconnected) { |
| 4809 | if (mstime() - ri->failover_state_change_time > ri->failover_timeout) { |
| 4810 | sentinelEvent(LL_WARNING,"-failover-abort-slave-timeout",ri,"%@"); |
| 4811 | sentinelAbortFailover(ri); |
| 4812 | } |
| 4813 | return; |
| 4814 | } |
| 4815 | |
| 4816 | /* Send SLAVEOF NO ONE command to turn the slave into a master. |
| 4817 | * We actually register a generic callback for this command as we don't |
| 4818 | * really care about the reply. We check if it worked indirectly observing |
| 4819 | * if INFO returns a different role (master instead of slave). */ |
| 4820 | retval = sentinelSendSlaveOf(ri->promoted_slave,NULL); |
| 4821 | if (retval != C_OK) return; |
| 4822 | sentinelEvent(LL_NOTICE, "+failover-state-wait-promotion", |
| 4823 | ri->promoted_slave,"%@"); |
| 4824 | ri->failover_state = SENTINEL_FAILOVER_STATE_WAIT_PROMOTION; |
| 4825 | ri->failover_state_change_time = mstime(); |
| 4826 | } |
| 4827 | |
| 4828 | /* We actually wait for promotion indirectly checking with INFO when the |
| 4829 | * slave turns into a master. */ |
no test coverage detected