diff --git a/server/modules/monitor/mariadbmon/mariadbmon.cc b/server/modules/monitor/mariadbmon/mariadbmon.cc index a0597f153..d73bf4603 100644 --- a/server/modules/monitor/mariadbmon/mariadbmon.cc +++ b/server/modules/monitor/mariadbmon/mariadbmon.cc @@ -17,7 +17,7 @@ #define MXS_MODULE_NAME "mariadbmon" -#include "mariadbmon.h" +#include "../mysqlmon.h" #include #include #include diff --git a/server/modules/monitor/mariadbmon/mariadbmon.h b/server/modules/monitor/mysqlmon.h similarity index 98% rename from server/modules/monitor/mariadbmon/mariadbmon.h rename to server/modules/monitor/mysqlmon.h index 59f71e9a4..11ae6b591 100644 --- a/server/modules/monitor/mariadbmon/mariadbmon.h +++ b/server/modules/monitor/mysqlmon.h @@ -1,6 +1,6 @@ #pragma once -#ifndef _MARIADBMON_H -#define _MARIADBMON_H +#ifndef _MYSQLMON_H +#define _MYSQLMON_H /* * Copyright (c) 2016 MariaDB Corporation Ab * diff --git a/server/modules/monitor/ndbclustermon/ndbclustermon.c b/server/modules/monitor/ndbclustermon/ndbclustermon.c index b31e995e2..2f305716a 100644 --- a/server/modules/monitor/ndbclustermon/ndbclustermon.c +++ b/server/modules/monitor/ndbclustermon/ndbclustermon.c @@ -17,7 +17,7 @@ #define MXS_MODULE_NAME "ndbclustermon" -#include "ndbclustermon.h" +#include "../mysqlmon.h" #include #include @@ -103,7 +103,7 @@ MXS_MODULE* MXS_CREATE_MODULE() static void * startMonitor(MXS_MONITOR *mon, const MXS_CONFIG_PARAMETER *params) { - NDBC_MONITOR *handle = mon->handle; + MYSQL_MONITOR *handle = mon->handle; bool have_events = false, script_error = false; if (handle != NULL) @@ -113,7 +113,7 @@ startMonitor(MXS_MONITOR *mon, const MXS_CONFIG_PARAMETER *params) } else { - if ((handle = (NDBC_MONITOR *) MXS_MALLOC(sizeof(NDBC_MONITOR))) == NULL) + if ((handle = (MYSQL_MONITOR *) MXS_MALLOC(sizeof(MYSQL_MONITOR))) == NULL) { return NULL; } @@ -154,7 +154,7 @@ startMonitor(MXS_MONITOR *mon, const MXS_CONFIG_PARAMETER *params) static void stopMonitor(MXS_MONITOR *mon) { - NDBC_MONITOR *handle = (NDBC_MONITOR *) mon->handle; + MYSQL_MONITOR *handle = (MYSQL_MONITOR *) mon->handle; handle->shutdown = 1; thread_wait(handle->thread); @@ -306,7 +306,7 @@ monitorDatabase(MXS_MONITORED_SERVER *database, char *defaultUser, char *default static void monitorMain(void *arg) { - NDBC_MONITOR *handle = (NDBC_MONITOR*)arg; + MYSQL_MONITOR *handle = (MYSQL_MONITOR*)arg; MXS_MONITOR* mon = handle->monitor; MXS_MONITORED_SERVER *ptr; size_t nrounds = 0; diff --git a/server/modules/monitor/ndbclustermon/ndbclustermon.h b/server/modules/monitor/ndbclustermon/ndbclustermon.h index 1d21d1aec..d01064d98 100644 --- a/server/modules/monitor/ndbclustermon/ndbclustermon.h +++ b/server/modules/monitor/ndbclustermon/ndbclustermon.h @@ -1,6 +1,5 @@ -#pragma once -#ifndef _NDBCMON_H -#define _NDBCMON_H +#ifndef _MYSQLMON_H +#define _MYSQLMON_H /* * Copyright (c) 2016 MariaDB Corporation Ab * @@ -14,27 +13,39 @@ * Public License. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + /** * @file ndbclustermon.h - The NDB Cluster monitor * */ -#include -#include -#include - -// The handle for an instance of a NDB Cluster Monitor module +/** + * The handle for an instance of a NDB Cluster Monitor module + */ typedef struct { - THREAD thread; /**< Monitor thread */ SPINLOCK lock; /**< The monitor spinlock */ - unsigned long id; /**< Monitor ID */ - uint64_t events; /*< enabled events */ + pthread_t tid; /**< id of monitor thread */ int shutdown; /**< Flag to shutdown the monitor thread */ int status; /**< Monitor status */ - MXS_MONITORED_SERVER *master; /**< Master server for MySQL Master/Slave replication */ + unsigned long id; /**< Monitor ID */ + MONITOR_SERVERS *master; /**< Master server for MySQL Master/Slave replication */ char* script; /*< Script to call when state changes occur on servers */ - MXS_MONITOR* monitor; -} NDBC_MONITOR; + bool events[MAX_MONITOR_EVENT]; /*< enabled events */ +} MYSQL_MONITOR; #endif