This function is called from the cluster cron function in order to go * forward with a manual failover state machine. */
| 3469 | /* This function is called from the cluster cron function in order to go |
| 3470 | * forward with a manual failover state machine. */ |
| 3471 | void clusterHandleManualFailover(void) { |
| 3472 | /* Return ASAP if no manual failover is in progress. */ |
| 3473 | if (server.cluster->mf_end == 0) return; |
| 3474 | |
| 3475 | /* If mf_can_start is non-zero, the failover was already triggered so the |
| 3476 | * next steps are performed by clusterHandleSlaveFailover(). */ |
| 3477 | if (server.cluster->mf_can_start) return; |
| 3478 | |
| 3479 | if (server.cluster->mf_master_offset == -1) return; /* Wait for offset... */ |
| 3480 | |
| 3481 | if (server.cluster->mf_master_offset == replicationGetSlaveOffset()) { |
| 3482 | /* Our replication offset matches the master replication offset |
| 3483 | * announced after clients were paused. We can start the failover. */ |
| 3484 | server.cluster->mf_can_start = 1; |
| 3485 | serverLog(LL_WARNING, |
| 3486 | "All master replication stream processed, " |
| 3487 | "manual failover can start."); |
| 3488 | clusterDoBeforeSleep(CLUSTER_TODO_HANDLE_FAILOVER); |
| 3489 | return; |
| 3490 | } |
| 3491 | clusterDoBeforeSleep(CLUSTER_TODO_HANDLE_MANUALFAILOVER); |
| 3492 | } |
| 3493 | |
| 3494 | /* ----------------------------------------------------------------------------- |
| 3495 | * CLUSTER cron job |
no test coverage detected