MXS-1775 Introduce MonitorInstance::has_sufficient_permissions()

With this function in place, it is now possible to move the thread
starting to MonitorInstance.
This commit is contained in:
Johan Wikman
2018-05-16 12:30:37 +03:00
parent 3606a5ed1c
commit adb7f156d6
12 changed files with 52 additions and 9 deletions

View File

@ -191,9 +191,7 @@ bool AuroraMonitor::start(const MXS_CONFIG_PARAMETER *params)
if (!m_checked)
{
if (!check_monitor_permissions(m_monitor, "SELECT @@aurora_server_id, server_id FROM "
"information_schema.replica_host_status "
"WHERE session_id = 'MASTER_SESSION_ID'"))
if (!has_sufficient_permissions())
{
MXS_ERROR("Failed to start monitor. See earlier errors for more information.");
}
@ -222,6 +220,13 @@ bool AuroraMonitor::start(const MXS_CONFIG_PARAMETER *params)
return started;
}
bool AuroraMonitor::has_sufficient_permissions() const
{
return check_monitor_permissions(m_monitor, "SELECT @@aurora_server_id, server_id FROM "
"information_schema.replica_host_status "
"WHERE session_id = 'MASTER_SESSION_ID'");
}
void AuroraMonitor::configure(const MXS_CONFIG_PARAMETER* params)
{
m_script = config_copy_string(params, "script");

View File

@ -36,6 +36,7 @@ private:
AuroraMonitor(MXS_MONITOR* monitor);
~AuroraMonitor();
bool has_sufficient_permissions() const;
void configure(const MXS_CONFIG_PARAMETER* params);
void main();