7164 Commits

Author SHA1 Message Date
Markus Mäkelä
3c20b47a8d
Change parameters in dump_param
Putting the file descriptor first keeps it in line with dprintf.

Making the parameter set an initializer list allows matching against
multiple sets of parameters in one function call. This will compact the
parameter serialization by using the same code for the common service
parameters and the module parameters.
2018-08-20 13:56:59 +03:00
Markus Mäkelä
fe7a73e5c3
Register atexit functions in the correct place
The atexit functions should be registered after there is a need for
them. This fixes the problem where cleanup functions were called before
the initialization for them was done. Also removed the header and footer
printint to stdout.
2018-08-20 13:56:59 +03:00
Markus Mäkelä
930be8d77a
Fix CMake problems in system test
The paths were wrong in the scripts used to run tests. The same problem
was in the CMake files that used CMAKE_SOURCE_DIR instead of
CMAKE_CURRENT_SOURCE_DIR.

Added missing check for BUILD_SYSTEM_TESTS in avrorouter for the
workaround to building without all dependencies present.
2018-08-20 13:56:58 +03:00
Markus Mäkelä
d428292ec0
Add workaround to building tests without all dependencies
The system tests can be build even if not all of the dependencies for
MaxScale are met.
2018-08-20 13:56:58 +03:00
Johan Wikman
40a5ae81c7 MXS-2008 Store worker as MXB_WORKER* and not void* 2018-08-20 11:15:14 +03:00
Johan Wikman
e0cb11151f MXS-2008 Move maxscale/worker.h to maxbase/worker.h 2018-08-20 11:15:14 +03:00
Johan Wikman
932956d5f6 MXS-2008 Add maxbase/poll.[h|hh]
Remove maxscale/poll_core.h
2018-08-20 11:15:14 +03:00
Johan Wikman
8f257a51fe MXS-2008 Remove unused headers from worker.hh
Add corresponding headers to files that depended on those headers.
2018-08-20 11:15:14 +03:00
Johan Wikman
aaad63ee5e MXS-2008 Move content of maxscale/platform.h to maxbase/cdefs.h
No good reason for keeping that platform adjustments anywhere
else but in cdefs.h.
2018-08-20 11:15:14 +03:00
Markus Mäkelä
90960ec07f
Make Worker::run(mxb::Semaphore*) private
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.
2018-08-20 10:10:23 +03:00
Markus Mäkelä
af70dc3973
Fix build failures
Fixed build failures caused by merges and rebases.
2018-08-17 18:23:04 +03:00
Markus Mäkelä
667e9df97c
Merge branch '2.2' into develop 2018-08-17 18:10:44 +03:00
Markus Mäkelä
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
Markus Mäkelä
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
Johan Wikman
d8255d0cac MXS-2017 Move maxscale::Semaphore to maxbase::Semaphore 2018-08-17 15:53:54 +03:00
Markus Mäkelä
81853d8d6b
Fix binlogrouter unit test
The test called mxs_log_finish multiple times.
2018-08-17 14:29:28 +03:00
Markus Mäkelä
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
Johan Wikman
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
Johan Wikman
894d4eb034 MXS-2014 Explicitly set the MaxScale log identification 2018-08-17 10:59:37 +03:00
Esa Korhonen
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
Esa Korhonen
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
Johan Wikman
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
Johan Wikman
952ee0c15f MXS-2014 Implement MaxScale log manager using maxbase/log.h 2018-08-16 09:59:43 +03:00
Johan Wikman
17418572f9 MXS-2014 Move maxscale/jansson.h to maxbase/jansson.h 2018-08-16 09:58:00 +03:00
Johan Wikman
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
Markus Mäkelä
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
Markus Mäkelä
f82c965bfb
Calculate timestamp lengths only once
The lengths will never change.
2018-08-16 09:21:06 +03:00
Markus Mäkelä
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
Marko
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
Markus Mäkelä
0da0306ace
Merge branch '2.2' into develop 2018-08-15 18:08:52 +03:00
Markus Mäkelä
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
Johan Wikman
83afcc0388 MXS-2013 Remove pointless defines 2018-08-15 09:29:28 +03:00
Johan Wikman
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
Johan Wikman
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
Johan Wikman
ae43e4f0f2 MXS-2013 Remove all CHK_-macros 2018-08-15 09:28:04 +03:00
Johan Wikman
8fd1648217 MXS-2013 Remove skygw_chk_t 2018-08-15 09:28:04 +03:00
Johan Wikman
bdb7481357 MXS-2008 Remove dependency on mxs_clock() 2018-08-15 08:44:39 +03:00
Johan Wikman
f3f802cabe MXS-2008 Move maxscale/atomic.h to maxbase/atomic.h 2018-08-15 08:44:39 +03:00
Johan Wikman
d53bc9d3be MXS-2008 Move maxscale/semaphore.h to maxbase/semaphore.h 2018-08-15 08:41:45 +03:00
Johan Wikman
812f2edbdf MXS-2008 Remove unnecessary includes from worker.cc 2018-08-15 08:41:45 +03:00
Johan Wikman
8e624f48de MXS-2008 Remove Worker dependency on internal/poll.h 2018-08-15 08:41:45 +03:00
Johan Wikman
2d1e91ebf4 MXS-2008 Remove MXS_WORKER_MSG_PING
No reason for including that in the worker interface.
2018-08-15 08:41:45 +03:00
Johan Wikman
363750a07c MXS-2008 Slightly cleanup includes
Remove headers that are not actually needed by the including
header.
2018-08-15 08:41:45 +03:00
Markus Mäkelä
9538dbb37f
MXS-1929: Take serialization helpers into use in service
The service configuration serialization now uses the helper functions from
config.hh. This fixes the failing test mxs1731_old_persisted_config and
improves the readability of persisted configuration files.

Converted parameters into booleans that were used like booleans. This
forced the removal of the automatic enabling of
localhost_match_wildcard_host but since it has been enable by default,
this change should have no practical effects.

In addition to the clarification of the persisted configurations, this
change will limit the negative side-effects of changing a configuration
value in the main configuration file after a runtime modification has been
made. If a value has not been modified at runtime, changes to it in the
main configuration will take effect.

Previously, a runtime modification prevented all further manual changes to
the configuration file. Although in theory this sounds good, in practice
this does very little to improve the situation: The only reliable way to
change a parameter after a runtime modification is to do it via the REST
API (or MaxAdmin).
2018-08-14 21:51:58 +03:00
Markus Mäkelä
0c2bec9fba
MXS-1929: Add config dump helper functions
The functions dump of parameters only if they differ from the
defaults. The check for equality is rather coarse but it should work as
long as all core objects use C++ types correctly e.g. integer are not used
to store boolean values (I'm looking at you, enable_root and
localhost_match_wildcard_host). The boolean type has a specialization to
convert the value to the string format used for all defaults in the core.

This also adds the missing return value checks to the dprintf calls and
reports errors if any are encountered.
2018-08-14 21:51:58 +03:00
Markus Mäkelä
419aefb173
Update basic monitor parameters
All of the monitor parameters are now kept up to date when they are
altered. This simplifies the parameter list generation for the REST API.
2018-08-14 15:08:51 +03:00
Markus Mäkelä
4c8aee2b61
Fix monitor REST API output
Updates to common monitor parameters weren't displayed.
2018-08-14 14:57:34 +03:00
Markus Mäkelä
c543525c1b
MXS-2005: Move Logger into maxutils
Moved the logger into the maxutils library as it is a generic
utility. Also moved mxs_strerror into it as it depends on it.
2018-08-14 14:57:34 +03:00
Markus Mäkelä
dc2578ed98
MXS-2005: Refactor log manager message logging
The logging of syslog messages is now done outside of the log_write
function. This removes the need to pass the prefix length as an
argument. With this change, the log_write function only writes MaxScale
log messages.

Also reworked the timestamp generation functions so that they return a
string. This greatly simplifies the message writing.
2018-08-14 14:57:34 +03:00
Markus Mäkelä
9d343c28f1
MXS-2005: Use std::mutex instead of Spinlock in log manager
Changed Spinlocks and SPINLOCKs to std::mutex. Store Stats inside a
unique_ptr to avoid the copying of the lock.
2018-08-14 14:57:34 +03:00