MXS-2196: Fix removal of failed listeners

When a listener was created at runtime but it failed to start, it would
not be automatically removed from the system. This caused the MaxCtrl
cluster sync test to fail.
This commit is contained in:
Markus Mäkelä 2018-12-04 11:17:20 +02:00
parent ceb6094623
commit 711fbd4f19
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -995,7 +995,15 @@ bool runtime_create_listener(Service* service,
std::lock_guard<std::mutex> guard(crt_lock);
if (!listener_find(name) && !service_find_listener(service, "", addr, u_port))
if (listener_find(name))
{
config_runtime_error("Listener '%s' already exists", name);
}
else if (SListener l = service_find_listener(service, "", addr, u_port))
{
config_runtime_error("Listener '%s' already listens on [%s]:%u", l->name(), addr, u_port);
}
else
{
SSL_LISTENER* ssl = NULL;
@ -1030,6 +1038,8 @@ bool runtime_create_listener(Service* service,
{
MXS_ERROR("Listener '%s' was created but failed to start it.", name);
config_runtime_error("Listener '%s' was created but failed to start it.", name);
Listener::destroy(listener);
mxb_assert(!listener_find(name));
}
}
else
@ -1039,10 +1049,6 @@ bool runtime_create_listener(Service* service,
}
}
}
else
{
config_runtime_error("Listener '%s' already exists", name);
}
return rval;
}