Merge branch '2.2' of github.com:mariadb-corporation/MaxScale into 2.2

This commit is contained in:
Markus Mäkelä
2017-10-03 14:46:14 +03:00
12 changed files with 187 additions and 187 deletions

View File

@ -44,7 +44,7 @@ typedef struct aurora_monitor
* @param monitor Monitor object
* @param database Server whose status should be updated
*/
void update_server_status(MXS_MONITOR *monitor, MXS_MONITOR_SERVERS *database)
void update_server_status(MXS_MONITOR *monitor, MXS_MONITORED_SERVER *database)
{
if (!SERVER_IN_MAINT(database->server))
{
@ -126,7 +126,7 @@ monitorMain(void *arg)
lock_monitor_servers(monitor);
servers_status_pending_to_current(monitor);
for (MXS_MONITOR_SERVERS *ptr = monitor->databases; ptr; ptr = ptr->next)
for (MXS_MONITORED_SERVER *ptr = monitor->monitored_servers; ptr; ptr = ptr->next)
{
update_server_status(monitor, ptr);

View File

@ -34,8 +34,8 @@ static void *startMonitor(MXS_MONITOR *, const MXS_CONFIG_PARAMETER *params);
static void stopMonitor(MXS_MONITOR *);
static void diagnostics(DCB *, const MXS_MONITOR *);
static json_t* diagnostics_json(const MXS_MONITOR *);
static MXS_MONITOR_SERVERS *get_candidate_master(MXS_MONITOR*);
static MXS_MONITOR_SERVERS *set_cluster_master(MXS_MONITOR_SERVERS *, MXS_MONITOR_SERVERS *, int);
static MXS_MONITORED_SERVER *get_candidate_master(MXS_MONITOR*);
static MXS_MONITORED_SERVER *set_cluster_master(MXS_MONITORED_SERVER *, MXS_MONITORED_SERVER *, int);
static void disableMasterFailback(void *, int);
bool isGaleraEvent(mxs_monitor_event_t event);
static void update_sst_donor_nodes(MXS_MONITOR*, int);
@ -269,7 +269,7 @@ static json_t* diagnostics_json(const MXS_MONITOR *mon)
* @param database The database to probe
*/
static void
monitorDatabase(MXS_MONITOR *mon, MXS_MONITOR_SERVERS *database)
monitorDatabase(MXS_MONITOR *mon, MXS_MONITORED_SERVER *database)
{
GALERA_MONITOR* handle = (GALERA_MONITOR*) mon->handle;
MYSQL_ROW row;
@ -483,9 +483,9 @@ monitorMain(void *arg)
{
GALERA_MONITOR *handle = (GALERA_MONITOR*)arg;
MXS_MONITOR* mon = handle->monitor;
MXS_MONITOR_SERVERS *ptr;
MXS_MONITORED_SERVER *ptr;
size_t nrounds = 0;
MXS_MONITOR_SERVERS *candidate_master = NULL;
MXS_MONITORED_SERVER *candidate_master = NULL;
int master_stickiness;
int is_cluster = 0;
int log_no_members = 1;
@ -534,7 +534,7 @@ monitorMain(void *arg)
lock_monitor_servers(mon);
servers_status_pending_to_current(mon);
ptr = mon->databases;
ptr = mon->monitored_servers;
while (ptr)
{
ptr->mon_prev_status = ptr->server->status;
@ -583,7 +583,7 @@ monitorMain(void *arg)
handle->master = set_cluster_master(handle->master, candidate_master, master_stickiness);
ptr = mon->databases;
ptr = mon->monitored_servers;
while (ptr)
{
@ -666,10 +666,10 @@ monitorMain(void *arg)
* @param servers The monitored servers list
* @return The candidate master on success, NULL on failure
*/
static MXS_MONITOR_SERVERS *get_candidate_master(MXS_MONITOR* mon)
static MXS_MONITORED_SERVER *get_candidate_master(MXS_MONITOR* mon)
{
MXS_MONITOR_SERVERS *moitor_servers = mon->databases;
MXS_MONITOR_SERVERS *candidate_master = NULL;
MXS_MONITORED_SERVER *moitor_servers = mon->monitored_servers;
MXS_MONITORED_SERVER *candidate_master = NULL;
GALERA_MONITOR* handle = mon->handle;
long min_id = -1;
int minval = INT_MAX;
@ -741,8 +741,8 @@ static MXS_MONITOR_SERVERS *get_candidate_master(MXS_MONITOR* mon)
* @param candidate_master The candidate master server accordingly to the selection rule
* @return The master node pointer (could be NULL)
*/
static MXS_MONITOR_SERVERS *set_cluster_master(MXS_MONITOR_SERVERS *current_master,
MXS_MONITOR_SERVERS *candidate_master,
static MXS_MONITORED_SERVER *set_cluster_master(MXS_MONITORED_SERVER *current_master,
MXS_MONITORED_SERVER *candidate_master,
int master_stickiness)
{
/*
@ -791,7 +791,7 @@ static MXS_MONITOR_SERVERS *set_cluster_master(MXS_MONITOR_SERVERS *current_mast
*/
static void update_sst_donor_nodes(MXS_MONITOR *mon, int is_cluster)
{
MXS_MONITOR_SERVERS *ptr;
MXS_MONITORED_SERVER *ptr;
MYSQL_ROW row;
MYSQL_RES *result;
GALERA_MONITOR *handle = mon->handle;
@ -804,7 +804,7 @@ static void update_sst_donor_nodes(MXS_MONITOR *mon, int is_cluster)
}
unsigned int found_slaves = 0;
MXS_MONITOR_SERVERS *node_list[is_cluster - 1];
MXS_MONITORED_SERVER *node_list[is_cluster - 1];
/* Donor list size = DONOR_LIST_SET_VAR + n_hosts * max_host_len + n_hosts + 1 */
char *donor_list = MXS_CALLOC(1, strlen(DONOR_LIST_SET_VAR) +
@ -819,14 +819,14 @@ static void update_sst_donor_nodes(MXS_MONITOR *mon, int is_cluster)
strcpy(donor_list, DONOR_LIST_SET_VAR);
ptr = mon->databases;
ptr = mon->monitored_servers;
/* Create an array of slave nodes */
while (ptr)
{
if (SERVER_IS_JOINED(ptr->server) && SERVER_IS_SLAVE(ptr->server))
{
node_list[found_slaves] = (MXS_MONITOR_SERVERS *)ptr;
node_list[found_slaves] = (MXS_MONITORED_SERVER *)ptr;
found_slaves++;
/* Check the server parameter "priority"
@ -854,13 +854,13 @@ static void update_sst_donor_nodes(MXS_MONITOR *mon, int is_cluster)
/* Sort the array */
qsort(node_list,
found_slaves,
sizeof(MXS_MONITOR_SERVERS *),
sizeof(MXS_MONITORED_SERVER *),
sort_order ? compare_node_priority : compare_node_index);
/* Select nodename from each server and append it to node_list */
for (int k = 0; k < found_slaves; k++)
{
MXS_MONITOR_SERVERS *ptr = node_list[k];
MXS_MONITORED_SERVER *ptr = node_list[k];
/* Get the Galera node name */
if (mxs_mysql_query(ptr->con, "SHOW VARIABLES LIKE 'wsrep_node_name'") == 0
@ -906,7 +906,7 @@ static void update_sst_donor_nodes(MXS_MONITOR *mon, int is_cluster)
/* Set now rep_sst_donor in each slave node */
for (int k = 0; k < found_slaves; k++)
{
MXS_MONITOR_SERVERS *ptr = node_list[k];
MXS_MONITORED_SERVER *ptr = node_list[k];
/* Set the Galera SST donor node list */
if (mxs_mysql_query(ptr->con, donor_list) == 0)
{
@ -937,8 +937,8 @@ static void update_sst_donor_nodes(MXS_MONITOR *mon, int is_cluster)
static int compare_node_index (const void *a, const void *b)
{
const MXS_MONITOR_SERVERS *s_a = *(MXS_MONITOR_SERVERS * const *)a;
const MXS_MONITOR_SERVERS *s_b = *(MXS_MONITOR_SERVERS * const *)b;
const MXS_MONITORED_SERVER *s_a = *(MXS_MONITORED_SERVER * const *)a;
const MXS_MONITORED_SERVER *s_b = *(MXS_MONITORED_SERVER * const *)b;
// Order is DESC: b - a
return s_b->server->node_id - s_a->server->node_id;
@ -965,8 +965,8 @@ static int compare_node_index (const void *a, const void *b)
static int compare_node_priority (const void *a, const void *b)
{
const MXS_MONITOR_SERVERS *s_a = *(MXS_MONITOR_SERVERS * const *)a;
const MXS_MONITOR_SERVERS *s_b = *(MXS_MONITOR_SERVERS * const *)b;
const MXS_MONITORED_SERVER *s_a = *(MXS_MONITORED_SERVER * const *)a;
const MXS_MONITORED_SERVER *s_b = *(MXS_MONITORED_SERVER * const *)b;
const char *pri_a = server_get_parameter(s_a->server, "priority");
const char *pri_b = server_get_parameter(s_b->server, "priority");
@ -1195,11 +1195,11 @@ static void set_cluster_members(MXS_MONITOR *mon)
{
GALERA_MONITOR *handle = mon->handle;
GALERA_NODE_INFO *value;
MXS_MONITOR_SERVERS *ptr;
MXS_MONITORED_SERVER *ptr;
char *c_uuid = handle->cluster_info.c_uuid;
int c_size = handle->cluster_info.c_size;
ptr = mon->databases;
ptr = mon->monitored_servers;
while (ptr)
{
/* Fetch cluster info for this server, if any */

View File

@ -85,7 +85,7 @@ typedef struct
int disableMasterFailback; /**< Monitor flag for Galera Cluster Master failback */
int availableWhenDonor; /**< Monitor flag for Galera Cluster Donor availability */
bool disableMasterRoleSetting; /**< Monitor flag to disable setting master role */
MXS_MONITOR_SERVERS *master; /**< Master server for MySQL Master/Slave replication */
MXS_MONITORED_SERVER *master; /**< Master server for MySQL Master/Slave replication */
char* script;
bool root_node_as_master; /**< Whether we require that the Master should
* have a wsrep_local_index of 0 */

View File

@ -40,12 +40,12 @@ public:
~GRMon();
private:
THREAD m_thread; /**< Monitor thread */
int m_shutdown; /**< Flag to shutdown the monitor thread */
MXS_MONITOR_SERVERS* m_master; /**< The master server */
std::string m_script;
uint64_t m_events; /**< Enabled events */
MXS_MONITOR* m_monitor;
THREAD m_thread; /**< Monitor thread */
int m_shutdown; /**< Flag to shutdown the monitor thread */
MXS_MONITORED_SERVER* m_master; /**< The master server */
std::string m_script;
uint64_t m_events; /**< Enabled events */
MXS_MONITOR* m_monitor;
GRMon(MXS_MONITOR* monitor, const MXS_CONFIG_PARAMETER *params);
@ -148,7 +148,7 @@ static inline bool is_false(const char* value)
strcasecmp(value, "false") == 0;
}
static bool is_master(MXS_MONITOR_SERVERS* server)
static bool is_master(MXS_MONITORED_SERVER* server)
{
bool rval = false;
MYSQL_RES* result;
@ -175,7 +175,7 @@ static bool is_master(MXS_MONITOR_SERVERS* server)
return rval;
}
static bool is_slave(MXS_MONITOR_SERVERS* server)
static bool is_slave(MXS_MONITORED_SERVER* server)
{
bool rval = false;
MYSQL_RES* result;
@ -202,7 +202,7 @@ static bool is_slave(MXS_MONITOR_SERVERS* server)
return rval;
}
static void update_server_status(MXS_MONITOR* monitor, MXS_MONITOR_SERVERS* server)
static void update_server_status(MXS_MONITOR* monitor, MXS_MONITORED_SERVER* server)
{
/* Don't even probe server flagged as in maintenance */
if (SERVER_IN_MAINT(server->server))
@ -273,7 +273,7 @@ void GRMon::main()
lock_monitor_servers(m_monitor);
servers_status_pending_to_current(m_monitor);
for (MXS_MONITOR_SERVERS *ptr = m_monitor->databases; ptr; ptr = ptr->next)
for (MXS_MONITORED_SERVER *ptr = m_monitor->monitored_servers; ptr; ptr = ptr->next)
{
update_server_status(m_monitor, ptr);
}
@ -362,4 +362,4 @@ extern "C"
return &info;
}
}
}

View File

@ -43,7 +43,7 @@ static void stopMonitor(MXS_MONITOR *);
static void diagnostics(DCB *, const MXS_MONITOR *);
static json_t* diagnostics_json(const MXS_MONITOR *);
static void detectStaleMaster(void *, int);
static MXS_MONITOR_SERVERS *get_current_master(MXS_MONITOR *);
static MXS_MONITORED_SERVER *get_current_master(MXS_MONITOR *);
static bool isMySQLEvent(mxs_monitor_event_t event);
/**
@ -203,7 +203,7 @@ static json_t* diagnostics_json(const MXS_MONITOR *mon)
* @param database The database to probe
*/
static void
monitorDatabase(MXS_MONITOR* mon, MXS_MONITOR_SERVERS *database)
monitorDatabase(MXS_MONITOR* mon, MXS_MONITORED_SERVER *database)
{
MYSQL_ROW row;
MYSQL_RES *result;
@ -500,9 +500,9 @@ monitorMain(void *arg)
{
MM_MONITOR *handle = (MM_MONITOR *)arg;
MXS_MONITOR* mon = handle->monitor;
MXS_MONITOR_SERVERS *ptr;
MXS_MONITORED_SERVER *ptr;
int detect_stale_master = false;
MXS_MONITOR_SERVERS *root_master = NULL;
MXS_MONITORED_SERVER *root_master = NULL;
size_t nrounds = 0;
detect_stale_master = handle->detectStaleMaster;
@ -547,7 +547,7 @@ monitorMain(void *arg)
servers_status_pending_to_current(mon);
/* start from the first server in the list */
ptr = mon->databases;
ptr = mon->monitored_servers;
while (ptr)
{
@ -584,7 +584,7 @@ monitorMain(void *arg)
/* Update server status from monitor pending status on that server*/
ptr = mon->databases;
ptr = mon->monitored_servers;
while (ptr)
{
if (!SERVER_IN_MAINT(ptr->server))
@ -651,12 +651,12 @@ detectStaleMaster(void *arg, int enable)
* @return The server at root level with SERVER_MASTER bit
*/
static MXS_MONITOR_SERVERS *get_current_master(MXS_MONITOR *mon)
static MXS_MONITORED_SERVER *get_current_master(MXS_MONITOR *mon)
{
MM_MONITOR* handle = mon->handle;
MXS_MONITOR_SERVERS *ptr;
MXS_MONITORED_SERVER *ptr;
ptr = mon->databases;
ptr = mon->monitored_servers;
while (ptr)
{

View File

@ -45,7 +45,7 @@ typedef struct
int status; /**< Monitor status */
unsigned long id; /**< Monitor ID */
int detectStaleMaster; /**< Monitor flag for Stale Master detection */
MXS_MONITOR_SERVERS *master; /**< Master server for Master/Slave replication */
MXS_MONITORED_SERVER *master; /**< Master server for Master/Slave replication */
char* script; /*< Script to call when state changes occur on servers */
uint64_t events; /*< enabled events */
MXS_MONITOR* monitor;

View File

@ -69,7 +69,7 @@ typedef struct
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_MONITOR_SERVERS *master; /**< Master server for MySQL Master/Slave 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 */

View File

@ -49,11 +49,11 @@ static void *startMonitor(MXS_MONITOR *, const MXS_CONFIG_PARAMETER*);
static void stopMonitor(MXS_MONITOR *);
static void diagnostics(DCB *, const MXS_MONITOR *);
static json_t* diagnostics_json(const MXS_MONITOR *);
static MXS_MONITOR_SERVERS *getServerByNodeId(MXS_MONITOR_SERVERS *, long);
static MXS_MONITOR_SERVERS *getSlaveOfNodeId(MXS_MONITOR_SERVERS *, long);
static MXS_MONITOR_SERVERS *get_replication_tree(MXS_MONITOR *, int);
static void set_master_heartbeat(MYSQL_MONITOR *, MXS_MONITOR_SERVERS *);
static void set_slave_heartbeat(MXS_MONITOR *, MXS_MONITOR_SERVERS *);
static MXS_MONITORED_SERVER *getServerByNodeId(MXS_MONITORED_SERVER *, long);
static MXS_MONITORED_SERVER *getSlaveOfNodeId(MXS_MONITORED_SERVER *, long);
static MXS_MONITORED_SERVER *get_replication_tree(MXS_MONITOR *, int);
static void set_master_heartbeat(MYSQL_MONITOR *, MXS_MONITORED_SERVER *);
static void set_slave_heartbeat(MXS_MONITOR *, MXS_MONITORED_SERVER *);
static int add_slave_to_master(long *, int, long);
static bool isMySQLEvent(mxs_monitor_event_t event);
void check_maxscale_schema_replication(MXS_MONITOR *monitor);
@ -186,7 +186,7 @@ void info_free_func(void *val)
* @return True on success, false if initialization failed. At the moment
* initialization can only fail if memory allocation fails.
*/
bool init_server_info(MYSQL_MONITOR *handle, MXS_MONITOR_SERVERS *database)
bool init_server_info(MYSQL_MONITOR *handle, MXS_MONITORED_SERVER *database)
{
bool rval = true;
@ -275,7 +275,7 @@ startMonitor(MXS_MONITOR *monitor, const MXS_CONFIG_PARAMETER* params)
error = true;
}
if (!init_server_info(handle, monitor->databases))
if (!init_server_info(handle, monitor->monitored_servers))
{
error = true;
}
@ -328,7 +328,7 @@ static void diagnostics(DCB *dcb, const MXS_MONITOR *mon)
dcb_printf(dcb, "Detect Stale Master:\t%s\n", (handle->detectStaleMaster == 1) ? "enabled" : "disabled");
dcb_printf(dcb, "Server information\n\n");
for (MXS_MONITOR_SERVERS *db = mon->databases; db; db = db->next)
for (MXS_MONITORED_SERVER *db = mon->monitored_servers; db; db = db->next)
{
MYSQL_SERVER_INFO *serv_info =
static_cast<MYSQL_SERVER_INFO*>(hashtable_fetch(handle->server_info, db->server->unique_name));
@ -376,11 +376,11 @@ static json_t* diagnostics_json(const MXS_MONITOR *mon)
json_object_set_new(rval, "script", json_string(handle->script));
}
if (mon->databases)
if (mon->monitored_servers)
{
json_t* arr = json_array();
for (MXS_MONITOR_SERVERS *db = mon->databases; db; db = db->next)
for (MXS_MONITORED_SERVER *db = mon->monitored_servers; db; db = db->next)
{
json_t* srv = json_object();
MYSQL_SERVER_INFO *serv_info =
@ -419,7 +419,7 @@ enum mysql_server_version
MYSQL_SERVER_VERSION_51
};
static inline void monitor_mysql_db(MXS_MONITOR_SERVERS* database, MYSQL_SERVER_INFO *serv_info,
static inline void monitor_mysql_db(MXS_MONITORED_SERVER* database, MYSQL_SERVER_INFO *serv_info,
enum mysql_server_version server_version)
{
unsigned int columns;
@ -554,10 +554,10 @@ static inline void monitor_mysql_db(MXS_MONITOR_SERVERS* database, MYSQL_SERVER_
* @param mon Monitor
* @return Lowest server ID master in the monitor
*/
static MXS_MONITOR_SERVERS *build_mysql51_replication_tree(MXS_MONITOR *mon)
static MXS_MONITORED_SERVER *build_mysql51_replication_tree(MXS_MONITOR *mon)
{
MXS_MONITOR_SERVERS* database = mon->databases;
MXS_MONITOR_SERVERS *ptr, *rval = NULL;
MXS_MONITORED_SERVER* database = mon->monitored_servers;
MXS_MONITORED_SERVER *ptr, *rval = NULL;
int i;
MYSQL_MONITOR *handle = static_cast<MYSQL_MONITOR*>(mon->handle);
@ -623,12 +623,12 @@ static MXS_MONITOR_SERVERS *build_mysql51_replication_tree(MXS_MONITOR *mon)
database = database->next;
}
database = mon->databases;
database = mon->monitored_servers;
/** Set master server IDs */
while (database)
{
ptr = mon->databases;
ptr = mon->monitored_servers;
while (ptr)
{
@ -669,7 +669,7 @@ static MXS_MONITOR_SERVERS *build_mysql51_replication_tree(MXS_MONITOR *mon)
* @param database The database to probe
*/
static void
monitorDatabase(MXS_MONITOR *mon, MXS_MONITOR_SERVERS *database)
monitorDatabase(MXS_MONITOR *mon, MXS_MONITORED_SERVER *database)
{
MYSQL_MONITOR* handle = static_cast<MYSQL_MONITOR*>(mon->handle);
MYSQL_ROW row;
@ -830,7 +830,7 @@ struct graph_node
bool active;
struct graph_node *parent;
MYSQL_SERVER_INFO *info;
MXS_MONITOR_SERVERS *db;
MXS_MONITORED_SERVER *db;
};
/**
@ -943,13 +943,13 @@ static void visit_node(struct graph_node *node, struct graph_node **stack,
* member. Nodes in a group get a positive group ID where the nodes not in a
* group get a group ID of 0.
*/
void find_graph_cycles(MYSQL_MONITOR *handle, MXS_MONITOR_SERVERS *database, int nservers)
void find_graph_cycles(MYSQL_MONITOR *handle, MXS_MONITORED_SERVER *database, int nservers)
{
struct graph_node graph[nservers];
struct graph_node *stack[nservers];
int nodes = 0;
for (MXS_MONITOR_SERVERS *db = database; db; db = db->next)
for (MXS_MONITORED_SERVER *db = database; db; db = db->next)
{
graph[nodes].info =
static_cast<MYSQL_SERVER_INFO*>(hashtable_fetch(handle->server_info, db->server->unique_name));
@ -1051,7 +1051,7 @@ void find_graph_cycles(MYSQL_MONITOR *handle, MXS_MONITOR_SERVERS *database, int
*
* @return True if failover is required
*/
bool failover_required(MYSQL_MONITOR *handle, MXS_MONITOR_SERVERS *db)
bool failover_required(MYSQL_MONITOR *handle, MXS_MONITORED_SERVER *db)
{
int candidates = 0;
@ -1091,7 +1091,7 @@ bool failover_required(MYSQL_MONITOR *handle, MXS_MONITOR_SERVERS *db)
* @param handle Monitor instance
* @param db Monitor servers
*/
void do_failover(MYSQL_MONITOR *handle, MXS_MONITOR_SERVERS *db)
void do_failover(MYSQL_MONITOR *handle, MXS_MONITORED_SERVER *db)
{
while (db)
{
@ -1130,11 +1130,11 @@ monitorMain(void *arg)
{
MYSQL_MONITOR *handle = (MYSQL_MONITOR *) arg;
MXS_MONITOR* mon = handle->monitor;
MXS_MONITOR_SERVERS *ptr;
MXS_MONITORED_SERVER *ptr;
int replication_heartbeat;
bool detect_stale_master;
int num_servers = 0;
MXS_MONITOR_SERVERS *root_master = NULL;
MXS_MONITORED_SERVER *root_master = NULL;
size_t nrounds = 0;
int log_no_master = 1;
bool heartbeat_checked = false;
@ -1190,7 +1190,7 @@ monitorMain(void *arg)
servers_status_pending_to_current(mon);
/* start from the first server in the list */
ptr = mon->databases;
ptr = mon->monitored_servers;
while (ptr)
{
@ -1247,7 +1247,7 @@ monitorMain(void *arg)
ptr = ptr->next;
}
ptr = mon->databases;
ptr = mon->monitored_servers;
/* if only one server is configured, that's is Master */
if (num_servers == 1)
{
@ -1283,10 +1283,10 @@ monitorMain(void *arg)
/** Find all the master server cycles in the cluster graph. If
multiple masters are found, the servers with the read_only
variable set to ON will be assigned the slave status. */
find_graph_cycles(handle, mon->databases, num_servers);
find_graph_cycles(handle, mon->monitored_servers, num_servers);
}
ptr = mon->databases;
ptr = mon->monitored_servers;
while (ptr)
{
MYSQL_SERVER_INFO *serv_info =
@ -1295,8 +1295,8 @@ monitorMain(void *arg)
ss_dassert(serv_info);
if (ptr->server->node_id > 0 && ptr->server->master_id > 0 &&
getSlaveOfNodeId(mon->databases, ptr->server->node_id) &&
getServerByNodeId(mon->databases, ptr->server->master_id) &&
getSlaveOfNodeId(mon->monitored_servers, ptr->server->node_id) &&
getServerByNodeId(mon->monitored_servers, ptr->server->master_id) &&
(!handle->multimaster || serv_info->group == 0))
{
/** This server is both a slave and a master i.e. a relay master */
@ -1315,7 +1315,7 @@ monitorMain(void *arg)
/* Update server status from monitor pending status on that server*/
ptr = mon->databases;
ptr = mon->monitored_servers;
while (ptr)
{
if (!SERVER_IN_MAINT(ptr->server))
@ -1401,10 +1401,10 @@ monitorMain(void *arg)
if we need to do a failover */
if (handle->detect_standalone_master)
{
if (failover_required(handle, mon->databases))
if (failover_required(handle, mon->monitored_servers))
{
/** Other servers have died, initiate a failover to the last remaining server */
do_failover(handle, mon->databases);
do_failover(handle, mon->monitored_servers);
}
else
{
@ -1457,7 +1457,7 @@ monitorMain(void *arg)
SERVER_IS_RELAY_SERVER(root_master->server)))
{
set_master_heartbeat(handle, root_master);
ptr = mon->databases;
ptr = mon->monitored_servers;
while (ptr)
{
@ -1494,8 +1494,8 @@ monitorMain(void *arg)
* @param node_id The MySQL server_id to fetch
* @return The server with the required server_id
*/
static MXS_MONITOR_SERVERS *
getServerByNodeId(MXS_MONITOR_SERVERS *ptr, long node_id)
static MXS_MONITORED_SERVER *
getServerByNodeId(MXS_MONITORED_SERVER *ptr, long node_id)
{
SERVER *current;
while (ptr)
@ -1517,8 +1517,8 @@ getServerByNodeId(MXS_MONITOR_SERVERS *ptr, long node_id)
* @param node_id The MySQL server_id to fetch
* @return The slave server of this node_id
*/
static MXS_MONITOR_SERVERS *
getSlaveOfNodeId(MXS_MONITOR_SERVERS *ptr, long node_id)
static MXS_MONITORED_SERVER *
getSlaveOfNodeId(MXS_MONITORED_SERVER *ptr, long node_id)
{
SERVER *current;
while (ptr)
@ -1541,7 +1541,7 @@ getSlaveOfNodeId(MXS_MONITOR_SERVERS *ptr, long node_id)
* @param handle The monitor handle
* @param database The number database server
*/
static void set_master_heartbeat(MYSQL_MONITOR *handle, MXS_MONITOR_SERVERS *database)
static void set_master_heartbeat(MYSQL_MONITOR *handle, MXS_MONITORED_SERVER *database)
{
unsigned long id = handle->id;
time_t heartbeat;
@ -1675,7 +1675,7 @@ static void set_master_heartbeat(MYSQL_MONITOR *handle, MXS_MONITOR_SERVERS *dat
* @param handle The monitor handle
* @param database The number database server
*/
static void set_slave_heartbeat(MXS_MONITOR* mon, MXS_MONITOR_SERVERS *database)
static void set_slave_heartbeat(MXS_MONITOR* mon, MXS_MONITORED_SERVER *database)
{
MYSQL_MONITOR *handle = (MYSQL_MONITOR*) mon->handle;
unsigned long id = handle->id;
@ -1786,17 +1786,17 @@ static void set_slave_heartbeat(MXS_MONITOR* mon, MXS_MONITOR_SERVERS *database)
* @return The server at root level with SERVER_MASTER bit
*/
static MXS_MONITOR_SERVERS *get_replication_tree(MXS_MONITOR *mon, int num_servers)
static MXS_MONITORED_SERVER *get_replication_tree(MXS_MONITOR *mon, int num_servers)
{
MYSQL_MONITOR* handle = (MYSQL_MONITOR*) mon->handle;
MXS_MONITOR_SERVERS *ptr;
MXS_MONITOR_SERVERS *backend;
MXS_MONITORED_SERVER *ptr;
MXS_MONITORED_SERVER *backend;
SERVER *current;
int depth = 0;
long node_id;
int root_level;
ptr = mon->databases;
ptr = mon->monitored_servers;
root_level = num_servers;
while (ptr)
@ -1816,8 +1816,8 @@ static MXS_MONITOR_SERVERS *get_replication_tree(MXS_MONITOR *mon, int num_serve
node_id = current->master_id;
if (node_id < 1)
{
MXS_MONITOR_SERVERS *find_slave;
find_slave = getSlaveOfNodeId(mon->databases, current->node_id);
MXS_MONITORED_SERVER *find_slave;
find_slave = getSlaveOfNodeId(mon->monitored_servers, current->node_id);
if (find_slave == NULL)
{
@ -1844,7 +1844,7 @@ static MXS_MONITOR_SERVERS *get_replication_tree(MXS_MONITOR *mon, int num_serve
root_level = current->depth;
handle->master = ptr;
}
backend = getServerByNodeId(mon->databases, node_id);
backend = getServerByNodeId(mon->monitored_servers, node_id);
if (backend)
{
@ -1863,10 +1863,10 @@ static MXS_MONITOR_SERVERS *get_replication_tree(MXS_MONITOR *mon, int num_serve
}
else
{
MXS_MONITOR_SERVERS *master;
MXS_MONITORED_SERVER *master;
current->depth = depth;
master = getServerByNodeId(mon->databases, current->master_id);
master = getServerByNodeId(mon->monitored_servers, current->master_id);
if (master && master->server && master->server->node_id > 0)
{
add_slave_to_master(master->server->slaves, sizeof(master->server->slaves),
@ -1967,7 +1967,7 @@ static int add_slave_to_master(long *slaves_list, int list_size, long node_id)
* @return False if the table is not replicated or an error occurred when querying
* the server
*/
bool check_replicate_ignore_table(MXS_MONITOR_SERVERS* database)
bool check_replicate_ignore_table(MXS_MONITORED_SERVER* database)
{
MYSQL_RES *result;
bool rval = true;
@ -2011,7 +2011,7 @@ bool check_replicate_ignore_table(MXS_MONITOR_SERVERS* database)
* @return False if the table is not replicated or an error occurred when querying
* the server
*/
bool check_replicate_do_table(MXS_MONITOR_SERVERS* database)
bool check_replicate_do_table(MXS_MONITORED_SERVER* database)
{
MYSQL_RES *result;
bool rval = true;
@ -2054,7 +2054,7 @@ bool check_replicate_do_table(MXS_MONITOR_SERVERS* database)
* @return False if the table is not replicated or an error occurred when trying to
* query the server.
*/
bool check_replicate_wild_do_table(MXS_MONITOR_SERVERS* database)
bool check_replicate_wild_do_table(MXS_MONITORED_SERVER* database)
{
MYSQL_RES *result;
bool rval = true;
@ -2101,7 +2101,7 @@ bool check_replicate_wild_do_table(MXS_MONITOR_SERVERS* database)
* @return False if the table is not replicated or an error occurred when trying to
* query the server.
*/
bool check_replicate_wild_ignore_table(MXS_MONITOR_SERVERS* database)
bool check_replicate_wild_ignore_table(MXS_MONITORED_SERVER* database)
{
MYSQL_RES *result;
bool rval = true;
@ -2148,7 +2148,7 @@ bool check_replicate_wild_ignore_table(MXS_MONITOR_SERVERS* database)
*/
void check_maxscale_schema_replication(MXS_MONITOR *monitor)
{
MXS_MONITOR_SERVERS* database = monitor->databases;
MXS_MONITORED_SERVER* database = monitor->monitored_servers;
bool err = false;
while (database)

View File

@ -188,7 +188,7 @@ static json_t* diagnostics_json(const MXS_MONITOR *mon)
* @param database The database to probe
*/
static void
monitorDatabase(MXS_MONITOR_SERVERS *database, char *defaultUser, char *defaultPasswd, MXS_MONITOR *mon)
monitorDatabase(MXS_MONITORED_SERVER *database, char *defaultUser, char *defaultPasswd, MXS_MONITOR *mon)
{
MYSQL_ROW row;
MYSQL_RES *result;
@ -308,7 +308,7 @@ monitorMain(void *arg)
{
MYSQL_MONITOR *handle = (MYSQL_MONITOR*)arg;
MXS_MONITOR* mon = handle->monitor;
MXS_MONITOR_SERVERS *ptr;
MXS_MONITORED_SERVER *ptr;
size_t nrounds = 0;
if (mysql_thread_init())
@ -350,7 +350,7 @@ monitorMain(void *arg)
lock_monitor_servers(mon);
servers_status_pending_to_current(mon);
ptr = mon->databases;
ptr = mon->monitored_servers;
while (ptr)
{
ptr->mon_prev_status = ptr->server->status;