Commit Graph

3464 Commits

Author SHA1 Message Date
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
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
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
f9ba8824d4 MXS-2004 Remove additional dependencies on maxscale/thread.h 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
2515473fd4 MXS-2004 Replace THREAD with std::thread in housekeeper 2018-08-13 13:38:39 +03:00
ddc422b102 MonitorInstance::diagnostics_json() should return an empty object
Some of the inheriting classes call the base class diagnostics_json
when constructing their own diagnostics data.
2018-08-13 11:30:21 +03:00
eab0a22518 Use parameters list when converting monitor parameters to json
The json conversion now processes the general monitor parameters similarly
to the module-specific settings.
2018-08-13 11:18:04 +03:00
f90b8cdafb Fix race condition in session.cc
The dummy session was unnecessarily modified by multiple threads at the
same time. The state of the dummy session must not change once it's been
set at startup.
2018-08-13 10:37:48 +03:00
2852530893 Use standard RNG
The custom random number generator can now be replaced with a C++11
RNG. This greatly improves the reliability and trustworthiness of it.

In addition to this, the conversion of the RNG to a thread-local object
removes the race condition that was present in the previous
implementation. It also theoretically improves performance by a tiny bit.
2018-08-13 10:37:48 +03:00
4a47b4f334 Fix ssl_version
The parameter used wrong keywords for the enum values. The comparison
should be changed to be case-insensitive to prevent similar problems.
2018-08-13 10:28:04 +03:00
cef305e598 MXS-1929: Fix version_string
The new default value was not copied to the old value.
2018-08-13 10:28:04 +03:00
46dee98b25 MXS-1929: Report runtime module loading errors to users
If a module is not found, a proper error message is now given to the
user. Other system errors are also printed if errno is set. Dynamic
library errors aren't printed as they are apparently reset after a call to
`dlerror`, at least according to documentation.
2018-08-13 10:28:03 +03:00
3bbf58ad1f Update MaxCtrl packages
Updated needed and pruned unneeded dependencies from maxctrl. Also updated
the packages in the REST API test suite.
2018-08-13 10:28:03 +03:00
70fa300fe1 Remove unnecessary mxs_log_flush_sync calls
The calls were unnecessary in the context where they were made.
2018-08-13 10:28:02 +03:00
cb990f28dc Remove dead log_manager code
SS_LOG_DEBUG was never defined.
2018-08-13 10:28:02 +03:00
f9e5d3135d Allow null parameter values
If a resource parameter is defined as a null JSON value, it is ignored.
2018-08-13 10:28:01 +03:00
e2902b6513 MXS-2002 Remove GenericFunction typedef
It does not save much in characters compared to std::function<void ()>
and it's a bit misleading as not just any callable object will do, but
only one that takes no argument and returns void.
2018-08-13 08:30:05 +03:00
43b53fda7a MXS-2002 Replace task with std::function 2018-08-13 08:30:05 +03:00
4193c4d3db MXS-2002 Add additional versions of Worker::[call|execute]() 2018-08-13 08:30:05 +03:00
e9758ebaf1 MXS-2002 Rename Worker::post() to Worker::execute()
The main point is that tasks/functions are executed, not that
they are posted.
2018-08-13 08:30:05 +03:00
3013adb14f MXS-2002 Worker::execute() renamed to Worker::call()
In preparation for Worker::post() to be renamed to Worker:execute().
The concept of _posting_ will be reserved to mean the transfer of
something over the message queue to the worker for processing and
nothing else.
2018-08-13 08:30:05 +03:00
6335d3776c MXS-2002 Replace auto_ptr with unique_ptr
Given 'Derived : public Base', a unique_ptr<Derived> converts
implictly to a unique_ptr<Base>.
2018-08-13 08:30:05 +03:00
9cfd451a1d MXS-2002 Make Worker excecution mode explicit
This is the first step in some cleanup of the Worker interface.
The execution mode must now be explicitly specified, but that is
just a temporary step. Further down the road, _posting_ will
*always* mean via the message loop while _executing_ will optionally
and by default mean direct execution if the calling thread is that
of the worker.
2018-08-13 08:30:05 +03:00
b9ec3f5130 Monitor json diagnostics printing cleanup
The 'events' and 'script' config values were defined for every monitor.
Removed the extra definitions and moved the variables to MXS_MONITOR.

MariaDBMonitor was printing config values a second time, they are
already printed by the caller.

Moved the events enum definition to the internal header since it's no longer
required by modules.

Added a default config setting "all" to 'events' to clarify that it enables
all events.
2018-08-10 11:19:09 +03:00