MXS-2271 Move Monitor inside maxscale-namespace
Rearranged monitor.cc by namespace.
This commit is contained in:
@ -24,6 +24,7 @@
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/mysql_utils.hh>
|
||||
|
||||
using maxscale::MXS_MONITORED_SERVER;
|
||||
|
||||
AuroraMonitor::AuroraMonitor(const std::string& name, const std::string& module)
|
||||
: MonitorWorkerSimple(name, module)
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool has_sufficient_permissions();
|
||||
void update_server_status(MXS_MONITORED_SERVER* monitored_server);
|
||||
void update_server_status(mxs::MXS_MONITORED_SERVER* monitored_server);
|
||||
|
||||
private:
|
||||
AuroraMonitor(const std::string& name, const std::string& module);
|
||||
|
@ -14,6 +14,9 @@
|
||||
#include "clustrix.hh"
|
||||
#include <maxbase/assert.h>
|
||||
|
||||
using maxscale::Monitor;
|
||||
using maxscale::MXS_MONITORED_SERVER;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -65,7 +65,7 @@ bool is_part_of_the_quorum(const char* zName, const SERVER& server, MYSQL* pCon)
|
||||
*
|
||||
* @return True, if the node is part of the quorum, false otherwise.
|
||||
*/
|
||||
inline bool is_part_of_the_quorum(const char* zName, MXS_MONITORED_SERVER& ms)
|
||||
inline bool is_part_of_the_quorum(const char* zName, mxs::MXS_MONITORED_SERVER& ms)
|
||||
{
|
||||
mxb_assert(ms.server);
|
||||
mxb_assert(ms.con);
|
||||
@ -100,7 +100,7 @@ bool is_being_softfailed(const char* zName, const SERVER& server, MYSQL* pCon);
|
||||
* @note Upon return @c *ppCon will be non-NULL.
|
||||
*/
|
||||
bool ping_or_connect_to_hub(const char* zName,
|
||||
const MXS_MONITORED_SERVER::ConnectionSettings& settings,
|
||||
const mxs::MXS_MONITORED_SERVER::ConnectionSettings& settings,
|
||||
Softfailed softfailed,
|
||||
SERVER& server,
|
||||
MYSQL** ppCon);
|
||||
@ -117,9 +117,9 @@ bool ping_or_connect_to_hub(const char* zName,
|
||||
* @return True, if the server can be used as hub, false otherwise.
|
||||
*/
|
||||
inline bool ping_or_connect_to_hub(const char* zName,
|
||||
const MXS_MONITORED_SERVER::ConnectionSettings& settings,
|
||||
const mxs::MXS_MONITORED_SERVER::ConnectionSettings& settings,
|
||||
Softfailed softfailed,
|
||||
MXS_MONITORED_SERVER& ms)
|
||||
mxs::MXS_MONITORED_SERVER& ms)
|
||||
{
|
||||
return ping_or_connect_to_hub(zName, settings, softfailed, *ms.server, &ms.con);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
namespace http = mxb::http;
|
||||
using namespace std;
|
||||
using maxscale::MXS_MONITORED_SERVER;
|
||||
|
||||
#define LOG_JSON_ERROR(ppJson, format, ...) \
|
||||
do { \
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "clustrix.hh"
|
||||
|
||||
bool ClustrixNode::can_be_used_as_hub(const char* zName,
|
||||
const MXS_MONITORED_SERVER::ConnectionSettings& settings)
|
||||
const mxs::MXS_MONITORED_SERVER::ConnectionSettings& settings)
|
||||
{
|
||||
mxb_assert(m_pServer);
|
||||
bool rv = Clustrix::ping_or_connect_to_hub(zName, settings, Clustrix::Softfailed::REJECT,
|
||||
|
@ -161,7 +161,7 @@ public:
|
||||
}
|
||||
|
||||
bool can_be_used_as_hub(const char* zName,
|
||||
const MXS_MONITORED_SERVER::ConnectionSettings& settings);
|
||||
const mxs::MXS_MONITORED_SERVER::ConnectionSettings& settings);
|
||||
|
||||
SERVER* server() const
|
||||
{
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/mysql_utils.hh>
|
||||
|
||||
using maxscale::MXS_MONITORED_SERVER;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool has_sufficient_permissions();
|
||||
void update_server_status(MXS_MONITORED_SERVER* monitored_server);
|
||||
void update_server_status(mxs::MXS_MONITORED_SERVER* monitored_server);
|
||||
|
||||
private:
|
||||
CsMonitor(const std::string& name, const std::string& module);
|
||||
|
@ -33,6 +33,8 @@
|
||||
#define DONOR_NODE_NAME_MAX_LEN 60
|
||||
#define DONOR_LIST_SET_VAR "SET GLOBAL wsrep_sst_donor = \""
|
||||
|
||||
using maxscale::MXS_MONITORED_SERVER;
|
||||
|
||||
/** Log a warning when a bad 'wsrep_local_index' is found */
|
||||
static bool warn_erange_on_local_index = true;
|
||||
|
||||
|
@ -32,7 +32,7 @@ struct GaleraNode
|
||||
std::string cluster_uuid; /**< Cluster UUID */
|
||||
};
|
||||
|
||||
typedef std::unordered_map<MXS_MONITORED_SERVER*, GaleraNode> NodeMap;
|
||||
typedef std::unordered_map<mxs::MXS_MONITORED_SERVER*, GaleraNode> NodeMap;
|
||||
|
||||
class GaleraMonitor : public maxscale::MonitorWorkerSimple
|
||||
{
|
||||
@ -48,7 +48,7 @@ public:
|
||||
protected:
|
||||
bool configure(const MXS_CONFIG_PARAMETER* param);
|
||||
bool has_sufficient_permissions();
|
||||
void update_server_status(MXS_MONITORED_SERVER* monitored_server);
|
||||
void update_server_status(mxs::MXS_MONITORED_SERVER* monitored_server);
|
||||
void pre_tick();
|
||||
void post_tick();
|
||||
|
||||
@ -71,7 +71,7 @@ private:
|
||||
bool detect_cluster_size(const int n_nodes,
|
||||
const char* candidate_uuid,
|
||||
const int candidate_size);
|
||||
MXS_MONITORED_SERVER* get_candidate_master();
|
||||
mxs::MXS_MONITORED_SERVER* get_candidate_master();
|
||||
void set_galera_cluster();
|
||||
void update_sst_donor_nodes(int is_cluster);
|
||||
};
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <maxscale/protocol/mysql.hh>
|
||||
#include <mysqld_error.h>
|
||||
|
||||
using maxscale::MXS_MONITORED_SERVER;
|
||||
|
||||
GRMon::GRMon(const std::string& name, const std::string& module)
|
||||
: MonitorWorkerSimple(name, module)
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool has_sufficient_permissions();
|
||||
void update_server_status(MXS_MONITORED_SERVER* monitored_server);
|
||||
void update_server_status(mxs::MXS_MONITORED_SERVER* monitored_server);
|
||||
|
||||
private:
|
||||
GRMon(const std::string& name, const std::string& module);
|
||||
|
@ -32,6 +32,8 @@
|
||||
|
||||
using std::string;
|
||||
using maxbase::string_printf;
|
||||
using maxscale::Monitor;
|
||||
using maxscale::MXS_MONITORED_SERVER;
|
||||
|
||||
// Config parameter names
|
||||
const char* const CN_AUTO_FAILOVER = "auto_failover";
|
||||
|
@ -251,7 +251,7 @@ private:
|
||||
|
||||
MariaDBServer* get_server(const std::string& host, int port);
|
||||
MariaDBServer* get_server(int64_t id);
|
||||
MariaDBServer* get_server(MXS_MONITORED_SERVER* mon_server);
|
||||
MariaDBServer* get_server(mxs::MXS_MONITORED_SERVER* mon_server);
|
||||
MariaDBServer* get_server(SERVER* server);
|
||||
|
||||
// Cluster discovery and status assignment methods, top levels
|
||||
|
@ -28,6 +28,7 @@ using maxbase::Duration;
|
||||
using maxbase::StopWatch;
|
||||
using maxsql::QueryResult;
|
||||
using Guard = std::lock_guard<std::mutex>;
|
||||
using maxscale::MXS_MONITORED_SERVER;
|
||||
|
||||
MariaDBServer::MariaDBServer(MXS_MONITORED_SERVER* monitored_server, int config_index,
|
||||
bool assume_unique_hostnames, bool query_events)
|
||||
|
@ -73,7 +73,7 @@ struct NodeData
|
||||
class MariaDBServer
|
||||
{
|
||||
public:
|
||||
MariaDBServer(MXS_MONITORED_SERVER* monitored_server, int config_index,
|
||||
MariaDBServer(mxs::MXS_MONITORED_SERVER* monitored_server, int config_index,
|
||||
bool assume_unique_hostnames, bool query_events);
|
||||
|
||||
class EventInfo
|
||||
@ -119,7 +119,7 @@ public:
|
||||
|
||||
/* Monitored server base class/struct. MariaDBServer does not own the struct, it is not freed
|
||||
* (or connection closed) when a MariaDBServer is destroyed. */
|
||||
MXS_MONITORED_SERVER* m_server_base = NULL;
|
||||
mxs::MXS_MONITORED_SERVER* m_server_base = NULL;
|
||||
/* What position this server has in the monitor config? Used for tiebreaking between servers. */
|
||||
int m_config_index = 0;
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using maxscale::MXS_MONITORED_SERVER;
|
||||
|
||||
// Maximum sizes for array types
|
||||
const int MAX_CYCLE_SIZE = 10;
|
||||
|
@ -42,7 +42,7 @@ bool NDBCMonitor::has_sufficient_permissions()
|
||||
return test_permissions("SHOW STATUS LIKE 'Ndb_number_of_ready_data_nodes'");
|
||||
}
|
||||
|
||||
void NDBCMonitor::update_server_status(MXS_MONITORED_SERVER* monitored_server)
|
||||
void NDBCMonitor::update_server_status(mxs::MXS_MONITORED_SERVER* monitored_server)
|
||||
{
|
||||
MYSQL_ROW row;
|
||||
MYSQL_RES* result;
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool has_sufficient_permissions();
|
||||
void update_server_status(MXS_MONITORED_SERVER* monitored_server);
|
||||
void update_server_status(mxs::MXS_MONITORED_SERVER* monitored_server);
|
||||
|
||||
private:
|
||||
NDBCMonitor(const std::string& name, const std::string& module);
|
||||
|
@ -80,6 +80,8 @@
|
||||
#define ARG_TYPE_NUMERIC 10
|
||||
#define ARG_TYPE_OBJECT_NAME 11 // A string where whitespace is replaced with hyphens
|
||||
|
||||
using maxscale::Monitor;
|
||||
|
||||
/**
|
||||
* The subcommand structure
|
||||
*
|
||||
|
@ -503,7 +503,7 @@ void exec_shutdown_monitor(DCB* dcb, MAXINFO_TREE* tree)
|
||||
char errmsg[120];
|
||||
if (tree && tree->value)
|
||||
{
|
||||
Monitor* monitor = MonitorManager::find_monitor(tree->value);
|
||||
mxs::Monitor* monitor = MonitorManager::find_monitor(tree->value);
|
||||
if (monitor)
|
||||
{
|
||||
MonitorManager::stop_monitor(monitor);
|
||||
@ -612,7 +612,7 @@ void exec_restart_monitor(DCB* dcb, MAXINFO_TREE* tree)
|
||||
char errmsg[120];
|
||||
if (tree && tree->value)
|
||||
{
|
||||
Monitor* monitor = MonitorManager::find_monitor(tree->value);
|
||||
mxs::Monitor* monitor = MonitorManager::find_monitor(tree->value);
|
||||
if (monitor)
|
||||
{
|
||||
MonitorManager::start_monitor(monitor);
|
||||
|
Reference in New Issue
Block a user