MXS-2271 Monitor modifications always go through Monitor::configure()
Previously, runtime monitor modifications could directly alter monitor fields, which could leave the text-form parameters and reality out-of-sync. Also, the configure-function was not called for the entire monitor-object, only the module-implementation. Now, all modifications go through the overridden configure-function, which calls the base-class function. As most configuration changes are given in text-form, this removes the need for specific setters. The only exceptions are the server add/remove operations, which must modify the text-form serverlist.
This commit is contained in:
@ -55,6 +55,11 @@ ClustrixMonitor* ClustrixMonitor::create(const string& name, const string& modul
|
||||
|
||||
bool ClustrixMonitor::configure(const MXS_CONFIG_PARAMETER* pParams)
|
||||
{
|
||||
if (!MonitorWorker::configure(pParams))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_health_urls.clear();
|
||||
m_nodes.clear();
|
||||
|
||||
|
||||
@ -119,6 +119,11 @@ void CsMonitor::update_server_status(MXS_MONITORED_SERVER* srv)
|
||||
|
||||
bool CsMonitor::configure(const MXS_CONFIG_PARAMETER* pParams)
|
||||
{
|
||||
if (MonitorWorkerSimple::configure(pParams))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_primary = pParams->get_server("primary");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -104,6 +104,11 @@ json_t* GaleraMonitor::diagnostics_json() const
|
||||
|
||||
bool GaleraMonitor::configure(const MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
if (!MonitorWorkerSimple::configure(params))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_disableMasterFailback = params->get_bool("disable_master_failback");
|
||||
m_availableWhenDonor = params->get_bool("available_when_donor");
|
||||
m_disableMasterRoleSetting = params->get_bool("disable_master_role_setting");
|
||||
|
||||
@ -187,6 +187,11 @@ MariaDBMonitor* MariaDBMonitor::create(const string& name, const string& module)
|
||||
*/
|
||||
bool MariaDBMonitor::configure(const MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
if (!MonitorWorker::configure(params))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_detect_stale_master = params->get_bool("detect_stale_master");
|
||||
m_detect_stale_slave = params->get_bool("detect_stale_slave");
|
||||
m_ignore_external_masters = params->get_bool("ignore_external_masters");
|
||||
|
||||
@ -238,7 +238,7 @@ private:
|
||||
|
||||
// Base methods
|
||||
MariaDBMonitor(const std::string& name, const std::string& module);
|
||||
bool configure(const MXS_CONFIG_PARAMETER* params);
|
||||
bool configure(const MXS_CONFIG_PARAMETER* params) override;
|
||||
bool set_replication_credentials(const MXS_CONFIG_PARAMETER* params);
|
||||
void reset_server_info();
|
||||
void clear_server_info();
|
||||
|
||||
Reference in New Issue
Block a user