Commit Graph

11488 Commits

Author SHA1 Message Date
208949f1cb Synchronize the worker thread with the starting thread
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.
2018-08-17 18:09:51 +03:00
9510a3ae1a Use normal asserts in log.cc
The logger can't use the asserts that log messages as it introduces a
cyclical dependency on the logger itself.
2018-08-17 18:09:51 +03:00
0fbd789572 MXS-2019: Fix atexit handlers
The code now registers all functions once instead of one function multiple
times.
2018-08-17 17:35:41 +03:00
9b199cfb50 Remove duplicate CMakeLists.txt entry
maxutils/maxbase/src/test/CMakeLists.txt
2018-08-17 16:21:58 +03:00
b82822a4b0 MXS-2017 Move maxscale::Semaphore to maxbase::Semaphore 2018-08-17 15:57:44 +03:00
d8255d0cac MXS-2017 Move maxscale::Semaphore to maxbase::Semaphore 2018-08-17 15:53:54 +03:00
25c81b118d Rename conflicting test 2018-08-17 15:02:03 +03:00
81853d8d6b Fix binlogrouter unit test
The test called mxs_log_finish multiple times.
2018-08-17 14:29:28 +03:00
f09afa2967 Combine regression test suite and main CMake projects
Combining the projects makes it easier to use common components. This
fixes the build failure of maxutils due to missing jansson definitions.
2018-08-17 14:29:28 +03:00
c7a6d75ab9 MXS-2014 Address review issues 2018-08-17 10:59:37 +03:00
cf0aeed516 MXS-2014 Rename log_manager.h to log.h
There's nothing resembling a manager anymore.
2018-08-17 10:59:37 +03:00
894d4eb034 MXS-2014 Explicitly set the MaxScale log identification 2018-08-17 10:59:37 +03:00
15bf481120 MXS-2014 Allow the header and footer to be adjusted 2018-08-17 10:59:37 +03:00
4388b8517e MXS-2014 Use standard assert in Logger 2018-08-17 10:59:37 +03:00
cfdfff46ae MXS-2014 Add skeleton test for mxb::Log 2018-08-17 10:59:37 +03:00
12e8f28907 MXS-2014 Add mxb::Log class for convenience
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.
2018-08-17 10:59:37 +03:00
be986d366a MXS-2014 Handle default OOM message properly 2018-08-17 10:59:37 +03:00
57706e7758 Hide the MonitorInstance m_state field
The field had the same purpose as MXS_MONITOR->state. Now the field
is only used for checking if the MonitorInstance thread is running.
2018-08-17 09:47:32 +03:00
fe5df6d379 Remove duplicate monitor state definitions
The state is still stored in two different variables. Also, removed the
ALLOC and FREED states.
2018-08-17 09:47:32 +03:00
876cf7c86f MXS-2014 Temporarily fix broken token pasting 2018-08-16 11:24:01 +03:00
19684deb69 MXS-2014 Init and finish properly
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.
2018-08-16 11:09:30 +03:00
a586aa13c4 MXS-2014 Add proper OOM support
Not that I think it ever will be needed...
2018-08-16 09:59:43 +03:00
85b68c439a MXS-2014 Still more cleanup of maxbase/log.h 2018-08-16 09:59:43 +03:00
9a8bb95be6 MXS-2014 Rename mxs_log_priority_is_enabled
- Renamed to mxs_log_is_priority_enabled
- That function instead of the macro is now consistently used
2018-08-16 09:59:43 +03:00
8ae2997c4e MXS-2014 Remove separate log_write() function 2018-08-16 09:59:43 +03:00
5b46d815e4 MXS-2014 Move message status checking into MessageRegistry 2018-08-16 09:59:43 +03:00
79b292dc39 MXS-2014 Additional cleanup of log.cc 2018-08-16 09:59:43 +03:00
5b70c7605c MXS-2014 Some cleanup of log.cc
Unused stuff removed and unit variables collected into this_unit
structure.
2018-08-16 09:59:43 +03:00
0c479b5d13 MXS-2014 Enable asserts in log.cc 2018-08-16 09:59:43 +03:00
6b6bbceb6e MXS-2014 Add maxbase/assert.h
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
2018-08-16 09:59:43 +03:00
952ee0c15f MXS-2014 Implement MaxScale log manager using maxbase/log.h 2018-08-16 09:59:43 +03:00
52e6e10e28 MXS-2014 Remove duplicate function
Two functions that essentially did the same thing, but had
slightly different name.
2018-08-16 09:58:00 +03:00
b4912a942f MXS-2014 Add missing MXB_[BEGIN|END]_DECLS 2018-08-16 09:58:00 +03:00
a191ed85a2 MXS-2014 Expose everything needed by the MaxScale log manager 2018-08-16 09:58:00 +03:00
1a6eb8165a MXS-2014 Add log.[h|cc] to maxbase
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.
2018-08-16 09:58:00 +03:00
17418572f9 MXS-2014 Move maxscale/jansson.h to maxbase/jansson.h 2018-08-16 09:58:00 +03:00
f98cb0fe8d MXS-2014 Introduce possibility for providing log context
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.
2018-08-16 09:58:00 +03:00
3e0086cd09 Increase max config line length
This makes the theoretical upper server limit 16383 servers with each
having a 1023 character name.
2018-08-16 09:21:06 +03:00
f82c965bfb Calculate timestamp lengths only once
The lengths will never change.
2018-08-16 09:21:06 +03:00
6aff79e634 Revert log manager message limit changes
There was no need to change the length of the buffer.
2018-08-16 09:21:06 +03:00
9370cda24b MXS-1663 Detect conflicting configurations and refuse to start
Use locks with the datadir and cachedir to detect if another MaxScale
instance attempts to use the same directories as the already running
MaxScale.
2018-08-15 22:23:32 +03:00
0da0306ace Merge branch '2.2' into develop 2018-08-15 18:08:52 +03:00
435963f2ed Merge branch '2.1' into 2.2 2018-08-15 17:32:35 +03:00
e644debdf7 Fix SLES 15 packaging
SLES 15 doesn't have any sort of init functions which is why the error is
converted to a status message. A dummy file that just prints an error is
placed into /etc/init.d/ to make it clear to the users that they should
use systemd to start MaxScale.
2018-08-15 17:28:15 +03:00
be4f9125f0 Fix mxb_strerror
The function should not be an inline function with a static variable. This
appears to cause problems on at least Debian Wheezy and is likely to cause
odd behavior on other platforms.

Also renamed the file to <maxbase/string.h> to better mirror how the
<string.h> file behaves.
2018-08-15 14:58:46 +03:00
3b8f01e136 MXS-2013 Fix rebase issue 2018-08-15 09:52:35 +03:00
83afcc0388 MXS-2013 Remove pointless defines 2018-08-15 09:29:28 +03:00
228dcbe0ce MXS-2013 Minor cleanup of maxscale/debug.h
Removal of unnecessary include files had ripple effects.
2018-08-15 09:29:28 +03:00
f975035e53 MXS-2013 Move or remove STR-macros
- The ones that were not used were removed.
- The ones that were used were moved close to the actual type.
  In most cases some values were missing and if the definition is
  close to the type there is a remote chance that they will stay
  in sync. If detached, they surely will not.
2018-08-15 09:28:04 +03:00
ae43e4f0f2 MXS-2013 Remove all CHK_-macros 2018-08-15 09:28:04 +03:00