MXS-1775 MonitorInstance::m_script is now a std::string
This commit is contained in:
@ -43,7 +43,7 @@ protected:
|
|||||||
int m_status; /**< The current status of the monitor. */
|
int m_status; /**< The current status of the monitor. */
|
||||||
MXS_MONITOR* m_monitor; /**< The generic monitor structure. */
|
MXS_MONITOR* m_monitor; /**< The generic monitor structure. */
|
||||||
int32_t m_shutdown; /**< Non-zero if the monitor should shut down. */
|
int32_t m_shutdown; /**< Non-zero if the monitor should shut down. */
|
||||||
char* m_script; /**< Launchable script. */
|
std::string m_script; /**< Launchable script. */
|
||||||
uint64_t m_events; /**< Enabled monitor events. */
|
uint64_t m_events; /**< Enabled monitor events. */
|
||||||
bool m_checked; /**< Whether server access has been checked. */
|
bool m_checked; /**< Whether server access has been checked. */
|
||||||
|
|
||||||
|
|||||||
@ -2510,7 +2510,6 @@ MonitorInstance::MonitorInstance(MXS_MONITOR* pMonitor)
|
|||||||
: m_status(0)
|
: m_status(0)
|
||||||
, m_monitor(pMonitor)
|
, m_monitor(pMonitor)
|
||||||
, m_shutdown(0)
|
, m_shutdown(0)
|
||||||
, m_script(NULL)
|
|
||||||
, m_events(0)
|
, m_events(0)
|
||||||
, m_thread(0)
|
, m_thread(0)
|
||||||
{
|
{
|
||||||
@ -2519,7 +2518,6 @@ MonitorInstance::MonitorInstance(MXS_MONITOR* pMonitor)
|
|||||||
MonitorInstance::~MonitorInstance()
|
MonitorInstance::~MonitorInstance()
|
||||||
{
|
{
|
||||||
ss_dassert(!m_thread);
|
ss_dassert(!m_thread);
|
||||||
ss_dassert(!m_script);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonitorInstance::stop()
|
void MonitorInstance::stop()
|
||||||
@ -2530,9 +2528,6 @@ void MonitorInstance::stop()
|
|||||||
thread_wait(m_thread);
|
thread_wait(m_thread);
|
||||||
m_thread = 0;
|
m_thread = 0;
|
||||||
m_shutdown = 0;
|
m_shutdown = 0;
|
||||||
|
|
||||||
MXS_FREE(m_script);
|
|
||||||
m_script = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MonitorInstance::start(const MXS_CONFIG_PARAMETER* pParams)
|
bool MonitorInstance::start(const MXS_CONFIG_PARAMETER* pParams)
|
||||||
@ -2541,7 +2536,6 @@ bool MonitorInstance::start(const MXS_CONFIG_PARAMETER* pParams)
|
|||||||
|
|
||||||
ss_dassert(!m_shutdown);
|
ss_dassert(!m_shutdown);
|
||||||
ss_dassert(!m_thread);
|
ss_dassert(!m_thread);
|
||||||
ss_dassert(!m_script);
|
|
||||||
|
|
||||||
if (!m_checked)
|
if (!m_checked)
|
||||||
{
|
{
|
||||||
@ -2557,7 +2551,7 @@ bool MonitorInstance::start(const MXS_CONFIG_PARAMETER* pParams)
|
|||||||
|
|
||||||
if (m_checked)
|
if (m_checked)
|
||||||
{
|
{
|
||||||
m_script = config_copy_string(pParams, "script");
|
m_script = config_get_string(pParams, "script");
|
||||||
m_events = config_get_enum(pParams, "events", mxs_monitor_event_enum_values);
|
m_events = config_get_enum(pParams, "events", mxs_monitor_event_enum_values);
|
||||||
|
|
||||||
configure(pParams);
|
configure(pParams);
|
||||||
@ -2565,8 +2559,6 @@ bool MonitorInstance::start(const MXS_CONFIG_PARAMETER* pParams)
|
|||||||
if (thread_start(&m_thread, &maxscale::MonitorInstance::main, this, 0) == NULL)
|
if (thread_start(&m_thread, &maxscale::MonitorInstance::main, this, 0) == NULL)
|
||||||
{
|
{
|
||||||
MXS_ERROR("Failed to start monitor thread for monitor '%s'.", m_monitor->name);
|
MXS_ERROR("Failed to start monitor thread for monitor '%s'.", m_monitor->name);
|
||||||
MXS_FREE(m_script);
|
|
||||||
m_script = NULL;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -149,7 +149,7 @@ void AuroraMonitor::main()
|
|||||||
* After updating the status of all servers, check if monitor events
|
* After updating the status of all servers, check if monitor events
|
||||||
* need to be launched.
|
* need to be launched.
|
||||||
*/
|
*/
|
||||||
mon_process_state_changes(m_monitor, m_script, m_events);
|
mon_process_state_changes(m_monitor, m_script.empty() ? NULL : m_script.c_str(), m_events);
|
||||||
|
|
||||||
servers_status_current_to_pending(m_monitor);
|
servers_status_current_to_pending(m_monitor);
|
||||||
store_server_journal(m_monitor, NULL);
|
store_server_journal(m_monitor, NULL);
|
||||||
|
|||||||
@ -134,7 +134,6 @@ GaleraMonitor::GaleraMonitor(MXS_MONITOR *mon)
|
|||||||
GaleraMonitor::~GaleraMonitor()
|
GaleraMonitor::~GaleraMonitor()
|
||||||
{
|
{
|
||||||
hashtable_free(m_galera_nodes_info);
|
hashtable_free(m_galera_nodes_info);
|
||||||
MXS_FREE(m_script);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@ -204,9 +203,9 @@ json_t* GaleraMonitor::diagnostics_json() const
|
|||||||
json_object_set_new(rval, "use_priority", json_boolean(m_use_priority));
|
json_object_set_new(rval, "use_priority", json_boolean(m_use_priority));
|
||||||
json_object_set_new(rval, "set_donor_nodes", json_boolean(m_set_donor_nodes));
|
json_object_set_new(rval, "set_donor_nodes", json_boolean(m_set_donor_nodes));
|
||||||
|
|
||||||
if (m_script)
|
if (!m_script.empty())
|
||||||
{
|
{
|
||||||
json_object_set_new(rval, "script", json_string(m_script));
|
json_object_set_new(rval, "script", json_string(m_script.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_cluster_info.c_uuid)
|
if (m_cluster_info.c_uuid)
|
||||||
@ -606,7 +605,7 @@ void GaleraMonitor::main()
|
|||||||
* After updating the status of all servers, check if monitor events
|
* After updating the status of all servers, check if monitor events
|
||||||
* need to be launched.
|
* need to be launched.
|
||||||
*/
|
*/
|
||||||
mon_process_state_changes(m_monitor, m_script, m_events);
|
mon_process_state_changes(m_monitor, m_script.empty() ? NULL : m_script.c_str(), m_events);
|
||||||
|
|
||||||
mon_hangup_failed_servers(m_monitor);
|
mon_hangup_failed_servers(m_monitor);
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,6 @@
|
|||||||
GRMon::GRMon(MXS_MONITOR* monitor)
|
GRMon::GRMon(MXS_MONITOR* monitor)
|
||||||
: MonitorInstance(monitor)
|
: MonitorInstance(monitor)
|
||||||
, m_master(NULL)
|
, m_master(NULL)
|
||||||
, m_script(NULL)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,8 +53,6 @@ bool GRMon::has_sufficient_permissions() const
|
|||||||
|
|
||||||
void GRMon::configure(const MXS_CONFIG_PARAMETER* params)
|
void GRMon::configure(const MXS_CONFIG_PARAMETER* params)
|
||||||
{
|
{
|
||||||
// TODO: Turn MonitorInstance::m_script into a std::string and remove GRMon::m_script
|
|
||||||
m_script = config_get_string(params, "script");
|
|
||||||
m_master = NULL;
|
m_master = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MXS_MONITORED_SERVER* m_master; /**< The master server */
|
MXS_MONITORED_SERVER* m_master; /**< The master server */
|
||||||
std::string m_script;
|
|
||||||
|
|
||||||
GRMon(MXS_MONITOR* monitor);
|
GRMon(MXS_MONITOR* monitor);
|
||||||
~GRMon();
|
~GRMon();
|
||||||
|
|||||||
@ -556,7 +556,7 @@ void MMMonitor::main()
|
|||||||
* After updating the status of all servers, check if monitor events
|
* After updating the status of all servers, check if monitor events
|
||||||
* need to be launched.
|
* need to be launched.
|
||||||
*/
|
*/
|
||||||
mon_process_state_changes(mon, m_script, m_events);
|
mon_process_state_changes(mon, m_script.empty() ? NULL : m_script.c_str(), m_events);
|
||||||
|
|
||||||
mon_hangup_failed_servers(mon);
|
mon_hangup_failed_servers(mon);
|
||||||
servers_status_current_to_pending(mon);
|
servers_status_current_to_pending(mon);
|
||||||
|
|||||||
@ -310,7 +310,7 @@ void NDBCMonitor::main()
|
|||||||
* After updating the status of all servers, check if monitor events
|
* After updating the status of all servers, check if monitor events
|
||||||
* need to be launched.
|
* need to be launched.
|
||||||
*/
|
*/
|
||||||
mon_process_state_changes(m_monitor, m_script, m_events);
|
mon_process_state_changes(m_monitor, m_script.empty() ? NULL : m_script.c_str(), m_events);
|
||||||
|
|
||||||
mon_hangup_failed_servers(m_monitor);
|
mon_hangup_failed_servers(m_monitor);
|
||||||
servers_status_current_to_pending(m_monitor);
|
servers_status_current_to_pending(m_monitor);
|
||||||
|
|||||||
Reference in New Issue
Block a user