MXS-1703: Turn MariaDB Monitor struct to class with public fields
Allows using std::string for strings. Also, cleanup.
This commit is contained in:
@ -14,61 +14,60 @@
|
||||
*/
|
||||
|
||||
#include <maxscale/cppdefs.hh>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <mysql.h>
|
||||
#include <mysqld_error.h>
|
||||
#include <string>
|
||||
|
||||
#include <maxscale/config.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/hashtable.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/monitor.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/secrets.h>
|
||||
#include <maxscale/thread.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
// MariaDB Monitor instance data
|
||||
struct MYSQL_MONITOR
|
||||
class MYSQL_MONITOR
|
||||
{
|
||||
public:
|
||||
MXS_MONITOR* monitor; /**< Generic monitor object */
|
||||
THREAD thread; /**< Monitor thread */
|
||||
int shutdown; /**< Flag to shutdown the monitor thread */
|
||||
int status; /**< Monitor status */
|
||||
MXS_MONITORED_SERVER *master; /**< Master server for MySQL Master/Slave replication */
|
||||
HASHTABLE *server_info; /**< Contains server specific information */
|
||||
bool warn_set_standalone_master; /**< Log a warning when setting standalone master */
|
||||
unsigned long id; /**< Monitor ID */
|
||||
int replicationHeartbeat; /**< Monitor flag for MySQL replication heartbeat */
|
||||
|
||||
// Values updated by monitor
|
||||
int64_t master_gtid_domain; /**< Gtid domain currently used by the master */
|
||||
string external_master_host; /**< External master host, for fail/switchover */
|
||||
int external_master_port; /**< External master port */
|
||||
|
||||
// Replication topology detection settings
|
||||
bool mysql51_replication; /**< Use MySQL 5.1 replication */
|
||||
bool detectStaleMaster; /**< Monitor flag for MySQL replication Stale Master detection */
|
||||
bool detectStaleSlave; /**< Monitor flag for MySQL replication Stale Master detection */
|
||||
bool multimaster; /**< Detect and handle multi-master topologies */
|
||||
bool ignore_external_masters; /**< Ignore masters outside of the monitor configuration */
|
||||
int disableMasterFailback; /**< Monitor flag for Galera Cluster Master failback */
|
||||
int availableWhenDonor; /**< Monitor flag for Galera Cluster Donor availability */
|
||||
int disableMasterRoleSetting; /**< Monitor flag to disable setting master role */
|
||||
bool mysql51_replication; /**< Use MySQL 5.1 replication */
|
||||
MXS_MONITORED_SERVER *master; /**< Master server for MySQL Master/Slave replication */
|
||||
char* script; /**< Script to call when state changes occur on servers */
|
||||
uint64_t events; /**< enabled events */
|
||||
HASHTABLE *server_info; /**< Contains server specific information */
|
||||
bool detect_standalone_master; /**< If standalone master are detected */
|
||||
int failcount; /**< How many monitoring cycles servers must be
|
||||
down before failover is initiated */
|
||||
bool allow_cluster_recovery; /**< Allow failed servers to rejoin the cluster */
|
||||
bool warn_set_standalone_master; /**< Log a warning when setting standalone master */
|
||||
bool auto_failover; /**< If automatic master failover is enabled */
|
||||
bool replicationHeartbeat; /**< Monitor flag for MySQL replication heartbeat */
|
||||
|
||||
// Failover, switchover and rejoin settings
|
||||
string replication_user; /**< Replication user for CHANGE MASTER TO-commands */
|
||||
string replication_password; /**< Replication password for CHANGE MASTER TO-commands */
|
||||
int failcount; /**< How many monitoring cycles master must be down before auto-failover
|
||||
* begins */
|
||||
uint32_t failover_timeout; /**< Timeout in seconds for the master failover */
|
||||
uint32_t switchover_timeout; /**< Timeout in seconds for the master switchover */
|
||||
char* replication_user; /**< Replication user for failover */
|
||||
char* replication_password; /**< Replication password for failover*/
|
||||
bool verify_master_failure; /**< Whether master failure is verified via slaves */
|
||||
int master_failure_timeout; /**< Time in seconds to wait before doing failover */
|
||||
int64_t master_gtid_domain; /**< Gtid domain currently used by the master */
|
||||
char external_master_host[MAX_SERVER_ADDRESS_LEN]; /**< External master host, for fail/switchover */
|
||||
int external_master_port; /**< External master port */
|
||||
int master_failure_timeout; /**< Master failure verification (via slaves) time in seconds */
|
||||
bool auto_failover; /**< If automatic master failover is enabled */
|
||||
bool auto_rejoin; /**< Attempt to start slave replication on standalone servers or servers
|
||||
replicating from the wrong master. */
|
||||
int n_excluded; /**< Number of excluded servers */
|
||||
* replicating from the wrong master automatically. */
|
||||
MXS_MONITORED_SERVER** excluded_servers; /**< Servers banned for master promotion during auto-failover. */
|
||||
int n_excluded; /**< Number of excluded servers */
|
||||
|
||||
MXS_MONITOR* monitor;
|
||||
// Other settings
|
||||
string script; /**< Script to call when state changes occur on servers */
|
||||
uint64_t events; /**< enabled events */
|
||||
bool allow_cluster_recovery; /**< Allow failed servers to rejoin the cluster */
|
||||
};
|
||||
|
Reference in New Issue
Block a user