This fixes the test failures that stem from users being created right
after maxscale has started. This also should make startups a bit smoother
now that the default value of users_refresh_time has been fixed.
As server relationships are unordered, sorting them guarantees a certain
order. This fixes the MaxCtrl cluster diff test failure.
Also formatted monitor.cc sources: the indentation seems to be off.
Storing all the runtime errors makes it possible to return all of them
them via the REST API. MaxAdmin will still only show the latest error but
MaxCtrl will now show all errors if more than one error occurs.
The parameters are now written in the order they appear in the module
parameter definitions. Also enabled a previously disabled part in
server unit test.
If the servers of a service are defined by a monitor (the config
has 'cluster=SomeMonitor'), then the addition of a server to a
a monitor should lead to that server being added to the service.
The manipulation functions are currently static so that the container can be initialized
if required. This will be fixed later.
The new functions are taken into use in monitor management.
Replaces uses of config_get_param() in modules either with contains()
or get_string(). The config_get_param() is moved to internal headers,
as it allows seeing inside a config setting.
The old behavior is to not start MaxScale if any listeners fail to
bind. This behavior is convenient when there are conflicts with other
applications so it should remain. This change prevents the internal
service restarts from functioning which might have already been broken.
The "restarting" of services after a failure to bind to an interface is
somewhat questionable. Almost no transient errors are expected at startup
with the exception of running out of sockets. This should probably be the
only case when the internal service restart is done and in other cases it
causes more harm than good.
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.
Replaced the DCB with a single file descriptor that the listener listens
on and which is added to all of the workers. The Listener also extends the
MXB_POLL_DATA which allows it to handle epoll events.
Moved the code that creates the listening socket into listener.cc where it
belongs and did a minor cleanup of it.
By storing the reference in the DCB, the two-way dependency between the
listeners and services is severed. Now the services have no direct link to
listeners and after the destruction of a listener it will be freed once
all connections through it have closed.
Due to the fact that a listener itself has a DCB that must point to a
valid listener, a self-reference is stored in the listener DCB. This is
extremely confusing and is only here to keep the code functional until the
DCB part of the listener can be factored out.