MXS-1775 MonitorInstance now calls mysql_thread_[init|finish]()
This commit is contained in:
parent
15e3a2887c
commit
6db4ce54a9
@ -2587,9 +2587,22 @@ void MonitorInstance::main(void* pArg)
|
||||
{
|
||||
MonitorInstance* pThis = static_cast<MonitorInstance*>(pArg);
|
||||
|
||||
atomic_store_int32(&pThis->m_status, MXS_MONITOR_RUNNING);
|
||||
static_cast<MonitorInstance*>(pArg)->main();
|
||||
atomic_store_int32(&pThis->m_status, MXS_MONITOR_STOPPED);
|
||||
if (mysql_thread_init() == 0)
|
||||
{
|
||||
atomic_store_int32(&pThis->m_status, MXS_MONITOR_RUNNING);
|
||||
static_cast<MonitorInstance*>(pArg)->main();
|
||||
atomic_store_int32(&pThis->m_status, MXS_MONITOR_STOPPED);
|
||||
|
||||
mysql_thread_end();
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("mysql_thread_init() failed for %s. The monitor cannot start.",
|
||||
pThis->m_monitor->name);
|
||||
|
||||
// TODO: MaxScale now thinks the monitor is running, as startMonitor()
|
||||
// TODO: already returned true.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -121,12 +121,6 @@ void update_server_status(MXS_MONITOR *monitor, MXS_MONITORED_SERVER *database)
|
||||
*/
|
||||
void AuroraMonitor::main()
|
||||
{
|
||||
if (mysql_thread_init())
|
||||
{
|
||||
MXS_ERROR("mysql_thread_init failed in Aurora monitor. Exiting.");
|
||||
return;
|
||||
}
|
||||
|
||||
load_server_journal(m_monitor, NULL);
|
||||
|
||||
while (!m_shutdown)
|
||||
@ -168,8 +162,6 @@ void AuroraMonitor::main()
|
||||
ms += MXS_MON_BASE_INTERVAL_MS;
|
||||
}
|
||||
}
|
||||
|
||||
mysql_thread_end();
|
||||
}
|
||||
|
||||
bool AuroraMonitor::has_sufficient_permissions() const
|
||||
|
@ -458,11 +458,6 @@ void GaleraMonitor::main()
|
||||
int log_no_members = 1;
|
||||
|
||||
master_stickiness = m_disableMasterFailback;
|
||||
if (mysql_thread_init())
|
||||
{
|
||||
MXS_ERROR("mysql_thread_init failed in monitor module. Exiting.");
|
||||
return;
|
||||
}
|
||||
|
||||
load_server_journal(m_monitor, NULL);
|
||||
|
||||
@ -470,7 +465,6 @@ void GaleraMonitor::main()
|
||||
{
|
||||
if (m_shutdown)
|
||||
{
|
||||
mysql_thread_end();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -185,12 +185,6 @@ static void update_server_status(MXS_MONITOR* monitor, MXS_MONITORED_SERVER* ser
|
||||
|
||||
void GRMon::main()
|
||||
{
|
||||
if (mysql_thread_init())
|
||||
{
|
||||
MXS_ERROR("mysql_thread_init failed. Exiting.");
|
||||
return;
|
||||
}
|
||||
|
||||
load_server_journal(m_monitor, NULL);
|
||||
|
||||
while (!m_shutdown)
|
||||
@ -229,8 +223,6 @@ void GRMon::main()
|
||||
ms += MXS_MON_BASE_INTERVAL_MS;
|
||||
}
|
||||
}
|
||||
|
||||
mysql_thread_end();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -449,19 +449,12 @@ void MMMonitor::main()
|
||||
|
||||
detect_stale_master = m_detectStaleMaster;
|
||||
|
||||
if (mysql_thread_init())
|
||||
{
|
||||
MXS_ERROR("Fatal : mysql_thread_init failed in monitor module. Exiting.");
|
||||
return;
|
||||
}
|
||||
|
||||
load_server_journal(mon, &m_master);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (m_shutdown)
|
||||
{
|
||||
mysql_thread_end();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -249,19 +249,12 @@ void NDBCMonitor::main()
|
||||
MXS_MONITORED_SERVER *ptr;
|
||||
size_t nrounds = 0;
|
||||
|
||||
if (mysql_thread_init())
|
||||
{
|
||||
MXS_ERROR("Fatal : mysql_thread_init failed in monitor module. Exiting.");
|
||||
return;
|
||||
}
|
||||
|
||||
load_server_journal(m_monitor, NULL);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (m_shutdown)
|
||||
{
|
||||
mysql_thread_end();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user