Add stale journal file detection

Added a configurable maximum age for the mysqlmon journal files. If the
file is older than the configured value, it will be ignored and removed.
This commit is contained in:
Markus Mäkelä
2017-03-17 13:37:37 +02:00
parent 40b5e627a2
commit bbcfe98651
5 changed files with 89 additions and 24 deletions

View File

@ -79,29 +79,39 @@ typedef struct
down before failover is initiated */
bool allow_cluster_recovery; /**< Allow failed servers to rejoin the cluster */
bool warn_failover; /**< Log a warning when failover happens */
bool load_backup; /**< Whether backup file should be loaded */
bool load_journal; /**< Whether journal file should be loaded */
time_t journal_max_age; /**< Maximum age of journal file */
} MYSQL_MONITOR;
/**
* @brief Store a backup of server states
* @brief Store a journal of server states
*
* @param monitor Monitor to backup
* @param monitor Monitor to journal
*/
void store_server_backup(MXS_MONITOR *monitor);
void store_server_journal(MXS_MONITOR *monitor);
/**
* @brief Load a backup of server states
* @brief Load a journal of server states
*
* @param monitor Monitor where backup is loaded
* @param monitor Monitor where journal is loaded
*/
void load_server_backup(MXS_MONITOR *monitor);
void load_server_journal(MXS_MONITOR *monitor);
/**
* @brief Remove stored backup file
* @brief Remove stored journal file
*
* @param monitor Monitor whose backup is removed
* @param monitor Monitor whose journal is removed
*/
void remove_server_backup(MXS_MONITOR *monitor);
void remove_server_journal(MXS_MONITOR *monitor);
/**
* @brief Check whether the journal is too old
*
* @param monitor Monitor to check
* @return True if journal is stale or an error occurred while reading the file.
* False if the file is still valid.
*/
bool journal_is_stale(MXS_MONITOR *monitor, time_t max_age);
MXS_END_DECLS