MXS-1865 Wrong permissions on backends no longer cause monitor start to fail
The logic was weird, as the permission checking function assumes a disconnected server as fine. The checking is now done when starting the main loop and lacking grants print errors but does not stop the monitor.
This commit is contained in:
@ -160,20 +160,12 @@ bool MariaDBMonitor::start(const MXS_CONFIG_PARAMETER* params)
|
||||
error = true;
|
||||
}
|
||||
|
||||
if (!error && !check_monitor_permissions(m_monitor_base, "SHOW SLAVE STATUS"))
|
||||
if (!error && (thread_start(&m_thread, monitorMain, this, 0) == NULL))
|
||||
{
|
||||
MXS_ERROR("Failed to start monitor thread for monitor '%s'.", m_monitor_base->name);
|
||||
error = true;
|
||||
}
|
||||
|
||||
if (!error)
|
||||
{
|
||||
if (thread_start(&m_thread, monitorMain, this, 0) == NULL)
|
||||
{
|
||||
MXS_ERROR("Failed to start monitor thread for monitor '%s'.", m_monitor_base->name);
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
MXS_ERROR("Failed to start monitor. See earlier errors for more information.");
|
||||
@ -339,6 +331,16 @@ void MariaDBMonitor::main_loop()
|
||||
check_maxscale_schema_replication();
|
||||
}
|
||||
|
||||
/* Check monitor permissions. Failure won't cause the monitor to stop. Afterwards, close connections so
|
||||
* that update_server() reconnects and checks server version. TODO: check permissions when checking
|
||||
* server version. */
|
||||
check_monitor_permissions(m_monitor_base, "SHOW SLAVE STATUS");
|
||||
for (auto iter = m_servers.begin(); iter != m_servers.end(); iter++)
|
||||
{
|
||||
mysql_close((*iter)->m_server_base->con);
|
||||
(*iter)->m_server_base->con = NULL;
|
||||
}
|
||||
|
||||
while (m_keep_running)
|
||||
{
|
||||
timespec loop_start;
|
||||
|
Reference in New Issue
Block a user