The semaphore is only used when Worker::start() is called to synchronize
the startup of the two threads. Also asserted that the state is what we
expected it to be.
Now that the exit handlers work correctly, the output of `maxscale
--version` no longer consists of a single line but multiple lines in both
stdout and stderr. Removing the printing to stderr guarantees that the
correct output is produced.
The offsets in the events were wrong if MaxScale was restarted in the
middle of a binlog. This was caused by the fact that the FDE event
contains information on binlog checksums which is required for a correct
interpretation of the binlog. The FDE event was only read when the binlog
was first opened when it needs to be read every time the binlog is opened.
As a JSON object can never start with the ERR prefix, it is safe to check
it for all requests. Also fixed the missing newline in the avrorouter
error message.
This guarantees that the caller of the start function will know whether
the worker is running by looking at its state.
This will prevent multiple successive stop calls to a worker which
happened when the monitors were altered via the REST API.
In tests, the log can now be setup as
int main()
{
mxb::Log log;
...
}
That will initialize the log so that it logs to a file called
<program-name>.log in the current directory and finalize it
when the program exits.
If any part of initalization fails, no resources are held.
At finalization, release all resources.
Also re-implement recent changes made to log_manager.cc that
did not automatically move over to log.cc.
Basically a copy of maxscale/debug.h, but with some name changes.
- ss_dassert -> mxb_assert
- ss_info_dassert -> mxb_assert_message
- ss_debug -> MXB_AT_DEBUG
Almost a verbatim copy of log_manager.[h|cc] with mxs changed
to mxb. The changes allow the MaxScale log manager to be moved
on top of this implementation.
The current implementation of mxs_log_message() is otherwise
generic, but for the fact that the session id is automatically
injected into the message.
With this change, a mxs_log_init2() is introduced that in addition
to the existing parameters takes a function using which the context
can be provided. The implementation of mxs_log_init() now simply
calls mxs_log_init2() giving a function that provides the MaxScale
context.
This is in preparation for moving maxscale/log_manager.h to
maxbase/log.h.