Fix monitor shutdown and restart
Monitor restart was not working.
This commit is contained in:
@ -225,6 +225,9 @@ monitor_start(MXS_MONITOR *monitor, const MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
spinlock_acquire(&monitor->lock);
|
||||
|
||||
// Only start the monitor if it's newly created or currently stopped.
|
||||
if (monitor->state == MONITOR_STATE_ALLOC || monitor->state == MONITOR_STATE_STOPPED)
|
||||
{
|
||||
if (journal_is_stale(monitor, monitor->journal_max_age))
|
||||
{
|
||||
MXS_WARNING("Removing stale journal file for monitor '%s'.", monitor->name);
|
||||
@ -239,6 +242,7 @@ monitor_start(MXS_MONITOR *monitor, const MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
MXS_ERROR("Failed to start monitor '%s'.", monitor->name);
|
||||
}
|
||||
}
|
||||
|
||||
spinlock_release(&monitor->lock);
|
||||
}
|
||||
|
@ -503,6 +503,8 @@ void Worker::run()
|
||||
bool Worker::start(size_t stack_size)
|
||||
{
|
||||
m_started = true;
|
||||
m_should_shutdown = false;
|
||||
m_shutdown_initiated = false;
|
||||
|
||||
if (!thread_start(&m_thread, &Worker::thread_main, this, stack_size))
|
||||
{
|
||||
|
Reference in New Issue
Block a user