MXS-2556 Add persist_performance_data arg to smartrouter

This commit is contained in:
Johan Wikman 2019-06-11 11:59:08 +03:00
parent 04fdaf1fdb
commit ba4099799f
2 changed files with 21 additions and 7 deletions

View File

@ -19,7 +19,7 @@
namespace
{
namespace smartquery
namespace smartrouter
{
config::Specification specification(MXS_MODULE_NAME, config::Specification::ROUTER);
@ -29,6 +29,13 @@ master(&specification,
"master",
"The server/cluster to be treated as master, that is, the one where updates are sent.");
config::ParamBool
persist_performance_data(&specification,
"persist_performance_data",
"Persist performance data so that the smartrouter can use information "
"collected during earlier runs.",
true); // Default value
}
}
@ -66,19 +73,20 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
}
SmartRouter::Config::Config(const std::string& name)
: config::Configuration(name, &smartquery::specification)
, m_master(this, &smartquery::master)
: config::Configuration(name, &smartrouter::specification)
, m_master(this, &smartrouter::master)
, m_persist_performance_data(this, &smartrouter::persist_performance_data)
{
}
void SmartRouter::Config::populate(MXS_MODULE& module)
{
smartquery::specification.populate(module);
smartrouter::specification.populate(module);
}
bool SmartRouter::Config::configure(const MXS_CONFIG_PARAMETER& params)
{
return smartquery::specification.configure(*this, params);
return smartrouter::specification.configure(*this, params);
}
bool SmartRouter::Config::post_configure(const MXS_CONFIG_PARAMETER& params)
@ -134,7 +142,7 @@ bool SmartRouter::Config::post_configure(const MXS_CONFIG_PARAMETER& params)
bool SmartRouter::configure(MXS_CONFIG_PARAMETER* pParams)
{
if (!smartquery::specification.validate(*pParams))
if (!smartrouter::specification.validate(*pParams))
{
return false;
}

View File

@ -46,11 +46,17 @@ public:
return m_master.get();
}
bool persist_performance_data() const
{
return static_cast<bool>(m_persist_performance_data);
}
private:
bool post_configure(const MXS_CONFIG_PARAMETER& params) override;
private:
config::Server m_master;
config::Server m_master;
config::Bool m_persist_performance_data;
};
static SmartRouter* create(SERVICE* pService, MXS_CONFIG_PARAMETER* pParams);