Ndbclustermon formatting changes
Fixed indentation, bracket alignment and other minor things.
This commit is contained in:
parent
1bfe85099f
commit
797d9dc03d
@ -33,26 +33,26 @@
|
||||
|
||||
#include <mysqlmon.h>
|
||||
|
||||
static void monitorMain(void *);
|
||||
static void monitorMain(void *);
|
||||
|
||||
static char *version_str = "V2.1.0";
|
||||
|
||||
MODULE_INFO info = {
|
||||
MODULE_API_MONITOR,
|
||||
MODULE_BETA_RELEASE,
|
||||
MONITOR_VERSION,
|
||||
"A MySQL cluster SQL node monitor"
|
||||
MODULE_INFO info = {
|
||||
MODULE_API_MONITOR,
|
||||
MODULE_BETA_RELEASE,
|
||||
MONITOR_VERSION,
|
||||
"A MySQL cluster SQL node monitor"
|
||||
};
|
||||
|
||||
static void *startMonitor(void *,void*);
|
||||
static void stopMonitor(void *);
|
||||
static void diagnostics(DCB *, void *);
|
||||
static void *startMonitor(void *, void*);
|
||||
static void stopMonitor(void *);
|
||||
static void diagnostics(DCB *, void *);
|
||||
bool isNdbEvent(monitor_event_t event);
|
||||
|
||||
static MONITOR_OBJECT MyObject = {
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
static MONITOR_OBJECT MyObject = {
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
};
|
||||
|
||||
/**
|
||||
@ -63,7 +63,7 @@ static MONITOR_OBJECT MyObject = {
|
||||
char *
|
||||
version()
|
||||
{
|
||||
return version_str;
|
||||
return version_str;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,10 +73,10 @@ version()
|
||||
void
|
||||
ModuleInit()
|
||||
{
|
||||
LOGIF(LM, (skygw_log_write(
|
||||
LOGFILE_MESSAGE,
|
||||
"Initialise the MySQL Cluster Monitor module %s.\n",
|
||||
version_str)));
|
||||
LOGIF(LM, (skygw_log_write(
|
||||
LOGFILE_MESSAGE,
|
||||
"Initialise the MySQL Cluster Monitor module %s.\n",
|
||||
version_str)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +90,7 @@ ModuleInit()
|
||||
MONITOR_OBJECT *
|
||||
GetModuleObject()
|
||||
{
|
||||
return &MyObject;
|
||||
return &MyObject;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,65 +100,72 @@ GetModuleObject()
|
||||
*
|
||||
* @return A handle to use when interacting with the monitor
|
||||
*/
|
||||
static void *
|
||||
startMonitor(void *arg,void* opt)
|
||||
static void *
|
||||
startMonitor(void *arg, void* opt)
|
||||
{
|
||||
MONITOR* mon = (MONITOR*)arg;
|
||||
MONITOR* mon = (MONITOR*) arg;
|
||||
MYSQL_MONITOR *handle = mon->handle;
|
||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
||||
bool have_events = false,script_error = false;
|
||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*) opt;
|
||||
bool have_events = false, script_error = false;
|
||||
|
||||
if (handle != NULL)
|
||||
{
|
||||
handle->shutdown = 0;
|
||||
handle->shutdown = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((handle = (MYSQL_MONITOR *)malloc(sizeof(MYSQL_MONITOR))) == NULL)
|
||||
return NULL;
|
||||
handle->shutdown = 0;
|
||||
handle->id = MONITOR_DEFAULT_ID;
|
||||
handle->script = NULL;
|
||||
handle->master = NULL;
|
||||
memset(handle->events,false,sizeof(handle->events));
|
||||
spinlock_init(&handle->lock);
|
||||
}
|
||||
while(params)
|
||||
{
|
||||
if(!strcmp(params->name,"script"))
|
||||
{
|
||||
if (externcmd_can_execute(params->value))
|
||||
if ((handle = (MYSQL_MONITOR *) malloc(sizeof(MYSQL_MONITOR))) == NULL)
|
||||
{
|
||||
free(handle->script);
|
||||
handle->script = strdup(params->value);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
script_error = true;
|
||||
}
|
||||
}
|
||||
else if(!strcmp(params->name,"events"))
|
||||
{
|
||||
if(mon_parse_event_string((bool*)&handle->events,sizeof(handle->events),params->value) != 0)
|
||||
script_error = true;
|
||||
else
|
||||
have_events = true;
|
||||
}
|
||||
params = params->next;
|
||||
handle->shutdown = 0;
|
||||
handle->id = MONITOR_DEFAULT_ID;
|
||||
handle->script = NULL;
|
||||
handle->master = NULL;
|
||||
memset(handle->events, false, sizeof(handle->events));
|
||||
spinlock_init(&handle->lock);
|
||||
}
|
||||
if(script_error)
|
||||
while (params)
|
||||
{
|
||||
skygw_log_write(LE,"Error: Errors were found in the script configuration parameters "
|
||||
"for the monitor '%s'. The script will not be used.",mon->name);
|
||||
free(handle->script);
|
||||
handle->script = NULL;
|
||||
if (!strcmp(params->name, "script"))
|
||||
{
|
||||
if (externcmd_can_execute(params->value))
|
||||
{
|
||||
free(handle->script);
|
||||
handle->script = strdup(params->value);
|
||||
}
|
||||
else
|
||||
{
|
||||
script_error = true;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(params->name, "events"))
|
||||
{
|
||||
if (mon_parse_event_string((bool*) &handle->events,
|
||||
sizeof(handle->events), params->value) != 0)
|
||||
{
|
||||
script_error = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
have_events = true;
|
||||
}
|
||||
}
|
||||
params = params->next;
|
||||
}
|
||||
if (script_error)
|
||||
{
|
||||
skygw_log_write(LE, "Error: Errors were found in the script configuration parameters "
|
||||
"for the monitor '%s'. The script will not be used.", mon->name);
|
||||
free(handle->script);
|
||||
handle->script = NULL;
|
||||
}
|
||||
/** If no specific events are given, enable them all */
|
||||
if(!have_events)
|
||||
if (!have_events)
|
||||
{
|
||||
memset(handle->events,true,sizeof(handle->events));
|
||||
memset(handle->events, true, sizeof(handle->events));
|
||||
}
|
||||
handle->tid = (THREAD)thread_start(monitorMain, mon);
|
||||
handle->tid = (THREAD) thread_start(monitorMain, mon);
|
||||
return handle;
|
||||
}
|
||||
|
||||
@ -167,14 +174,14 @@ startMonitor(void *arg,void* opt)
|
||||
*
|
||||
* @param arg Handle on thr running monior
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
stopMonitor(void *arg)
|
||||
{
|
||||
MONITOR* mon = (MONITOR*)arg;
|
||||
MYSQL_MONITOR *handle = (MYSQL_MONITOR *)mon->handle;
|
||||
MONITOR* mon = (MONITOR*) arg;
|
||||
MYSQL_MONITOR *handle = (MYSQL_MONITOR *) mon->handle;
|
||||
|
||||
handle->shutdown = 1;
|
||||
thread_wait((void *)handle->tid);
|
||||
handle->shutdown = 1;
|
||||
thread_wait((void *) handle->tid);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,38 +194,38 @@ static void
|
||||
diagnostics(DCB *dcb, void *arg)
|
||||
{
|
||||
MONITOR* mon = arg;
|
||||
MYSQL_MONITOR *handle = (MYSQL_MONITOR *)mon->handle;
|
||||
MONITOR_SERVERS *db;
|
||||
char *sep;
|
||||
MYSQL_MONITOR *handle = (MYSQL_MONITOR *) mon->handle;
|
||||
MONITOR_SERVERS *db;
|
||||
char *sep;
|
||||
|
||||
switch (handle->status)
|
||||
{
|
||||
case MONITOR_RUNNING:
|
||||
dcb_printf(dcb, "\tMonitor running\n");
|
||||
break;
|
||||
case MONITOR_STOPPING:
|
||||
dcb_printf(dcb, "\tMonitor stopping\n");
|
||||
break;
|
||||
case MONITOR_STOPPED:
|
||||
dcb_printf(dcb, "\tMonitor stopped\n");
|
||||
break;
|
||||
}
|
||||
switch (handle->status)
|
||||
{
|
||||
case MONITOR_RUNNING:
|
||||
dcb_printf(dcb, "\tMonitor running\n");
|
||||
break;
|
||||
case MONITOR_STOPPING:
|
||||
dcb_printf(dcb, "\tMonitor stopping\n");
|
||||
break;
|
||||
case MONITOR_STOPPED:
|
||||
dcb_printf(dcb, "\tMonitor stopped\n");
|
||||
break;
|
||||
}
|
||||
|
||||
dcb_printf(dcb,"\tSampling interval:\t%lu milliseconds\n", mon->interval);
|
||||
dcb_printf(dcb,"\tConnect Timeout:\t%i seconds\n", mon->connect_timeout);
|
||||
dcb_printf(dcb,"\tRead Timeout:\t\t%i seconds\n", mon->read_timeout);
|
||||
dcb_printf(dcb,"\tWrite Timeout:\t\t%i seconds\n", mon->write_timeout);
|
||||
dcb_printf(dcb, "\tMonitored servers: ");
|
||||
dcb_printf(dcb, "\tSampling interval:\t%lu milliseconds\n", mon->interval);
|
||||
dcb_printf(dcb, "\tConnect Timeout:\t%i seconds\n", mon->connect_timeout);
|
||||
dcb_printf(dcb, "\tRead Timeout:\t\t%i seconds\n", mon->read_timeout);
|
||||
dcb_printf(dcb, "\tWrite Timeout:\t\t%i seconds\n", mon->write_timeout);
|
||||
dcb_printf(dcb, "\tMonitored servers: ");
|
||||
|
||||
db = mon->databases;
|
||||
sep = "";
|
||||
while (db)
|
||||
{
|
||||
dcb_printf(dcb, "%s%s:%d", sep, db->server->name, db->server->port);
|
||||
sep = ", ";
|
||||
db = db->next;
|
||||
}
|
||||
dcb_printf(dcb, "\n");
|
||||
db = mon->databases;
|
||||
sep = "";
|
||||
while (db)
|
||||
{
|
||||
dcb_printf(dcb, "%s%s:%d", sep, db->server->name, db->server->port);
|
||||
sep = ", ";
|
||||
db = db->next;
|
||||
}
|
||||
dcb_printf(dcb, "\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -227,16 +234,18 @@ char *sep;
|
||||
* @param database The database to probe
|
||||
*/
|
||||
static void
|
||||
monitorDatabase(MONITOR_SERVERS *database, char *defaultUser, char *defaultPasswd, MONITOR *mon)
|
||||
monitorDatabase(MONITOR_SERVERS *database, char *defaultUser, char *defaultPasswd, MONITOR *mon)
|
||||
{
|
||||
MYSQL_ROW row;
|
||||
MYSQL_RES *result;
|
||||
int isjoined = 0;
|
||||
char *server_string;
|
||||
MYSQL_ROW row;
|
||||
MYSQL_RES *result;
|
||||
int isjoined = 0;
|
||||
char *server_string;
|
||||
|
||||
/* Don't even probe server flagged as in maintenance */
|
||||
if (SERVER_IN_MAINT(database->server))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
connect_result_t rval = mon_connect_to_db(mon, database);
|
||||
if (rval != MONITOR_CONN_OK)
|
||||
@ -258,69 +267,72 @@ char *server_string;
|
||||
}
|
||||
|
||||
server_clear_status(database->server, SERVER_AUTH_ERROR);
|
||||
/* If we get this far then we have a working connection */
|
||||
server_set_status(database->server, SERVER_RUNNING);
|
||||
/* If we get this far then we have a working connection */
|
||||
server_set_status(database->server, SERVER_RUNNING);
|
||||
|
||||
/* get server version string */
|
||||
server_string = (char *)mysql_get_server_info(database->con);
|
||||
/* get server version string */
|
||||
server_string = (char *) mysql_get_server_info(database->con);
|
||||
if (server_string)
|
||||
{
|
||||
server_set_version_string(database->server, server_string);
|
||||
}
|
||||
|
||||
/* Check if the the SQL node is able to contact one or more data nodes */
|
||||
if (mysql_query(database->con, "SHOW STATUS LIKE 'Ndb_number_of_ready_data_nodes'") == 0
|
||||
&& (result = mysql_store_result(database->con)) != NULL)
|
||||
{
|
||||
if(mysql_field_count(database->con) < 2)
|
||||
{
|
||||
mysql_free_result(result);
|
||||
skygw_log_write(LE,"Error: Unexpected result for \"SHOW STATUS LIKE 'Ndb_number_of_ready_data_nodes'\". Expected 2 columns."
|
||||
" MySQL Version: %s",version_str);
|
||||
return;
|
||||
}
|
||||
/* Check if the the SQL node is able to contact one or more data nodes */
|
||||
if (mysql_query(database->con, "SHOW STATUS LIKE 'Ndb_number_of_ready_data_nodes'") == 0
|
||||
&& (result = mysql_store_result(database->con)) != NULL)
|
||||
{
|
||||
if (mysql_field_count(database->con) < 2)
|
||||
{
|
||||
mysql_free_result(result);
|
||||
skygw_log_write(LE, "Error: Unexpected result for \"SHOW STATUS LIKE 'Ndb_number_of_ready_data_nodes'\". Expected 2 columns."
|
||||
" MySQL Version: %s", version_str);
|
||||
return;
|
||||
}
|
||||
|
||||
while ((row = mysql_fetch_row(result)))
|
||||
{
|
||||
if (atoi(row[1]) > 0)
|
||||
isjoined = 1;
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
while ((row = mysql_fetch_row(result)))
|
||||
{
|
||||
if (atoi(row[1]) > 0)
|
||||
isjoined = 1;
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
/* Check the the SQL node id in the MySQL cluster */
|
||||
if (mysql_query(database->con, "SHOW STATUS LIKE 'Ndb_cluster_node_id'") == 0
|
||||
&& (result = mysql_store_result(database->con)) != NULL)
|
||||
{
|
||||
if(mysql_field_count(database->con) < 2)
|
||||
{
|
||||
mysql_free_result(result);
|
||||
skygw_log_write(LE,"Error: Unexpected result for \"SHOW STATUS LIKE 'Ndb_cluster_node_id'\". Expected 2 columns."
|
||||
" MySQL Version: %s",version_str);
|
||||
return;
|
||||
}
|
||||
/* Check the the SQL node id in the MySQL cluster */
|
||||
if (mysql_query(database->con, "SHOW STATUS LIKE 'Ndb_cluster_node_id'") == 0
|
||||
&& (result = mysql_store_result(database->con)) != NULL)
|
||||
{
|
||||
if (mysql_field_count(database->con) < 2)
|
||||
{
|
||||
mysql_free_result(result);
|
||||
skygw_log_write(LE, "Error: Unexpected result for \"SHOW STATUS LIKE 'Ndb_cluster_node_id'\". Expected 2 columns."
|
||||
" MySQL Version: %s", version_str);
|
||||
return;
|
||||
}
|
||||
|
||||
long cluster_node_id = -1;
|
||||
while ((row = mysql_fetch_row(result)))
|
||||
{
|
||||
cluster_node_id = strtol(row[1], NULL, 10);
|
||||
if ((errno == ERANGE && (cluster_node_id == LONG_MAX
|
||||
|| cluster_node_id == LONG_MIN)) || (errno != 0 && cluster_node_id == 0))
|
||||
{
|
||||
cluster_node_id = -1;
|
||||
}
|
||||
database->server->node_id = cluster_node_id;
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
long cluster_node_id = -1;
|
||||
while ((row = mysql_fetch_row(result)))
|
||||
{
|
||||
cluster_node_id = strtol(row[1], NULL, 10);
|
||||
if ((errno == ERANGE && (cluster_node_id == LONG_MAX
|
||||
|| cluster_node_id == LONG_MIN)) || (errno != 0 && cluster_node_id == 0))
|
||||
{
|
||||
cluster_node_id = -1;
|
||||
}
|
||||
database->server->node_id = cluster_node_id;
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
if (isjoined) {
|
||||
server_set_status(database->server, SERVER_NDB);
|
||||
database->server->depth = 0;
|
||||
} else {
|
||||
server_clear_status(database->server, SERVER_NDB);
|
||||
database->server->depth = -1;
|
||||
}
|
||||
if (isjoined)
|
||||
{
|
||||
server_set_status(database->server, SERVER_NDB);
|
||||
database->server->depth = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
server_clear_status(database->server, SERVER_NDB);
|
||||
database->server->depth = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -332,114 +344,114 @@ static void
|
||||
monitorMain(void *arg)
|
||||
{
|
||||
MONITOR* mon = arg;
|
||||
MYSQL_MONITOR *handle;
|
||||
MONITOR_SERVERS *ptr;
|
||||
size_t nrounds = 0;
|
||||
MYSQL_MONITOR *handle;
|
||||
MONITOR_SERVERS *ptr;
|
||||
size_t nrounds = 0;
|
||||
|
||||
spinlock_acquire(&mon->lock);
|
||||
handle = (MYSQL_MONITOR *)mon->handle;
|
||||
spinlock_release(&mon->lock);
|
||||
spinlock_acquire(&mon->lock);
|
||||
handle = (MYSQL_MONITOR *) mon->handle;
|
||||
spinlock_release(&mon->lock);
|
||||
|
||||
if (mysql_thread_init())
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Fatal : mysql_thread_init failed in monitor "
|
||||
"module. Exiting.\n")));
|
||||
return;
|
||||
}
|
||||
handle->status = MONITOR_RUNNING;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (handle->shutdown)
|
||||
{
|
||||
handle->status = MONITOR_STOPPING;
|
||||
mysql_thread_end();
|
||||
handle->status = MONITOR_STOPPED;
|
||||
return;
|
||||
}
|
||||
if (mysql_thread_init())
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Fatal : mysql_thread_init failed in monitor "
|
||||
"module. Exiting.\n")));
|
||||
return;
|
||||
}
|
||||
handle->status = MONITOR_RUNNING;
|
||||
|
||||
/** Wait base interval */
|
||||
thread_millisleep(MON_BASE_INTERVAL_MS);
|
||||
/**
|
||||
* Calculate how far away the monitor interval is from its full
|
||||
* cycle and if monitor interval time further than the base
|
||||
* interval, then skip monitoring checks. Excluding the first
|
||||
* round.
|
||||
*/
|
||||
if (nrounds != 0 &&
|
||||
((nrounds*MON_BASE_INTERVAL_MS)%mon->interval) >=
|
||||
MON_BASE_INTERVAL_MS)
|
||||
{
|
||||
nrounds += 1;
|
||||
continue;
|
||||
}
|
||||
nrounds += 1;
|
||||
ptr = mon->databases;
|
||||
while (1)
|
||||
{
|
||||
if (handle->shutdown)
|
||||
{
|
||||
handle->status = MONITOR_STOPPING;
|
||||
mysql_thread_end();
|
||||
handle->status = MONITOR_STOPPED;
|
||||
return;
|
||||
}
|
||||
|
||||
while (ptr)
|
||||
{
|
||||
ptr->mon_prev_status = ptr->server->status;
|
||||
monitorDatabase(ptr, mon->user, mon->password,mon);
|
||||
/** Wait base interval */
|
||||
thread_millisleep(MON_BASE_INTERVAL_MS);
|
||||
/**
|
||||
* Calculate how far away the monitor interval is from its full
|
||||
* cycle and if monitor interval time further than the base
|
||||
* interval, then skip monitoring checks. Excluding the first
|
||||
* round.
|
||||
*/
|
||||
if (nrounds != 0 &&
|
||||
((nrounds * MON_BASE_INTERVAL_MS) % mon->interval) >=
|
||||
MON_BASE_INTERVAL_MS)
|
||||
{
|
||||
nrounds += 1;
|
||||
continue;
|
||||
}
|
||||
nrounds += 1;
|
||||
ptr = mon->databases;
|
||||
|
||||
if (ptr->server->status != ptr->mon_prev_status ||
|
||||
SERVER_IS_DOWN(ptr->server))
|
||||
{
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"Backend server %s:%d state : %s",
|
||||
ptr->server->name,
|
||||
ptr->server->port,
|
||||
STRSRVSTATUS(ptr->server))));
|
||||
}
|
||||
while (ptr)
|
||||
{
|
||||
ptr->mon_prev_status = ptr->server->status;
|
||||
monitorDatabase(ptr, mon->user, mon->password, mon);
|
||||
|
||||
ptr = ptr->next;
|
||||
}
|
||||
if (ptr->server->status != ptr->mon_prev_status ||
|
||||
SERVER_IS_DOWN(ptr->server))
|
||||
{
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"Backend server %s:%d state : %s",
|
||||
ptr->server->name,
|
||||
ptr->server->port,
|
||||
STRSRVSTATUS(ptr->server))));
|
||||
}
|
||||
|
||||
ptr = mon->databases;
|
||||
monitor_event_t evtype;
|
||||
ptr = ptr->next;
|
||||
}
|
||||
|
||||
while(ptr)
|
||||
{
|
||||
/** Execute monitor script if a server state has changed */
|
||||
if(mon_status_changed(ptr))
|
||||
{
|
||||
evtype = mon_get_event_type(ptr);
|
||||
if(isNdbEvent(evtype))
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE,"Server changed state: %s[%s:%u]: %s",
|
||||
ptr->server->unique_name,
|
||||
ptr->server->name,ptr->server->port,
|
||||
mon_get_event_name(ptr));
|
||||
if(handle->script && handle->events[evtype])
|
||||
{
|
||||
monitor_launch_script(mon,ptr,handle->script);
|
||||
}
|
||||
}
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
}
|
||||
ptr = mon->databases;
|
||||
monitor_event_t evtype;
|
||||
|
||||
while (ptr)
|
||||
{
|
||||
/** Execute monitor script if a server state has changed */
|
||||
if (mon_status_changed(ptr))
|
||||
{
|
||||
evtype = mon_get_event_type(ptr);
|
||||
if (isNdbEvent(evtype))
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE, "Server changed state: %s[%s:%u]: %s",
|
||||
ptr->server->unique_name,
|
||||
ptr->server->name, ptr->server->port,
|
||||
mon_get_event_name(ptr));
|
||||
if (handle->script && handle->events[evtype])
|
||||
{
|
||||
monitor_launch_script(mon, ptr, handle->script);
|
||||
}
|
||||
}
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static monitor_event_t ndb_events[] = {
|
||||
MASTER_DOWN_EVENT,
|
||||
MASTER_UP_EVENT,
|
||||
SLAVE_DOWN_EVENT,
|
||||
SLAVE_UP_EVENT,
|
||||
SERVER_DOWN_EVENT,
|
||||
SERVER_UP_EVENT,
|
||||
NDB_UP_EVENT,
|
||||
NDB_DOWN_EVENT,
|
||||
LOST_MASTER_EVENT,
|
||||
LOST_SLAVE_EVENT,
|
||||
LOST_NDB_EVENT,
|
||||
NEW_MASTER_EVENT,
|
||||
NEW_SLAVE_EVENT,
|
||||
NEW_NDB_EVENT,
|
||||
MAX_MONITOR_EVENT
|
||||
MASTER_DOWN_EVENT,
|
||||
MASTER_UP_EVENT,
|
||||
SLAVE_DOWN_EVENT,
|
||||
SLAVE_UP_EVENT,
|
||||
SERVER_DOWN_EVENT,
|
||||
SERVER_UP_EVENT,
|
||||
NDB_UP_EVENT,
|
||||
NDB_DOWN_EVENT,
|
||||
LOST_MASTER_EVENT,
|
||||
LOST_SLAVE_EVENT,
|
||||
LOST_NDB_EVENT,
|
||||
NEW_MASTER_EVENT,
|
||||
NEW_SLAVE_EVENT,
|
||||
NEW_NDB_EVENT,
|
||||
MAX_MONITOR_EVENT
|
||||
};
|
||||
|
||||
/**
|
||||
@ -450,10 +462,10 @@ static monitor_event_t ndb_events[] = {
|
||||
bool isNdbEvent(monitor_event_t event)
|
||||
{
|
||||
int i;
|
||||
for(i = 0;ndb_events[i] != MAX_MONITOR_EVENT;i++)
|
||||
for (i = 0; ndb_events[i] != MAX_MONITOR_EVENT; i++)
|
||||
{
|
||||
if(event == ndb_events[i])
|
||||
return true;
|
||||
if (event == ndb_events[i])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user