Cluster: fixed MF condition in clusterHandleSlaveFailover().

For manual failover we need a manual failover in progress, and that
mf_can_start is true (master offset received and matched).
This commit is contained in:
antirez 2014-02-05 16:01:52 +01:00
parent c6f02fd67a
commit 04fe000bf8

View File

@ -2023,6 +2023,8 @@ void clusterHandleSlaveFailover(void) {
mstime_t data_age;
mstime_t auth_age = mstime() - server.cluster->failover_auth_time;
int needed_quorum = (server.cluster->size / 2) + 1;
int manual_failover = server.cluster->mf_end != 0 &&
server.cluster->mf_can_start;
int j;
/* Pre conditions to run the function:
@ -2031,9 +2033,11 @@ void clusterHandleSlaveFailover(void) {
* 3) It is serving slots. */
if (nodeIsMaster(myself) ||
myself->slaveof == NULL ||
(!nodeFailed(myself->slaveof) && server.cluster->mf_end == 0) ||
(!nodeFailed(myself->slaveof) && !manual_failover) ||
myself->slaveof->numslots == 0) return;
/* If this is a manual failover, are we ready to start? */
/* Set data_age to the number of seconds we are disconnected from
* the master. */
if (server.repl_state == REDIS_REPL_CONNECTED) {