server/modules/monitor LOGIFs and skygw_write_logs removed.
All LOGIFs and skygw_log_writes replaced with MXS_[ERROR| WARNING|NOTICE|INFO|DEBUG] macros.
This commit is contained in:
@ -89,9 +89,7 @@ version()
|
|||||||
void
|
void
|
||||||
ModuleInit()
|
ModuleInit()
|
||||||
{
|
{
|
||||||
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,
|
MXS_NOTICE("Initialise the MySQL Galera Monitor module %s.", version_str);
|
||||||
"Initialise the MySQL Galera Monitor module %s.\n",
|
|
||||||
version_str)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -191,8 +189,8 @@ startMonitor(void *arg, void* opt)
|
|||||||
}
|
}
|
||||||
if (script_error)
|
if (script_error)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Error: Errors were found in the script configuration parameters "
|
MXS_ERROR("Errors were found in the script configuration parameters "
|
||||||
"for the monitor '%s'. The script will not be used.", mon->name);
|
"for the monitor '%s'. The script will not be used.", mon->name);
|
||||||
free(handle->script);
|
free(handle->script);
|
||||||
handle->script = NULL;
|
handle->script = NULL;
|
||||||
}
|
}
|
||||||
@ -338,8 +336,9 @@ monitorDatabase(MONITOR *mon, MONITOR_SERVERS *database)
|
|||||||
if (mysql_field_count(database->con) < 2)
|
if (mysql_field_count(database->con) < 2)
|
||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
skygw_log_write(LE, "Error: Unexpected result for \"SHOW STATUS LIKE 'wsrep_local_state'\". Expected 2 columns."
|
MXS_ERROR("Unexpected result for \"SHOW STATUS LIKE 'wsrep_local_state'\". "
|
||||||
" MySQL Version: %s", version_str);
|
"Expected 2 columns."
|
||||||
|
" MySQL Version: %s", version_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,8 +357,9 @@ monitorDatabase(MONITOR *mon, MONITOR_SERVERS *database)
|
|||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
mysql_free_result(result2);
|
mysql_free_result(result2);
|
||||||
skygw_log_write(LE, "Error: Unexpected result for \"SHOW VARIABLES LIKE 'wsrep_sst_method'\". Expected 2 columns."
|
MXS_ERROR("Unexpected result for \"SHOW VARIABLES LIKE "
|
||||||
" MySQL Version: %s", version_str);
|
"'wsrep_sst_method'\". Expected 2 columns."
|
||||||
|
" MySQL Version: %s", version_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while ((row = mysql_fetch_row(result2)))
|
while ((row = mysql_fetch_row(result2)))
|
||||||
@ -383,8 +383,9 @@ monitorDatabase(MONITOR *mon, MONITOR_SERVERS *database)
|
|||||||
if (mysql_field_count(database->con) < 2)
|
if (mysql_field_count(database->con) < 2)
|
||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
skygw_log_write(LE, "Error: Unexpected result for \"SHOW STATUS LIKE 'wsrep_local_index'\". Expected 2 columns."
|
MXS_ERROR("Unexpected result for \"SHOW STATUS LIKE 'wsrep_local_index'\". "
|
||||||
" MySQL Version: %s", version_str);
|
"Expected 2 columns."
|
||||||
|
" MySQL Version: %s", version_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,9 +436,7 @@ monitorMain(void *arg)
|
|||||||
master_stickiness = handle->disableMasterFailback;
|
master_stickiness = handle->disableMasterFailback;
|
||||||
if (mysql_thread_init())
|
if (mysql_thread_init())
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("mysql_thread_init failed in monitor module. Exiting.");
|
||||||
"Fatal : mysql_thread_init failed in monitor "
|
|
||||||
"module. Exiting.\n")));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handle->status = MONITOR_RUNNING;
|
handle->status = MONITOR_RUNNING;
|
||||||
@ -495,11 +494,10 @@ monitorMain(void *arg)
|
|||||||
/* Log server status change */
|
/* Log server status change */
|
||||||
if (mon_status_changed(ptr))
|
if (mon_status_changed(ptr))
|
||||||
{
|
{
|
||||||
LOGIF(LD, (skygw_log_write_flush(LOGFILE_DEBUG,
|
MXS_DEBUG("Backend server %s:%d state : %s",
|
||||||
"Backend server %s:%d state : %s",
|
ptr->server->name,
|
||||||
ptr->server->name,
|
ptr->server->port,
|
||||||
ptr->server->port,
|
STRSRVSTATUS(ptr->server));
|
||||||
STRSRVSTATUS(ptr->server))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(SERVER_IS_RUNNING(ptr->server)) ||
|
if (!(SERVER_IS_RUNNING(ptr->server)) ||
|
||||||
@ -591,16 +589,14 @@ monitorMain(void *arg)
|
|||||||
|
|
||||||
if (is_cluster == 0 && log_no_members)
|
if (is_cluster == 0 && log_no_members)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("There are no cluster members");
|
||||||
"Error: there are no cluster members")));
|
|
||||||
log_no_members = 0;
|
log_no_members = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (is_cluster > 0 && log_no_members == 0)
|
if (is_cluster > 0 && log_no_members == 0)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_NOTICE("Found cluster members");
|
||||||
"Info: found cluster members")));
|
|
||||||
log_no_members = 1;
|
log_no_members = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -617,10 +613,10 @@ monitorMain(void *arg)
|
|||||||
evtype = mon_get_event_type(ptr);
|
evtype = mon_get_event_type(ptr);
|
||||||
if (isGaleraEvent(evtype))
|
if (isGaleraEvent(evtype))
|
||||||
{
|
{
|
||||||
skygw_log_write(LOGFILE_TRACE, "Server changed state: %s[%s:%u]: %s",
|
MXS_INFO("Server changed state: %s[%s:%u]: %s",
|
||||||
ptr->server->unique_name,
|
ptr->server->unique_name,
|
||||||
ptr->server->name, ptr->server->port,
|
ptr->server->name, ptr->server->port,
|
||||||
mon_get_event_name(ptr));
|
mon_get_event_name(ptr));
|
||||||
if (handle->script && handle->events[evtype])
|
if (handle->script && handle->events[evtype])
|
||||||
{
|
{
|
||||||
monitor_launch_script(mon, ptr, handle->script);
|
monitor_launch_script(mon, ptr, handle->script);
|
||||||
|
@ -77,10 +77,7 @@ version()
|
|||||||
void
|
void
|
||||||
ModuleInit()
|
ModuleInit()
|
||||||
{
|
{
|
||||||
LOGIF(LM, (skygw_log_write(
|
MXS_NOTICE("Initialise the Multi-Master Monitor module %s.", version_str);
|
||||||
LOGFILE_MESSAGE,
|
|
||||||
"Initialise the Multi-Master Monitor module %s.",
|
|
||||||
version_str)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -166,10 +163,10 @@ startMonitor(void *arg, void* opt)
|
|||||||
}
|
}
|
||||||
if (script_error)
|
if (script_error)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Error: Errors were found in the script configuration parameters "
|
MXS_ERROR("Errors were found in the script configuration parameters "
|
||||||
"for the monitor '%s'. The script will not be used.", mon->name);
|
"for the monitor '%s'. The script will not be used.",mon->name);
|
||||||
free(handle->script);
|
free(handle->script);
|
||||||
handle->script = NULL;
|
handle->script = NULL;
|
||||||
}
|
}
|
||||||
/** If no specific events are given, enable them all */
|
/** If no specific events are given, enable them all */
|
||||||
if (!have_events)
|
if (!have_events)
|
||||||
@ -321,8 +318,8 @@ monitorDatabase(MONITOR* mon, MONITOR_SERVERS *database)
|
|||||||
if (mysql_field_count(database->con) != 1)
|
if (mysql_field_count(database->con) != 1)
|
||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
skygw_log_write(LE, "Error: Unexpected result for 'SELECT @@server_id'. Expected 1 column."
|
MXS_ERROR("Unexpected result for 'SELECT @@server_id'. Expected 1 column."
|
||||||
" MySQL Version: %s", version_str);
|
" MySQL Version: %s", version_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,9 +353,9 @@ monitorDatabase(MONITOR* mon, MONITOR_SERVERS *database)
|
|||||||
if (mysql_field_count(database->con) < 42)
|
if (mysql_field_count(database->con) < 42)
|
||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
skygw_log_write(LE, "Error: \"SHOW ALL SLAVES STATUS\" "
|
MXS_ERROR("\"SHOW ALL SLAVES STATUS\" "
|
||||||
"returned less than the expected amount of columns. Expected 42 columns"
|
"returned less than the expected amount of columns. Expected 42 columns"
|
||||||
" MySQL Version: %s", version_str);
|
" MySQL Version: %s", version_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,18 +416,19 @@ monitorDatabase(MONITOR* mon, MONITOR_SERVERS *database)
|
|||||||
{
|
{
|
||||||
if (database->log_version_err)
|
if (database->log_version_err)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Error: \"SHOW SLAVE STATUS\" "
|
MXS_ERROR("\"SHOW SLAVE STATUS\" "
|
||||||
" for versions less than 5.5 does not have master_server_id, "
|
" for versions less than 5.5 does not have master_server_id, "
|
||||||
"replication tree cannot be resolved for server %s."
|
"replication tree cannot be resolved for server %s."
|
||||||
" MySQL Version: %s", database->server->unique_name, version_str);
|
" MySQL Version: %s", database->server->unique_name, version_str);
|
||||||
database->log_version_err = false;
|
database->log_version_err = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Error: \"SHOW SLAVE STATUS\" "
|
MXS_ERROR("\"SHOW SLAVE STATUS\" "
|
||||||
"returned less than the expected amount of columns. Expected 40 columns."
|
"returned less than the expected amount of columns. "
|
||||||
" MySQL Version: %s", version_str);
|
"Expected 40 columns."
|
||||||
|
" MySQL Version: %s", version_str);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -473,8 +471,8 @@ monitorDatabase(MONITOR* mon, MONITOR_SERVERS *database)
|
|||||||
if (mysql_field_count(database->con) < 2)
|
if (mysql_field_count(database->con) < 2)
|
||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
skygw_log_write(LE, "Error: Unexpected result for \"SHOW GLOBAL VARIABLES LIKE 'read_only'\". Expected 2 columns."
|
MXS_ERROR("Unexpected result for \"SHOW GLOBAL VARIABLES LIKE 'read_only'\". "
|
||||||
" MySQL Version: %s", version_str);
|
"Expected 2 columns. MySQL Version: %s", version_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -546,10 +544,8 @@ monitorMain(void *arg)
|
|||||||
|
|
||||||
if (mysql_thread_init())
|
if (mysql_thread_init())
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
MXS_ERROR("Fatal : mysql_thread_init failed in monitor "
|
||||||
LOGFILE_ERROR,
|
"module. Exiting.")));
|
||||||
"Fatal : mysql_thread_init failed in monitor "
|
|
||||||
"module. Exiting.\n")));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -600,12 +596,10 @@ monitorMain(void *arg)
|
|||||||
if (mon_status_changed(ptr) ||
|
if (mon_status_changed(ptr) ||
|
||||||
mon_print_fail_status(ptr))
|
mon_print_fail_status(ptr))
|
||||||
{
|
{
|
||||||
LOGIF(LD, (skygw_log_write_flush(
|
MXS_DEBUG("Backend server %s:%d state : %s",
|
||||||
LOGFILE_DEBUG,
|
ptr->server->name,
|
||||||
"Backend server %s:%d state : %s",
|
ptr->server->port,
|
||||||
ptr->server->name,
|
STRSRVSTATUS(ptr->server));
|
||||||
ptr->server->port,
|
|
||||||
STRSRVSTATUS(ptr->server))));
|
|
||||||
}
|
}
|
||||||
if (SERVER_IS_DOWN(ptr->server))
|
if (SERVER_IS_DOWN(ptr->server))
|
||||||
{
|
{
|
||||||
@ -635,8 +629,9 @@ monitorMain(void *arg)
|
|||||||
if (detect_stale_master && root_master && (!strcmp(ptr->server->name, root_master->server->name) && ptr->server->port == root_master->server->port) && (ptr->server->status & SERVER_MASTER) && !(ptr->pending_status & SERVER_MASTER))
|
if (detect_stale_master && root_master && (!strcmp(ptr->server->name, root_master->server->name) && ptr->server->port == root_master->server->port) && (ptr->server->status & SERVER_MASTER) && !(ptr->pending_status & SERVER_MASTER))
|
||||||
{
|
{
|
||||||
/* in this case server->status will not be updated from pending_status */
|
/* in this case server->status will not be updated from pending_status */
|
||||||
LOGIF(LM, (skygw_log_write_flush(
|
MXS_NOTICE("[mysql_mon]: root server [%s:%i] is no longer Master, let's "
|
||||||
LOGFILE_MESSAGE, "[mysql_mon]: root server [%s:%i] is no longer Master, let's use it again even if it could be a stale master, you have been warned!", ptr->server->name, ptr->server->port)));
|
"use it again even if it could be a stale master, you have "
|
||||||
|
"been warned!", ptr->server->name, ptr->server->port);
|
||||||
/* Set the STALE bit for this server in server struct */
|
/* Set the STALE bit for this server in server struct */
|
||||||
server_set_status(ptr->server, SERVER_STALE_STATUS);
|
server_set_status(ptr->server, SERVER_STALE_STATUS);
|
||||||
}
|
}
|
||||||
@ -657,10 +652,10 @@ monitorMain(void *arg)
|
|||||||
evtype = mon_get_event_type(ptr);
|
evtype = mon_get_event_type(ptr);
|
||||||
if (isMySQLEvent(evtype))
|
if (isMySQLEvent(evtype))
|
||||||
{
|
{
|
||||||
skygw_log_write(LOGFILE_TRACE, "Server changed state: %s[%s:%u]: %s",
|
MXS_INFO("Server changed state: %s[%s:%u]: %s",
|
||||||
ptr->server->unique_name,
|
ptr->server->unique_name,
|
||||||
ptr->server->name, ptr->server->port,
|
ptr->server->name, ptr->server->port,
|
||||||
mon_get_event_name(ptr));
|
mon_get_event_name(ptr));
|
||||||
if (handle->script && handle->events[evtype])
|
if (handle->script && handle->events[evtype])
|
||||||
{
|
{
|
||||||
monitor_launch_script(mon, ptr, handle->script);
|
monitor_launch_script(mon, ptr, handle->script);
|
||||||
|
@ -325,7 +325,7 @@ void monitor_launch_script(MONITOR* mon, MONITOR_SERVERS* ptr, char* script)
|
|||||||
|
|
||||||
if (cmd == NULL)
|
if (cmd == NULL)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Failed to initialize script: %s", script);
|
MXS_ERROR("Failed to initialize script: %s", script);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,10 +335,9 @@ void monitor_launch_script(MONITOR* mon, MONITOR_SERVERS* ptr, char* script)
|
|||||||
|
|
||||||
if (externcmd_execute(cmd))
|
if (externcmd_execute(cmd))
|
||||||
{
|
{
|
||||||
skygw_log_write(LOGFILE_ERROR,
|
MXS_ERROR("Failed to execute script "
|
||||||
"Error: Failed to execute script "
|
"'%s' on server state change event %s.",
|
||||||
"'%s' on server state change event %s.",
|
script, mon_get_event_name(ptr));
|
||||||
script, mon_get_event_name(ptr));
|
|
||||||
}
|
}
|
||||||
externcmd_free(cmd);
|
externcmd_free(cmd);
|
||||||
}
|
}
|
||||||
@ -368,7 +367,7 @@ int mon_parse_event_string(bool* events, size_t count, char* string)
|
|||||||
event = mon_name_to_event(tok);
|
event = mon_name_to_event(tok);
|
||||||
if (event == UNDEFINED_MONITOR_EVENT)
|
if (event == UNDEFINED_MONITOR_EVENT)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Error: Invalid event name %s", tok);
|
MXS_ERROR("Invalid event name %s", tok);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
events[event] = true;
|
events[event] = true;
|
||||||
@ -544,20 +543,18 @@ void mon_log_connect_error(MONITOR_SERVERS* database, connect_result_t rval)
|
|||||||
{
|
{
|
||||||
if (rval == MONITOR_CONN_TIMEOUT)
|
if (rval == MONITOR_CONN_TIMEOUT)
|
||||||
{
|
{
|
||||||
skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("Monitor timed out when connecting to "
|
||||||
"Error : Monitor timed out when connecting to "
|
"server %s:%d : \"%s\"",
|
||||||
"server %s:%d : \"%s\"",
|
database->server->name,
|
||||||
database->server->name,
|
database->server->port,
|
||||||
database->server->port,
|
mysql_error(database->con));
|
||||||
mysql_error(database->con));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("Monitor was unable to connect to "
|
||||||
"Error : Monitor was unable to connect to "
|
"server %s:%d : \"%s\"",
|
||||||
"server %s:%d : \"%s\"",
|
database->server->name,
|
||||||
database->server->name,
|
database->server->port,
|
||||||
database->server->port,
|
mysql_error(database->con));
|
||||||
mysql_error(database->con));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,9 +108,7 @@ version()
|
|||||||
void
|
void
|
||||||
ModuleInit()
|
ModuleInit()
|
||||||
{
|
{
|
||||||
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,
|
MXS_NOTICE("Initialise the MySQL Monitor module %s.", version_str);
|
||||||
"Initialise the MySQL Monitor module %s.",
|
|
||||||
version_str)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,8 +194,8 @@ startMonitor(void *arg, void* opt)
|
|||||||
}
|
}
|
||||||
if (script_error)
|
if (script_error)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Error: Errors were found in the script configuration parameters "
|
MXS_ERROR("Errors were found in the script configuration parameters "
|
||||||
"for the monitor '%s'. The script will not be used.", monitor->name);
|
"for the monitor '%s'. The script will not be used.", monitor->name);
|
||||||
free(handle->script);
|
free(handle->script);
|
||||||
handle->script = NULL;
|
handle->script = NULL;
|
||||||
}
|
}
|
||||||
@ -291,9 +289,9 @@ static inline void monitor_mysql100_db(MONITOR_SERVERS* database)
|
|||||||
if (mysql_field_count(database->con) < 42)
|
if (mysql_field_count(database->con) < 42)
|
||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
skygw_log_write(LE, "Error: \"SHOW ALL SLAVES STATUS\" "
|
MXS_ERROR("\"SHOW ALL SLAVES STATUS\" "
|
||||||
"returned less than the expected amount of columns. Expected 42 columns."
|
"returned less than the expected amount of columns. Expected 42 columns."
|
||||||
" MySQL Version: %s", version_str);
|
" MySQL Version: %s", version_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,9 +371,9 @@ static inline void monitor_mysql55_db(MONITOR_SERVERS* database)
|
|||||||
if (mysql_field_count(database->con) < 40)
|
if (mysql_field_count(database->con) < 40)
|
||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
skygw_log_write(LE, "Error: \"SHOW SLAVE STATUS\" "
|
MXS_ERROR("\"SHOW SLAVE STATUS\" "
|
||||||
"returned less than the expected amount of columns. Expected 40 columns."
|
"returned less than the expected amount of columns. Expected 40 columns."
|
||||||
" MySQL Version: %s", version_str);
|
" MySQL Version: %s", version_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,9 +441,9 @@ static inline void monitor_mysql51_db(MONITOR_SERVERS* database)
|
|||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
|
|
||||||
skygw_log_write(LE, "Error: \"SHOW SLAVE STATUS\" "
|
MXS_ERROR("\"SHOW SLAVE STATUS\" "
|
||||||
"returned less than the expected amount of columns. Expected 38 columns."
|
"returned less than the expected amount of columns. Expected 38 columns."
|
||||||
" MySQL Version: %s", version_str);
|
" MySQL Version: %s", version_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,9 +509,10 @@ static MONITOR_SERVERS *build_mysql51_replication_tree(MONITOR *mon)
|
|||||||
if (mysql_field_count(database->con) < 4)
|
if (mysql_field_count(database->con) < 4)
|
||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
skygw_log_write_flush(LE, "Error: \"SHOW SLAVE HOSTS\" "
|
MXS_ERROR("\"SHOW SLAVE HOSTS\" "
|
||||||
"returned less than the expected amount of columns. Expected 4 columns."
|
"returned less than the expected amount of columns. "
|
||||||
" MySQL Version: %s", version_str);
|
"Expected 4 columns."
|
||||||
|
" MySQL Version: %s", version_str);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,7 +524,7 @@ static MONITOR_SERVERS *build_mysql51_replication_tree(MONITOR *mon)
|
|||||||
/* get Slave_IO_Running and Slave_SQL_Running values*/
|
/* get Slave_IO_Running and Slave_SQL_Running values*/
|
||||||
database->server->slaves[nslaves] = atol(row[0]);
|
database->server->slaves[nslaves] = atol(row[0]);
|
||||||
nslaves++;
|
nslaves++;
|
||||||
LOGIF(LD, (skygw_log_write_flush(LD, "Found slave at %s:%s", row[1], row[2])));
|
MXS_DEBUG("Found slave at %s:%s", row[1], row[2]);
|
||||||
}
|
}
|
||||||
database->server->slaves[nslaves] = 0;
|
database->server->slaves[nslaves] = 0;
|
||||||
}
|
}
|
||||||
@ -537,10 +536,10 @@ static MONITOR_SERVERS *build_mysql51_replication_tree(MONITOR *mon)
|
|||||||
/* Set the Slave Role */
|
/* Set the Slave Role */
|
||||||
if (ismaster)
|
if (ismaster)
|
||||||
{
|
{
|
||||||
LOGIF(LD, (skygw_log_write(LD, "Master server found at %s:%d with %d slaves",
|
MXS_DEBUG("Master server found at %s:%d with %d slaves",
|
||||||
database->server->name,
|
database->server->name,
|
||||||
database->server->port,
|
database->server->port,
|
||||||
nslaves)));
|
nslaves);
|
||||||
monitor_set_pending_status(database, SERVER_MASTER);
|
monitor_set_pending_status(database, SERVER_MASTER);
|
||||||
if (rval == NULL || rval->server->node_id > database->server->node_id)
|
if (rval == NULL || rval->server->node_id > database->server->node_id)
|
||||||
rval = database;
|
rval = database;
|
||||||
@ -676,8 +675,8 @@ monitorDatabase(MONITOR *mon, MONITOR_SERVERS *database)
|
|||||||
if (mysql_field_count(database->con) != 1)
|
if (mysql_field_count(database->con) != 1)
|
||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
skygw_log_write(LE, "Error: Unexpected result for 'SELECT @@server_id'. Expected 1 column."
|
MXS_ERROR("Unexpected result for 'SELECT @@server_id'. Expected 1 column."
|
||||||
" MySQL Version: %s", version_str);
|
" MySQL Version: %s", version_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,9 +711,11 @@ monitorDatabase(MONITOR *mon, MONITOR_SERVERS *database)
|
|||||||
else if (report_version_err)
|
else if (report_version_err)
|
||||||
{
|
{
|
||||||
report_version_err = false;
|
report_version_err = false;
|
||||||
skygw_log_write(LE, "Error: MySQL version is lower than 5.5 and 'mysql51_replication' option is not enabled,"
|
MXS_ERROR("MySQL version is lower than 5.5 and 'mysql51_replication' option is "
|
||||||
" replication tree cannot be resolved. To enable MySQL 5.1 replication detection, "
|
"not enabled,"
|
||||||
"add 'mysql51_replication=true' to the monitor section.");
|
" replication tree cannot be resolved. To enable MySQL 5.1 replication "
|
||||||
|
"detection, "
|
||||||
|
"add 'mysql51_replication=true' to the monitor section.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -747,9 +748,7 @@ monitorMain(void *arg)
|
|||||||
|
|
||||||
if (mysql_thread_init())
|
if (mysql_thread_init())
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("mysql_thread_init failed in monitor module. Exiting.");
|
||||||
"Fatal : mysql_thread_init failed in monitor "
|
|
||||||
"module. Exiting.\n")));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handle->status = MONITOR_RUNNING;
|
handle->status = MONITOR_RUNNING;
|
||||||
@ -817,10 +816,9 @@ monitorMain(void *arg)
|
|||||||
if (SRV_MASTER_STATUS(ptr->mon_prev_status))
|
if (SRV_MASTER_STATUS(ptr->mon_prev_status))
|
||||||
{
|
{
|
||||||
/** Master failed, can't recover */
|
/** Master failed, can't recover */
|
||||||
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,
|
MXS_NOTICE("Server %s:%d lost the master status.",
|
||||||
"Server %s:%d lost the master status.",
|
ptr->server->name,
|
||||||
ptr->server->name,
|
ptr->server->port);
|
||||||
ptr->server->port)));
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Here we say: If the server's state changed
|
* Here we say: If the server's state changed
|
||||||
@ -843,17 +841,15 @@ monitorMain(void *arg)
|
|||||||
if (mon_status_changed(ptr))
|
if (mon_status_changed(ptr))
|
||||||
{
|
{
|
||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
LOGIF(LT, (skygw_log_write_flush(LOGFILE_TRACE,
|
MXS_INFO("Backend server %s:%d state : %s",
|
||||||
"Backend server %s:%d state : %s",
|
ptr->server->name,
|
||||||
ptr->server->name,
|
ptr->server->port,
|
||||||
ptr->server->port,
|
STRSRVSTATUS(ptr->server));
|
||||||
STRSRVSTATUS(ptr->server))));
|
|
||||||
#else
|
#else
|
||||||
LOGIF(LD, (skygw_log_write_flush(LOGFILE_DEBUG,
|
MXS_DEBUG("Backend server %s:%d state : %s",
|
||||||
"Backend server %s:%d state : %s",
|
ptr->server->name,
|
||||||
ptr->server->name,
|
ptr->server->port,
|
||||||
ptr->server->port,
|
STRSRVSTATUS(ptr->server));
|
||||||
STRSRVSTATUS(ptr->server))));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -923,14 +919,13 @@ monitorMain(void *arg)
|
|||||||
/* log it once */
|
/* log it once */
|
||||||
if (mon_status_changed(ptr))
|
if (mon_status_changed(ptr))
|
||||||
{
|
{
|
||||||
LOGIF(LM, (skygw_log_write_flush(LOGFILE_MESSAGE,
|
MXS_NOTICE("[mysql_mon]: root server "
|
||||||
"[mysql_mon]: root server "
|
"[%s:%i] is no longer Master,"
|
||||||
"[%s:%i] is no longer Master,"
|
" let's use it again even "
|
||||||
" let's use it again even "
|
" if it could be a stale master,"
|
||||||
" if it could be a stale master,"
|
" you have been warned!",
|
||||||
" you have been warned!",
|
ptr->server->name,
|
||||||
ptr->server->name,
|
ptr->server->port);
|
||||||
ptr->server->port)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -951,10 +946,10 @@ monitorMain(void *arg)
|
|||||||
evtype = mon_get_event_type(ptr);
|
evtype = mon_get_event_type(ptr);
|
||||||
if (isMySQLEvent(evtype))
|
if (isMySQLEvent(evtype))
|
||||||
{
|
{
|
||||||
skygw_log_write(LOGFILE_TRACE, "Server changed state: %s[%s:%u]: %s",
|
MXS_INFO("Server changed state: %s[%s:%u]: %s",
|
||||||
ptr->server->unique_name,
|
ptr->server->unique_name,
|
||||||
ptr->server->name, ptr->server->port,
|
ptr->server->name, ptr->server->port,
|
||||||
mon_get_event_name(ptr));
|
mon_get_event_name(ptr));
|
||||||
if (handle->script && handle->events[evtype])
|
if (handle->script && handle->events[evtype])
|
||||||
{
|
{
|
||||||
monitor_launch_script(mon, ptr, handle->script);
|
monitor_launch_script(mon, ptr, handle->script);
|
||||||
@ -974,18 +969,16 @@ monitorMain(void *arg)
|
|||||||
if (!(root_master->mon_prev_status & SERVER_STALE_STATUS) &&
|
if (!(root_master->mon_prev_status & SERVER_STALE_STATUS) &&
|
||||||
!(root_master->server->status & SERVER_MAINT))
|
!(root_master->server->status & SERVER_MAINT))
|
||||||
{
|
{
|
||||||
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,
|
MXS_NOTICE("A Master Server is now available: %s:%i",
|
||||||
"Info : A Master Server is now available: %s:%i",
|
root_master->server->name,
|
||||||
root_master->server->name,
|
root_master->server->port);
|
||||||
root_master->server->port)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("No Master can be determined. Last known was %s:%i",
|
||||||
"Error : No Master can be determined. Last known was %s:%i",
|
root_master->server->name,
|
||||||
root_master->server->name,
|
root_master->server->port);
|
||||||
root_master->server->port)));
|
|
||||||
}
|
}
|
||||||
log_no_master = 1;
|
log_no_master = 1;
|
||||||
}
|
}
|
||||||
@ -993,8 +986,7 @@ monitorMain(void *arg)
|
|||||||
{
|
{
|
||||||
if (!root_master && log_no_master)
|
if (!root_master && log_no_master)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("No Master can be determined");
|
||||||
"Error : No Master can be determined")));
|
|
||||||
log_no_master = 0;
|
log_no_master = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1130,17 +1122,15 @@ static void set_master_heartbeat(MYSQL_MONITOR *handle, MONITOR_SERVERS *databas
|
|||||||
|
|
||||||
if (handle->master == NULL)
|
if (handle->master == NULL)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("[mysql_mon]: set_master_heartbeat called without an available Master server");
|
||||||
"[mysql_mon]: set_master_heartbeat called without an available Master server")));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create the maxscale_schema database */
|
/* create the maxscale_schema database */
|
||||||
if (mysql_query(database->con, "CREATE DATABASE IF NOT EXISTS maxscale_schema"))
|
if (mysql_query(database->con, "CREATE DATABASE IF NOT EXISTS maxscale_schema"))
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("[mysql_mon]: Error creating maxscale_schema database in Master server"
|
||||||
"[mysql_mon]: Error creating maxscale_schema database in Master server"
|
": %s", mysql_error(database->con));
|
||||||
": %s", mysql_error(database->con))));
|
|
||||||
|
|
||||||
database->server->rlag = -1;
|
database->server->rlag = -1;
|
||||||
}
|
}
|
||||||
@ -1154,9 +1144,8 @@ static void set_master_heartbeat(MYSQL_MONITOR *handle, MONITOR_SERVERS *databas
|
|||||||
"PRIMARY KEY ( master_server_id, maxscale_id ) ) "
|
"PRIMARY KEY ( master_server_id, maxscale_id ) ) "
|
||||||
"ENGINE=MYISAM DEFAULT CHARSET=latin1"))
|
"ENGINE=MYISAM DEFAULT CHARSET=latin1"))
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("[mysql_mon]: Error creating maxscale_schema.replication_heartbeat "
|
||||||
"[mysql_mon]: Error creating maxscale_schema.replication_heartbeat table in Master server"
|
"table in Master server: %s", mysql_error(database->con));
|
||||||
": %s", mysql_error(database->con))));
|
|
||||||
|
|
||||||
database->server->rlag = -1;
|
database->server->rlag = -1;
|
||||||
}
|
}
|
||||||
@ -1168,10 +1157,10 @@ static void set_master_heartbeat(MYSQL_MONITOR *handle, MONITOR_SERVERS *databas
|
|||||||
|
|
||||||
if (mysql_query(database->con, heartbeat_purge_query))
|
if (mysql_query(database->con, heartbeat_purge_query))
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("[mysql_mon]: Error deleting from maxscale_schema.replication_heartbeat "
|
||||||
"[mysql_mon]: Error deleting from maxscale_schema.replication_heartbeat table: [%s], %s",
|
"table: [%s], %s",
|
||||||
heartbeat_purge_query,
|
heartbeat_purge_query,
|
||||||
mysql_error(database->con))));
|
mysql_error(database->con));
|
||||||
}
|
}
|
||||||
|
|
||||||
heartbeat = time(0);
|
heartbeat = time(0);
|
||||||
@ -1187,10 +1176,9 @@ static void set_master_heartbeat(MYSQL_MONITOR *handle, MONITOR_SERVERS *databas
|
|||||||
|
|
||||||
database->server->rlag = -1;
|
database->server->rlag = -1;
|
||||||
|
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("[mysql_mon]: Error updating maxscale_schema.replication_heartbeat table: [%s], %s",
|
||||||
"[mysql_mon]: Error updating maxscale_schema.replication_heartbeat table: [%s], %s",
|
heartbeat_insert_query,
|
||||||
heartbeat_insert_query,
|
mysql_error(database->con));
|
||||||
mysql_error(database->con))));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1204,18 +1192,18 @@ static void set_master_heartbeat(MYSQL_MONITOR *handle, MONITOR_SERVERS *databas
|
|||||||
|
|
||||||
database->server->rlag = -1;
|
database->server->rlag = -1;
|
||||||
|
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("[mysql_mon]: Error inserting into "
|
||||||
"[mysql_mon]: Error inserting into maxscale_schema.replication_heartbeat table: [%s], %s",
|
"maxscale_schema.replication_heartbeat table: [%s], %s",
|
||||||
heartbeat_insert_query,
|
heartbeat_insert_query,
|
||||||
mysql_error(database->con))));
|
mysql_error(database->con));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Set replication lag to 0 for the master */
|
/* Set replication lag to 0 for the master */
|
||||||
database->server->rlag = 0;
|
database->server->rlag = 0;
|
||||||
|
|
||||||
LOGIF(LD, (skygw_log_write_flush(LOGFILE_DEBUG,
|
MXS_DEBUG("[mysql_mon]: heartbeat table inserted data for %s:%i",
|
||||||
"[mysql_mon]: heartbeat table inserted data for %s:%i", database->server->name, database->server->port)));
|
database->server->name, database->server->port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1223,8 +1211,8 @@ static void set_master_heartbeat(MYSQL_MONITOR *handle, MONITOR_SERVERS *databas
|
|||||||
/* Set replication lag as 0 for the master */
|
/* Set replication lag as 0 for the master */
|
||||||
database->server->rlag = 0;
|
database->server->rlag = 0;
|
||||||
|
|
||||||
LOGIF(LD, (skygw_log_write_flush(LOGFILE_DEBUG,
|
MXS_DEBUG("[mysql_mon]: heartbeat table updated for Master %s:%i",
|
||||||
"[mysql_mon]: heartbeat table updated for Master %s:%i", database->server->name, database->server->port)));
|
database->server->name, database->server->port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1248,8 +1236,7 @@ static void set_slave_heartbeat(MONITOR* mon, MONITOR_SERVERS *database)
|
|||||||
|
|
||||||
if (handle->master == NULL)
|
if (handle->master == NULL)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("[mysql_mon]: set_slave_heartbeat called without an available Master server");
|
||||||
"[mysql_mon]: set_slave_heartbeat called without an available Master server")));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1300,12 +1287,10 @@ static void set_slave_heartbeat(MONITOR* mon, MONITOR_SERVERS *database)
|
|||||||
database->server->rlag = -1;
|
database->server->rlag = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGIF(LD, (skygw_log_write_flush(LOGFILE_DEBUG,
|
MXS_DEBUG("Slave %s:%i has %i seconds lag",
|
||||||
"[mysql_mon]: replication heartbeat: "
|
database->server->name,
|
||||||
"Slave %s:%i has %i seconds lag",
|
database->server->port,
|
||||||
database->server->name,
|
database->server->rlag);
|
||||||
database->server->port,
|
|
||||||
database->server->rlag)));
|
|
||||||
}
|
}
|
||||||
if (!rows_found)
|
if (!rows_found)
|
||||||
{
|
{
|
||||||
@ -1322,21 +1307,19 @@ static void set_slave_heartbeat(MONITOR* mon, MONITOR_SERVERS *database)
|
|||||||
|
|
||||||
if (handle->master->server->node_id < 0)
|
if (handle->master->server->node_id < 0)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("[mysql_mon]: error: replication heartbeat: "
|
||||||
"[mysql_mon]: error: replication heartbeat: "
|
"master_server_id NOT available for %s:%i",
|
||||||
"master_server_id NOT available for %s:%i",
|
database->server->name,
|
||||||
database->server->name,
|
database->server->port);
|
||||||
database->server->port)));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
MXS_ERROR("[mysql_mon]: error: replication heartbeat: "
|
||||||
"[mysql_mon]: error: replication heartbeat: "
|
"failed selecting from hearthbeat table of %s:%i : [%s], %s",
|
||||||
"failed selecting from hearthbeat table of %s:%i : [%s], %s",
|
database->server->name,
|
||||||
database->server->name,
|
database->server->port,
|
||||||
database->server->port,
|
select_heartbeat_query,
|
||||||
select_heartbeat_query,
|
mysql_error(database->con));
|
||||||
mysql_error(database->con))));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1558,9 +1541,9 @@ bool check_replicate_ignore_table(MONITOR_SERVERS* database)
|
|||||||
if (strlen(row[1]) > 0 &&
|
if (strlen(row[1]) > 0 &&
|
||||||
strcasestr(row[1], hb_table_name))
|
strcasestr(row[1], hb_table_name))
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Warning: 'replicate_ignore_table' is "
|
MXS_WARNING("'replicate_ignore_table' is "
|
||||||
"defined on server '%s' and '%s' was found in it. ",
|
"defined on server '%s' and '%s' was found in it. ",
|
||||||
database->server->unique_name, hb_table_name);
|
database->server->unique_name, hb_table_name);
|
||||||
rval = false;
|
rval = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1569,10 +1552,10 @@ bool check_replicate_ignore_table(MONITOR_SERVERS* database)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Error: Failed to query server %s for "
|
MXS_ERROR("Failed to query server %s for "
|
||||||
"'replicate_ignore_table': %s",
|
"'replicate_ignore_table': %s",
|
||||||
database->server->unique_name,
|
database->server->unique_name,
|
||||||
mysql_error(database->con));
|
mysql_error(database->con));
|
||||||
rval = false;
|
rval = false;
|
||||||
}
|
}
|
||||||
return rval;
|
return rval;
|
||||||
@ -1602,9 +1585,9 @@ bool check_replicate_do_table(MONITOR_SERVERS* database)
|
|||||||
if (strlen(row[1]) > 0 &&
|
if (strlen(row[1]) > 0 &&
|
||||||
strcasestr(row[1], hb_table_name) == NULL)
|
strcasestr(row[1], hb_table_name) == NULL)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Warning: 'replicate_do_table' is "
|
MXS_WARNING("'replicate_do_table' is "
|
||||||
"defined on server '%s' and '%s' was not found in it. ",
|
"defined on server '%s' and '%s' was not found in it. ",
|
||||||
database->server->unique_name, hb_table_name);
|
database->server->unique_name, hb_table_name);
|
||||||
rval = false;
|
rval = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1612,10 +1595,10 @@ bool check_replicate_do_table(MONITOR_SERVERS* database)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Error: Failed to query server %s for "
|
MXS_ERROR("Failed to query server %s for "
|
||||||
"'replicate_do_table': %s",
|
"'replicate_do_table': %s",
|
||||||
database->server->unique_name,
|
database->server->unique_name,
|
||||||
mysql_error(database->con));
|
mysql_error(database->con));
|
||||||
rval = false;
|
rval = false;
|
||||||
}
|
}
|
||||||
return rval;
|
return rval;
|
||||||
@ -1647,10 +1630,10 @@ bool check_replicate_wild_do_table(MONITOR_SERVERS* database)
|
|||||||
mxs_pcre2_result_t rc = modutil_mysql_wildcard_match(row[1], hb_table_name);
|
mxs_pcre2_result_t rc = modutil_mysql_wildcard_match(row[1], hb_table_name);
|
||||||
if (rc == MXS_PCRE2_NOMATCH)
|
if (rc == MXS_PCRE2_NOMATCH)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Warning: 'replicate_wild_do_table' is "
|
MXS_WARNING("'replicate_wild_do_table' is "
|
||||||
"defined on server '%s' and '%s' does not match it. ",
|
"defined on server '%s' and '%s' does not match it. ",
|
||||||
database->server->unique_name,
|
database->server->unique_name,
|
||||||
hb_table_name);
|
hb_table_name);
|
||||||
rval = false;
|
rval = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1659,10 +1642,10 @@ bool check_replicate_wild_do_table(MONITOR_SERVERS* database)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Error: Failed to query server %s for "
|
MXS_ERROR("Failed to query server %s for "
|
||||||
"'replicate_wild_do_table': %s",
|
"'replicate_wild_do_table': %s",
|
||||||
database->server->unique_name,
|
database->server->unique_name,
|
||||||
mysql_error(database->con));
|
mysql_error(database->con));
|
||||||
rval = false;
|
rval = false;
|
||||||
}
|
}
|
||||||
return rval;
|
return rval;
|
||||||
@ -1694,10 +1677,10 @@ bool check_replicate_wild_ignore_table(MONITOR_SERVERS* database)
|
|||||||
mxs_pcre2_result_t rc = modutil_mysql_wildcard_match(row[1], hb_table_name);
|
mxs_pcre2_result_t rc = modutil_mysql_wildcard_match(row[1], hb_table_name);
|
||||||
if (rc == MXS_PCRE2_MATCH)
|
if (rc == MXS_PCRE2_MATCH)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Warning: 'replicate_wild_ignore_table' is "
|
MXS_WARNING("'replicate_wild_ignore_table' is "
|
||||||
"defined on server '%s' and '%s' matches it. ",
|
"defined on server '%s' and '%s' matches it. ",
|
||||||
database->server->unique_name,
|
database->server->unique_name,
|
||||||
hb_table_name);
|
hb_table_name);
|
||||||
rval = false;
|
rval = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1706,10 +1689,10 @@ bool check_replicate_wild_ignore_table(MONITOR_SERVERS* database)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Error: Failed to query server %s for "
|
MXS_ERROR("Failed to query server %s for "
|
||||||
"'replicate_wild_do_table': %s",
|
"'replicate_wild_do_table': %s",
|
||||||
database->server->unique_name,
|
database->server->unique_name,
|
||||||
mysql_error(database->con));
|
mysql_error(database->con));
|
||||||
rval = false;
|
rval = false;
|
||||||
}
|
}
|
||||||
return rval;
|
return rval;
|
||||||
@ -1747,8 +1730,8 @@ void check_maxscale_schema_replication(MONITOR *monitor)
|
|||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Warning: Problems were encountered when "
|
MXS_WARNING("Problems were encountered when "
|
||||||
"checking if '%s' is replicated. Make sure that the table is "
|
"checking if '%s' is replicated. Make sure that the table is "
|
||||||
"replicated to all slaves.", hb_table_name);
|
"replicated to all slaves.", hb_table_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,10 +75,7 @@ version()
|
|||||||
void
|
void
|
||||||
ModuleInit()
|
ModuleInit()
|
||||||
{
|
{
|
||||||
LOGIF(LM, (skygw_log_write(
|
MXS_NOTICE("Initialise the MySQL Cluster Monitor module %s.", version_str);
|
||||||
LOGFILE_MESSAGE,
|
|
||||||
"Initialise the MySQL Cluster Monitor module %s.\n",
|
|
||||||
version_str)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,10 +154,10 @@ startMonitor(void *arg, void* opt)
|
|||||||
}
|
}
|
||||||
if (script_error)
|
if (script_error)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE, "Error: Errors were found in the script configuration parameters "
|
MXS_ERROR("Errors were found in the script configuration parameters "
|
||||||
"for the monitor '%s'. The script will not be used.", mon->name);
|
"for the monitor '%s'. The script will not be used.",mon->name);
|
||||||
free(handle->script);
|
free(handle->script);
|
||||||
handle->script = NULL;
|
handle->script = NULL;
|
||||||
}
|
}
|
||||||
/** If no specific events are given, enable them all */
|
/** If no specific events are given, enable them all */
|
||||||
if (!have_events)
|
if (!have_events)
|
||||||
@ -286,8 +283,9 @@ monitorDatabase(MONITOR_SERVERS *database, char *defaultUser, char *defaultPassw
|
|||||||
if (mysql_field_count(database->con) < 2)
|
if (mysql_field_count(database->con) < 2)
|
||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
skygw_log_write(LE, "Error: Unexpected result for \"SHOW STATUS LIKE 'Ndb_number_of_ready_data_nodes'\". Expected 2 columns."
|
MXS_ERROR("Unexpected result for \"SHOW STATUS LIKE "
|
||||||
" MySQL Version: %s", version_str);
|
"'Ndb_number_of_ready_data_nodes'\". Expected 2 columns."
|
||||||
|
" MySQL Version: %s", version_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,8 +304,9 @@ monitorDatabase(MONITOR_SERVERS *database, char *defaultUser, char *defaultPassw
|
|||||||
if (mysql_field_count(database->con) < 2)
|
if (mysql_field_count(database->con) < 2)
|
||||||
{
|
{
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
skygw_log_write(LE, "Error: Unexpected result for \"SHOW STATUS LIKE 'Ndb_cluster_node_id'\". Expected 2 columns."
|
MXS_ERROR("Unexpected result for \"SHOW STATUS LIKE 'Ndb_cluster_node_id'\". "
|
||||||
" MySQL Version: %s", version_str);
|
"Expected 2 columns."
|
||||||
|
" MySQL Version: %s", version_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,10 +355,8 @@ monitorMain(void *arg)
|
|||||||
|
|
||||||
if (mysql_thread_init())
|
if (mysql_thread_init())
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
MXS_ERROR("Fatal : mysql_thread_init failed in monitor "
|
||||||
LOGFILE_ERROR,
|
"module. Exiting.");
|
||||||
"Fatal : mysql_thread_init failed in monitor "
|
|
||||||
"module. Exiting.\n")));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handle->status = MONITOR_RUNNING;
|
handle->status = MONITOR_RUNNING;
|
||||||
@ -400,12 +397,10 @@ monitorMain(void *arg)
|
|||||||
if (ptr->server->status != ptr->mon_prev_status ||
|
if (ptr->server->status != ptr->mon_prev_status ||
|
||||||
SERVER_IS_DOWN(ptr->server))
|
SERVER_IS_DOWN(ptr->server))
|
||||||
{
|
{
|
||||||
LOGIF(LD, (skygw_log_write_flush(
|
MXS_DEBUG("Backend server %s:%d state : %s",
|
||||||
LOGFILE_DEBUG,
|
ptr->server->name,
|
||||||
"Backend server %s:%d state : %s",
|
ptr->server->port,
|
||||||
ptr->server->name,
|
STRSRVSTATUS(ptr->server));
|
||||||
ptr->server->port,
|
|
||||||
STRSRVSTATUS(ptr->server))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
@ -422,10 +417,10 @@ monitorMain(void *arg)
|
|||||||
evtype = mon_get_event_type(ptr);
|
evtype = mon_get_event_type(ptr);
|
||||||
if (isNdbEvent(evtype))
|
if (isNdbEvent(evtype))
|
||||||
{
|
{
|
||||||
skygw_log_write(LOGFILE_TRACE, "Server changed state: %s[%s:%u]: %s",
|
MXS_INFO("Server changed state: %s[%s:%u]: %s",
|
||||||
ptr->server->unique_name,
|
ptr->server->unique_name,
|
||||||
ptr->server->name, ptr->server->port,
|
ptr->server->name, ptr->server->port,
|
||||||
mon_get_event_name(ptr));
|
mon_get_event_name(ptr));
|
||||||
if (handle->script && handle->events[evtype])
|
if (handle->script && handle->events[evtype])
|
||||||
{
|
{
|
||||||
monitor_launch_script(mon, ptr, handle->script);
|
monitor_launch_script(mon, ptr, handle->script);
|
||||||
|
Reference in New Issue
Block a user