Monitor API 2.0.0 implemented.
This commit is contained in:
@ -49,6 +49,7 @@
|
||||
#include <secrets.h>
|
||||
#include <dcb.h>
|
||||
#include <modinfo.h>
|
||||
#include <maxconfig.h>
|
||||
|
||||
/** Defined in log_manager.cc */
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
@ -66,7 +67,7 @@ MODULE_INFO info = {
|
||||
"A Galera cluster monitor"
|
||||
};
|
||||
|
||||
static void *startMonitor(void *);
|
||||
static void *startMonitor(void *,void*);
|
||||
static void stopMonitor(void *);
|
||||
static void registerServer(void *, SERVER *);
|
||||
static void unregisterServer(void *, SERVER *);
|
||||
@ -88,11 +89,7 @@ static MONITOR_OBJECT MyObject = {
|
||||
defaultUsers,
|
||||
diagnostics,
|
||||
setInterval,
|
||||
setNetworkTimeout,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
disableMasterFailback
|
||||
setNetworkTimeout
|
||||
};
|
||||
|
||||
/**
|
||||
@ -141,10 +138,10 @@ GetModuleObject()
|
||||
* @return A handle to use when interacting with the monitor
|
||||
*/
|
||||
static void *
|
||||
startMonitor(void *arg)
|
||||
startMonitor(void *arg,void* opt)
|
||||
{
|
||||
MYSQL_MONITOR *handle;
|
||||
|
||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
||||
if (arg != NULL)
|
||||
{
|
||||
handle = (MYSQL_MONITOR *)arg;
|
||||
@ -158,7 +155,7 @@ MYSQL_MONITOR *handle;
|
||||
handle->shutdown = 0;
|
||||
handle->defaultUser = NULL;
|
||||
handle->defaultPasswd = NULL;
|
||||
handle->id = MONITOR_DEFAULT_ID;
|
||||
handle->id = config_get_gateway_id();
|
||||
handle->interval = MONITOR_INTERVAL;
|
||||
handle->disableMasterFailback = 0;
|
||||
handle->master = NULL;
|
||||
@ -167,6 +164,15 @@ MYSQL_MONITOR *handle;
|
||||
handle->write_timeout=DEFAULT_WRITE_TIMEOUT;
|
||||
spinlock_init(&handle->lock);
|
||||
}
|
||||
|
||||
|
||||
while(params)
|
||||
{
|
||||
if(!strcmp(params->name,"disable_master_failback"))
|
||||
handle->disableMasterFailback = config_truth_value(params->value);
|
||||
params = params->next;
|
||||
}
|
||||
|
||||
handle->tid = (THREAD)thread_start(monitorMain, handle);
|
||||
return handle;
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
#include <secrets.h>
|
||||
#include <dcb.h>
|
||||
#include <modinfo.h>
|
||||
|
||||
#include <maxconfig.h>
|
||||
/** Defined in log_manager.cc */
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
extern size_t log_ses_count[];
|
||||
@ -58,7 +58,7 @@ MODULE_INFO info = {
|
||||
"A MySQL Multi Master monitor"
|
||||
};
|
||||
|
||||
static void *startMonitor(void *);
|
||||
static void *startMonitor(void *,void*);
|
||||
static void stopMonitor(void *);
|
||||
static void registerServer(void *, SERVER *);
|
||||
static void unregisterServer(void *, SERVER *);
|
||||
@ -79,12 +79,7 @@ static MONITOR_OBJECT MyObject = {
|
||||
unregisterServer,
|
||||
defaultUser,
|
||||
diagnostics,
|
||||
setInterval,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
detectStaleMaster,
|
||||
NULL
|
||||
setInterval
|
||||
};
|
||||
|
||||
/**
|
||||
@ -134,10 +129,10 @@ GetModuleObject()
|
||||
* @return A handle to use when interacting with the monitor
|
||||
*/
|
||||
static void *
|
||||
startMonitor(void *arg)
|
||||
startMonitor(void *arg,void* opt)
|
||||
{
|
||||
MYSQL_MONITOR *handle;
|
||||
|
||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
||||
if (arg)
|
||||
{
|
||||
handle = arg; /* Must be a restart */
|
||||
@ -151,13 +146,21 @@ MYSQL_MONITOR *handle;
|
||||
handle->shutdown = 0;
|
||||
handle->defaultUser = NULL;
|
||||
handle->defaultPasswd = NULL;
|
||||
handle->id = MONITOR_DEFAULT_ID;
|
||||
handle->id = config_get_gateway_id();
|
||||
handle->interval = MONITOR_INTERVAL;
|
||||
handle->replicationHeartbeat = 0;
|
||||
handle->detectStaleMaster = 0;
|
||||
handle->master = NULL;
|
||||
spinlock_init(&handle->lock);
|
||||
}
|
||||
|
||||
while(params)
|
||||
{
|
||||
if(!strcmp(params->name,"detect_stale_master"))
|
||||
handle->detectStaleMaster = config_truth_value(params->value);
|
||||
params = params->next;
|
||||
}
|
||||
|
||||
handle->tid = (THREAD)thread_start(monitorMain, handle);
|
||||
return handle;
|
||||
}
|
||||
|
||||
@ -63,8 +63,7 @@
|
||||
#include <secrets.h>
|
||||
#include <dcb.h>
|
||||
#include <modinfo.h>
|
||||
|
||||
#include "config.h"
|
||||
#include <maxconfig.h>
|
||||
|
||||
/** Defined in log_manager.cc */
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
@ -82,7 +81,7 @@ MODULE_INFO info = {
|
||||
"A MySQL Master/Slave replication monitor"
|
||||
};
|
||||
|
||||
static void *startMonitor(void *);
|
||||
static void *startMonitor(void *,void*);
|
||||
static void stopMonitor(void *);
|
||||
static void registerServer(void *, SERVER *);
|
||||
static void unregisterServer(void *, SERVER *);
|
||||
@ -90,8 +89,6 @@ static void defaultUser(void *, char *, char *);
|
||||
static void diagnostics(DCB *, void *);
|
||||
static void setInterval(void *, size_t);
|
||||
static void defaultId(void *, unsigned long);
|
||||
static void replicationHeartbeat(void *, int);
|
||||
static void detectStaleMaster(void *, int);
|
||||
static void setNetworkTimeout(void *, int, int);
|
||||
static bool mon_status_changed(MONITOR_SERVERS* mon_srv);
|
||||
static bool mon_print_fail_status(MONITOR_SERVERS* mon_srv);
|
||||
@ -112,11 +109,7 @@ static MONITOR_OBJECT MyObject = {
|
||||
defaultUser,
|
||||
diagnostics,
|
||||
setInterval,
|
||||
setNetworkTimeout,
|
||||
defaultId,
|
||||
replicationHeartbeat,
|
||||
detectStaleMaster,
|
||||
NULL
|
||||
setNetworkTimeout
|
||||
};
|
||||
|
||||
/**
|
||||
@ -183,7 +176,7 @@ CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
||||
handle->shutdown = 0;
|
||||
handle->defaultUser = NULL;
|
||||
handle->defaultPasswd = NULL;
|
||||
handle->id = MONITOR_DEFAULT_ID;
|
||||
handle->id = config_get_gateway_id();
|
||||
handle->interval = MONITOR_INTERVAL;
|
||||
handle->replicationHeartbeat = 0;
|
||||
handle->detectStaleMaster = 0;
|
||||
@ -193,6 +186,16 @@ CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
||||
handle->write_timeout=DEFAULT_WRITE_TIMEOUT;
|
||||
spinlock_init(&handle->lock);
|
||||
}
|
||||
|
||||
while(params)
|
||||
{
|
||||
if(!strcmp(params->name,"detect_stale_master"))
|
||||
handle->detectStaleMaster = config_truth_value(params->value);
|
||||
else if(!strcmp(params->name,"detect_replication_lag"))
|
||||
handle->replicationHeartbeat = config_truth_value(params->value);
|
||||
params = params->next;
|
||||
}
|
||||
|
||||
handle->tid = (THREAD)thread_start(monitorMain, handle);
|
||||
return handle;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
#include <secrets.h>
|
||||
#include <dcb.h>
|
||||
#include <modinfo.h>
|
||||
|
||||
#include <maxconfig.h>
|
||||
/** Defined in log_manager.cc */
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
extern size_t log_ses_count[];
|
||||
@ -59,7 +59,7 @@ MODULE_INFO info = {
|
||||
"A MySQL cluster SQL node monitor"
|
||||
};
|
||||
|
||||
static void *startMonitor(void *);
|
||||
static void *startMonitor(void *,void*);
|
||||
static void stopMonitor(void *);
|
||||
static void registerServer(void *, SERVER *);
|
||||
static void unregisterServer(void *, SERVER *);
|
||||
@ -76,11 +76,7 @@ static MONITOR_OBJECT MyObject = {
|
||||
defaultUsers,
|
||||
diagnostics,
|
||||
setInterval,
|
||||
setNetworkTimeout,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
setNetworkTimeout
|
||||
};
|
||||
|
||||
/**
|
||||
@ -129,10 +125,10 @@ GetModuleObject()
|
||||
* @return A handle to use when interacting with the monitor
|
||||
*/
|
||||
static void *
|
||||
startMonitor(void *arg)
|
||||
startMonitor(void *arg,void* opt)
|
||||
{
|
||||
MYSQL_MONITOR *handle;
|
||||
|
||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
|
||||
if (arg != NULL)
|
||||
{
|
||||
handle = (MYSQL_MONITOR *)arg;
|
||||
@ -146,13 +142,14 @@ MYSQL_MONITOR *handle;
|
||||
handle->shutdown = 0;
|
||||
handle->defaultUser = NULL;
|
||||
handle->defaultPasswd = NULL;
|
||||
handle->id = MONITOR_DEFAULT_ID;
|
||||
handle->id = config_get_gateway_id();
|
||||
handle->interval = MONITOR_INTERVAL;
|
||||
handle->connect_timeout=DEFAULT_CONNECT_TIMEOUT;
|
||||
handle->read_timeout=DEFAULT_READ_TIMEOUT;
|
||||
handle->write_timeout=DEFAULT_WRITE_TIMEOUT;
|
||||
spinlock_init(&handle->lock);
|
||||
}
|
||||
|
||||
handle->tid = (THREAD)thread_start(monitorMain, handle);
|
||||
return handle;
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
#include <poll.h>
|
||||
#include <users.h>
|
||||
#include <dbusers.h>
|
||||
#include <config.h>
|
||||
#include <maxconfig.h>
|
||||
#include <telnetd.h>
|
||||
#include <adminusers.h>
|
||||
#include <monitor.h>
|
||||
@ -1195,7 +1195,7 @@ shutdown_monitor(DCB *dcb, MONITOR *monitor)
|
||||
static void
|
||||
restart_monitor(DCB *dcb, MONITOR *monitor)
|
||||
{
|
||||
monitorStart(monitor);
|
||||
monitorStart(monitor, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
#include <skygw_utils.h>
|
||||
#include <log_manager.h>
|
||||
#include <resultset.h>
|
||||
#include <config.h>
|
||||
#include <maxconfig.h>
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
extern size_t log_ses_count[];
|
||||
|
||||
Reference in New Issue
Block a user