Commit 04fe000b authored by antirez's avatar antirez
Browse files

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).
parent c6f02fd6
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment