MXS-22: Shutting down monitor now closes database connections
Shutting down monitors is not supposed to be done ofter so there is no true benefit from keeping the connections open. With the refactoring of the monitor interface, this can be done in a centralized place.
This commit is contained in:
@ -186,13 +186,23 @@ void monitorStartAll()
|
|||||||
void
|
void
|
||||||
monitorStop(MONITOR *monitor)
|
monitorStop(MONITOR *monitor)
|
||||||
{
|
{
|
||||||
|
spinlock_acquire(&monitor->lock);
|
||||||
if (monitor->state != MONITOR_STATE_STOPPED)
|
if (monitor->state != MONITOR_STATE_STOPPED)
|
||||||
{
|
{
|
||||||
monitor->state = MONITOR_STATE_STOPPING;
|
monitor->state = MONITOR_STATE_STOPPING;
|
||||||
monitor->module->stopMonitor(monitor);
|
monitor->module->stopMonitor(monitor);
|
||||||
monitor->state = MONITOR_STATE_STOPPED;
|
monitor->state = MONITOR_STATE_STOPPED;
|
||||||
|
|
||||||
|
MONITOR_SERVERS* db = monitor->databases;
|
||||||
|
while (db)
|
||||||
|
{
|
||||||
|
mysql_close(db->con);
|
||||||
|
db->con = NULL;
|
||||||
|
db = db->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
spinlock_release(&monitor->lock);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shutdown all running monitors
|
* Shutdown all running monitors
|
||||||
|
|||||||
Reference in New Issue
Block a user