Rename MXS_MONITOR_SERVERS to MXS_MONITORED_SERVER

An element in a linked list is not a list.
This commit is contained in:
Johan Wikman
2017-10-02 15:01:56 +03:00
parent 27ccf0877c
commit 8d03876e3e
11 changed files with 144 additions and 144 deletions

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;
@ -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->databases; db; db = db->next)
{
MYSQL_SERVER_INFO *serv_info =
static_cast<MYSQL_SERVER_INFO*>(hashtable_fetch(handle->server_info, db->server->unique_name));
@ -380,7 +380,7 @@ static json_t* diagnostics_json(const MXS_MONITOR *mon)
{
json_t* arr = json_array();
for (MXS_MONITOR_SERVERS *db = mon->databases; db; db = db->next)
for (MXS_MONITORED_SERVER *db = mon->databases; 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->databases;
MXS_MONITORED_SERVER *ptr, *rval = NULL;
int i;
MYSQL_MONITOR *handle = static_cast<MYSQL_MONITOR*>(mon->handle);
@ -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;
@ -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,11 +1786,11 @@ 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;
@ -1816,7 +1816,7 @@ 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;
MXS_MONITORED_SERVER *find_slave;
find_slave = getSlaveOfNodeId(mon->databases, current->node_id);
if (find_slave == NULL)
@ -1863,7 +1863,7 @@ 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);
@ -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->databases;
bool err = false;
while (database)