MXS-1775 MonitorInstance::m_script is now a std::string

This commit is contained in:
Johan Wikman
2018-05-16 12:47:40 +03:00
parent c7eb0a9958
commit 1e084b78b1
8 changed files with 8 additions and 21 deletions

View File

@ -149,7 +149,7 @@ void AuroraMonitor::main()
* After updating the status of all servers, check if monitor events
* 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);
store_server_journal(m_monitor, NULL);

View File

@ -134,7 +134,6 @@ GaleraMonitor::GaleraMonitor(MXS_MONITOR *mon)
GaleraMonitor::~GaleraMonitor()
{
hashtable_free(m_galera_nodes_info);
MXS_FREE(m_script);
}
// 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, "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)
@ -606,7 +605,7 @@ void GaleraMonitor::main()
* After updating the status of all servers, check if monitor events
* 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);

View File

@ -29,7 +29,6 @@
GRMon::GRMon(MXS_MONITOR* monitor)
: MonitorInstance(monitor)
, m_master(NULL)
, m_script(NULL)
{
}
@ -54,8 +53,6 @@ bool GRMon::has_sufficient_permissions() const
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;
}

View File

@ -33,7 +33,6 @@ public:
private:
MXS_MONITORED_SERVER* m_master; /**< The master server */
std::string m_script;
GRMon(MXS_MONITOR* monitor);
~GRMon();

View File

@ -556,7 +556,7 @@ void MMMonitor::main()
* After updating the status of all servers, check if monitor events
* 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);
servers_status_current_to_pending(mon);

View File

@ -310,7 +310,7 @@ void NDBCMonitor::main()
* After updating the status of all servers, check if monitor events
* 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);
servers_status_current_to_pending(m_monitor);