MXS-2196: Start listeners after worker threads
If the startup of the listeners requires communication with all of the workers, the workers must be up and running for that to happen. Due to the fact that the main thread is still a worker thread, the initialization code is not extra straightforward. By queuing an event to the main worker, the startup of all listeners is done at a fully operational state with all workers fully functional. The service initialization code was also flawed in the sense that it would cause a deadlock if any of the threads would have to check for the user permissions. This is mainly a problem with the authenticator modules but the benefits of the per service pre-loading of users is most likely superficial. In theory startup will be faster as each thread now queries the users in parallel.
This commit is contained in:
@ -422,10 +422,10 @@ bool serviceStartListener(SERVICE* svc, const char* name)
|
||||
return listener && listener->service() == svc && listener->start();
|
||||
}
|
||||
|
||||
int service_launch_all()
|
||||
bool service_launch_all()
|
||||
{
|
||||
int n = 0, i;
|
||||
bool error = false;
|
||||
bool ok = true;
|
||||
int num_svc = this_unit.services.size();
|
||||
|
||||
MXS_NOTICE("Starting a total of %d services...", num_svc);
|
||||
@ -439,7 +439,7 @@ int service_launch_all()
|
||||
if (i == 0)
|
||||
{
|
||||
MXS_ERROR("Failed to start service '%s'.", service->name);
|
||||
error = true;
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (maxscale_is_shutting_down())
|
||||
@ -448,7 +448,7 @@ int service_launch_all()
|
||||
}
|
||||
}
|
||||
|
||||
return error ? -1 : n;
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool serviceStop(SERVICE* service)
|
||||
@ -1911,21 +1911,6 @@ uint64_t service_get_version(const SERVICE* svc, service_version_which_t which)
|
||||
return version;
|
||||
}
|
||||
|
||||
bool service_thread_init()
|
||||
{
|
||||
LockGuard guard(this_unit.lock);
|
||||
|
||||
for (Service* service : this_unit.services)
|
||||
{
|
||||
if (service->capabilities & ACAP_TYPE_ASYNC)
|
||||
{
|
||||
service_refresh_users(service);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Service::is_basic_parameter(const std::string& name)
|
||||
{
|
||||
static const std::set<std::string> names =
|
||||
|
Reference in New Issue
Block a user