From db30ea96f2d4c1d7e035de788132a4182446f3a3 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 17 May 2018 13:56:03 +0300 Subject: [PATCH] MXS-1775 m_master is now a member variable of MonitorInstance --- include/maxscale/monitor.hh | 11 ++++++----- server/core/monitor.cc | 2 ++ server/modules/monitor/galeramon/galeramon.cc | 1 - server/modules/monitor/galeramon/galeramon.hh | 1 - server/modules/monitor/grmon/grmon.cc | 2 -- server/modules/monitor/grmon/grmon.hh | 2 -- server/modules/monitor/mmmon/mmmon.cc | 1 - server/modules/monitor/mmmon/mmmon.hh | 5 ++--- server/modules/monitor/ndbclustermon/ndbclustermon.cc | 1 - server/modules/monitor/ndbclustermon/ndbclustermon.hh | 3 +-- 10 files changed, 11 insertions(+), 18 deletions(-) diff --git a/include/maxscale/monitor.hh b/include/maxscale/monitor.hh index 4c47254b3..650bed9d4 100644 --- a/include/maxscale/monitor.hh +++ b/include/maxscale/monitor.hh @@ -40,11 +40,12 @@ protected: static void main(void* pArg); - MXS_MONITOR* m_monitor; /**< The generic monitor structure. */ - int32_t m_shutdown; /**< Non-zero if the monitor should shut down. */ - std::string m_script; /**< Launchable script. */ - uint64_t m_events; /**< Enabled monitor events. */ - bool m_checked; /**< Whether server access has been checked. */ + MXS_MONITOR* m_monitor; /**< The generic monitor structure. */ + int32_t m_shutdown; /**< Non-zero if the monitor should shut down. */ + std::string m_script; /**< Launchable script. */ + uint64_t m_events; /**< Enabled monitor events. */ + bool m_checked; /**< Whether server access has been checked. */ + MXS_MONITORED_SERVER* m_master; /**< Master server */ private: int32_t m_status; /**< The current status of the monitor. */ diff --git a/server/core/monitor.cc b/server/core/monitor.cc index 18e529277..64f8d1af5 100644 --- a/server/core/monitor.cc +++ b/server/core/monitor.cc @@ -2510,6 +2510,7 @@ MonitorInstance::MonitorInstance(MXS_MONITOR* pMonitor) : m_monitor(pMonitor) , m_shutdown(0) , m_events(0) + , m_master(NULL) , m_status(MXS_MONITOR_STOPPED) , m_thread(0) { @@ -2557,6 +2558,7 @@ bool MonitorInstance::start(const MXS_CONFIG_PARAMETER* pParams) { m_script = config_get_string(pParams, "script"); m_events = config_get_enum(pParams, "events", mxs_monitor_event_enum_values); + m_master = NULL; configure(pParams); diff --git a/server/modules/monitor/galeramon/galeramon.cc b/server/modules/monitor/galeramon/galeramon.cc index 1393b5fbf..795c097e4 100644 --- a/server/modules/monitor/galeramon/galeramon.cc +++ b/server/modules/monitor/galeramon/galeramon.cc @@ -105,7 +105,6 @@ GaleraMonitor::GaleraMonitor(MXS_MONITOR *mon) , m_disableMasterFailback(0) , m_availableWhenDonor(0) , m_disableMasterRoleSetting(0) - , m_master(NULL) , m_root_node_as_master(false) , m_use_priority(false) , m_set_donor_nodes(false) diff --git a/server/modules/monitor/galeramon/galeramon.hh b/server/modules/monitor/galeramon/galeramon.hh index 553e65971..d95afa85a 100644 --- a/server/modules/monitor/galeramon/galeramon.hh +++ b/server/modules/monitor/galeramon/galeramon.hh @@ -68,7 +68,6 @@ private: int m_disableMasterFailback; /**< Monitor flag for Galera Cluster Master failback */ int m_availableWhenDonor; /**< Monitor flag for Galera Cluster Donor availability */ bool m_disableMasterRoleSetting; /**< Monitor flag to disable setting master role */ - MXS_MONITORED_SERVER *m_master; /**< Master server for MySQL Master/Slave replication */ bool m_root_node_as_master; /**< Whether we require that the Master should * have a wsrep_local_index of 0 */ bool m_use_priority; /**< Use server priorities */ diff --git a/server/modules/monitor/grmon/grmon.cc b/server/modules/monitor/grmon/grmon.cc index 0ab91b13f..8fac9c82f 100644 --- a/server/modules/monitor/grmon/grmon.cc +++ b/server/modules/monitor/grmon/grmon.cc @@ -28,7 +28,6 @@ GRMon::GRMon(MXS_MONITOR* monitor) : MonitorInstance(monitor) - , m_master(NULL) { } @@ -53,7 +52,6 @@ bool GRMon::has_sufficient_permissions() const void GRMon::configure(const MXS_CONFIG_PARAMETER* params) { - m_master = NULL; } void GRMon::diagnostics(DCB* dcb) const diff --git a/server/modules/monitor/grmon/grmon.hh b/server/modules/monitor/grmon/grmon.hh index 2210b9387..cdf505a9c 100644 --- a/server/modules/monitor/grmon/grmon.hh +++ b/server/modules/monitor/grmon/grmon.hh @@ -32,8 +32,6 @@ public: json_t* diagnostics_json() const; private: - MXS_MONITORED_SERVER* m_master; /**< The master server */ - GRMon(MXS_MONITOR* monitor); ~GRMon(); diff --git a/server/modules/monitor/mmmon/mmmon.cc b/server/modules/monitor/mmmon/mmmon.cc index 19dfb39ec..762b0d9cb 100644 --- a/server/modules/monitor/mmmon/mmmon.cc +++ b/server/modules/monitor/mmmon/mmmon.cc @@ -88,7 +88,6 @@ MMMonitor::MMMonitor(MXS_MONITOR *monitor) : maxscale::MonitorInstance(monitor) , m_id(MXS_MONITOR_DEFAULT_ID) , m_detectStaleMaster(false) - , m_master(NULL) { } diff --git a/server/modules/monitor/mmmon/mmmon.hh b/server/modules/monitor/mmmon/mmmon.hh index d8fc4630e..46cb0e68d 100644 --- a/server/modules/monitor/mmmon/mmmon.hh +++ b/server/modules/monitor/mmmon/mmmon.hh @@ -32,9 +32,8 @@ public: json_t* diagnostics_json() const; private: - unsigned long m_id; /**< Monitor ID */ - int m_detectStaleMaster; /**< Monitor flag for Stale Master detection */ - MXS_MONITORED_SERVER *m_master; /**< Master server for Master/Slave replication */ + unsigned long m_id; /**< Monitor ID */ + int m_detectStaleMaster; /**< Monitor flag for Stale Master detection */ MMMonitor(MXS_MONITOR* monitor); ~MMMonitor(); diff --git a/server/modules/monitor/ndbclustermon/ndbclustermon.cc b/server/modules/monitor/ndbclustermon/ndbclustermon.cc index 366e398d1..049f17bab 100644 --- a/server/modules/monitor/ndbclustermon/ndbclustermon.cc +++ b/server/modules/monitor/ndbclustermon/ndbclustermon.cc @@ -73,7 +73,6 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() NDBCMonitor::NDBCMonitor(MXS_MONITOR *monitor) : maxscale::MonitorInstance(monitor) , m_id(MXS_MONITOR_DEFAULT_ID) - , m_master(NULL) { } diff --git a/server/modules/monitor/ndbclustermon/ndbclustermon.hh b/server/modules/monitor/ndbclustermon/ndbclustermon.hh index 92b006ea9..cf5216569 100644 --- a/server/modules/monitor/ndbclustermon/ndbclustermon.hh +++ b/server/modules/monitor/ndbclustermon/ndbclustermon.hh @@ -32,8 +32,7 @@ public: json_t* diagnostics_json() const; private: - unsigned long m_id; /**< Monitor ID */ - MXS_MONITORED_SERVER *m_master; /**< Master server for MySQL Master/Slave replication */ + unsigned long m_id; /**< Monitor ID */ NDBCMonitor(MXS_MONITOR* monitor); ~NDBCMonitor();