Commit Graph

11406 Commits

Author SHA1 Message Date
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
8fd1648217 MXS-2013 Remove skygw_chk_t 2018-08-15 09:28:04 +03:00
bdb7481357 MXS-2008 Remove dependency on mxs_clock() 2018-08-15 08:44:39 +03:00
f3f802cabe MXS-2008 Move maxscale/atomic.h to maxbase/atomic.h 2018-08-15 08:44:39 +03:00
d53bc9d3be MXS-2008 Move maxscale/semaphore.h to maxbase/semaphore.h 2018-08-15 08:41:45 +03:00
812f2edbdf MXS-2008 Remove unnecessary includes from worker.cc 2018-08-15 08:41:45 +03:00
8e624f48de MXS-2008 Remove Worker dependency on internal/poll.h 2018-08-15 08:41:45 +03:00
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
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
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
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
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
4c8aee2b61 Fix monitor REST API output
Updates to common monitor parameters weren't displayed.
2018-08-14 14:57:34 +03:00
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
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
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
5a306aa20a MXS-2005: Use log manager only after initialization
The log manager functions must not be used before it is initialized.
2018-08-14 14:57:34 +03:00
39ce6c624f MXS-2005: Remove unused code
Removed skygw_utils and relate files along with the old log manager
code. Also removed file flushing due to it being redundant; messages are
written to the file immediately. Adjusted tests to accommodate this
change.
2018-08-14 14:57:33 +03:00
fd5a2305e4 MXS-2005: Take Logger into use in log_manager
The log manager now uses the logger type for logging. Removed some of the
code that depended on the renamed functions to make it compile. The next
step is to remove all unused code in the log manager.
2018-08-14 14:57:33 +03:00
1326b3a950 MXS-2005: Add Logger class
The interface defines a very simple logging API. The main logger,
FileLogger, implements a very basic logger that writes to a file. The
StdoutLogger implements a logger that simply writes to stdout.

The logging to shm could be implemented quite easily but the usefulness of
it is very questionable and it has the problem of losing log files on a
server shutdown. A ring buffer of INFO messages would be more useful and
would provide a way to limit the amount of memory used for it.
2018-08-14 14:57:33 +03:00
32b1711684 MXS-2005: Remove logging to shared memory
The feature was rarely used and was only useful in extremely rare
cases. The functionality can still be emulated, if for some reason needed,
by pointing `logdir` to `/dev/shm` or another tmpfs mount.
2018-08-14 14:57:33 +03:00
ab507ebfe9 Add missing timeouts to mxs1743_rconn_bitmask
Also did some minor cleanup.
2018-08-14 09:33:39 +03:00
4fdec4d1f3 MXS-2004 Replace pthread_self() with std::this_thread::get_id() 2018-08-13 13:38:39 +03:00
0c56be1e58 MXS-2004 Remove maxscale/thread.h and server/core/thread.cc
Not used anymore.
2018-08-13 13:38:39 +03:00
e075fcefcb MXS-2004 thread_stack_size is deprecated AND ignored 2018-08-13 13:38:39 +03:00
2dd9e3e382 MXS-2004 Remove remaining dependency on maxscale/thread.h
Replaced with explicit dependency on pthread.h. Acceptable since
this is effectively for debugging purposes and could at some point
be removed entirelly.
2018-08-13 13:38:39 +03:00
f9ba8824d4 MXS-2004 Remove additional dependencies on maxscale/thread.h 2018-08-13 13:38:39 +03:00
5d6b05af1f MXS-2004 Change tpmfilter to use std::thread instead of THREAD
The bare minimum of changes; there seem to be numerous races in
the thread function.
2018-08-13 13:38:39 +03:00
7ef163477a MXS-2004 Change unit tests to use std::thread 2018-08-13 13:38:39 +03:00
b408894f6d MXS-2004 Remove dependency of maxscale/thread.h 2018-08-13 13:38:39 +03:00
e978387775 MXS-2004 Replace THREAD with std::thread in log_manager.cc 2018-08-13 13:38:39 +03:00
47b53aae55 MXS-2004 Replace THREAD with std::thread in Worker 2018-08-13 13:38:39 +03:00
6db03d4b29 MXS-2004 Drop support for thread_stack_size
- Cannot be supported with std::thread.
- Unlikely that the default size (8MB) would ever be too small and
  if it is, there is some problem.
- The stack size can be specified using 'ulimit -s' before starting
  MaxScale.
2018-08-13 13:38:39 +03:00