Relay log waiting is part of failover_prepare

Since the servers are not modified before or during the wait, the waiting
can be done in the preparation method. This simplifies the actual failover
somewhat, and allows the monitor to keep running normally while waiting for
the log to clear.
This commit is contained in:
Esa Korhonen
2018-08-28 18:47:38 +03:00
parent 32c4e60516
commit 7cd1cfdb80
5 changed files with 92 additions and 135 deletions

View File

@ -176,13 +176,12 @@ public:
void check_permissions();
/**
* Calculate how many events are left in the relay log of the slave connection to 'master'.
* Calculate how many events are left in the relay log of the slave connection.
*
* @param master The master server from which the slave connection is replicating from
* @return Number of events in relay log according to latest queried info. Negative on error,
* e.g. the slave connection didn't exist.
* @param slave_conn The slave connection to calculate for
* @return Number of events in relay log. Always 0 or greater.
*/
int64_t relay_log_events(const MariaDBServer* master);
uint64_t relay_log_events(const SlaveStatus& slave_conn);
/**
* Execute a query which returns data. The results are returned as a unique pointer to a QueryResult
@ -398,17 +397,6 @@ public:
*/
bool join_cluster(const std::string& change_cmd);
/**
* Waits until this server has processed all its relay log, or time is up.
*
* @param master The master (or relay) whose relay log should be waited on
* @param seconds_remaining Maximum wait time
* @param err_out Error output
* @return True if relay log was processed within time limit, or false if time ran out
* or an error occurred.
*/
bool failover_wait_relay_log(const MariaDBServer* master, int seconds_remaining, json_t** err_out);
/**
* Check if the server can be demoted by switchover.
*