11378 Commits

Author SHA1 Message Date
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
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
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
Johan Wikman
4fdec4d1f3 MXS-2004 Replace pthread_self() with std::this_thread::get_id() 2018-08-13 13:38:39 +03:00
Johan Wikman
0c56be1e58 MXS-2004 Remove maxscale/thread.h and server/core/thread.cc
Not used anymore.
2018-08-13 13:38:39 +03:00
Johan Wikman
e075fcefcb MXS-2004 thread_stack_size is deprecated AND ignored 2018-08-13 13:38:39 +03:00
Johan Wikman
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
Johan Wikman
f9ba8824d4 MXS-2004 Remove additional dependencies on maxscale/thread.h 2018-08-13 13:38:39 +03:00
Johan Wikman
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
Johan Wikman
7ef163477a MXS-2004 Change unit tests to use std::thread 2018-08-13 13:38:39 +03:00
Johan Wikman
b408894f6d MXS-2004 Remove dependency of maxscale/thread.h 2018-08-13 13:38:39 +03:00
Johan Wikman
e978387775 MXS-2004 Replace THREAD with std::thread in log_manager.cc 2018-08-13 13:38:39 +03:00
Johan Wikman
47b53aae55 MXS-2004 Replace THREAD with std::thread in Worker 2018-08-13 13:38:39 +03:00
Johan Wikman
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
Johan Wikman
2515473fd4 MXS-2004 Replace THREAD with std::thread in housekeeper 2018-08-13 13:38:39 +03:00
Esa Korhonen
681c456bd7 Separate unknown server version from old versions
This allows better failover support detection.
2018-08-13 11:30:21 +03:00
Esa Korhonen
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
Esa Korhonen
e5a90d63e1 Remove SERVER_WAS_SLAVE status bit
Was unused due to MariaDBMonitor changes.
2018-08-13 11:30:20 +03:00
Esa Korhonen
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
Markus Mäkelä
1572e088bf
Run REST API and MaxCtrl unit tests
Install Docker when building on CentOS 7. This allows the REST API and
MaxCtrl unit tests to be run.
2018-08-13 10:54:25 +03:00
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
4017466527
Disable SQLite memory statistics for qc_sqlite
The default value can be set at compile time. This prevents a race condition that TSAN reports in the
2018-08-13 10:37:48 +03:00
Markus Mäkelä
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
Markus Mäkelä
33488e1a1f
Update Connector-C version
There are various bug fixes for TLS/SSL connections as well as
reconnections. A large number of compiler warnings were also removed.
2018-08-13 10:28:04 +03:00
Markus Mäkelä
804991404e
Rewrite stale_slaves
The behavior of mariadbmon was changed so that it better understands
slaves attempting to replicate. Rewrote the test to accommodate the change
in behavior and take the opportunity to use newer code.
2018-08-13 10:28:04 +03:00
Markus Mäkelä
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
Markus Mäkelä
c984381662
Use devtoolset 7
As devtoolset 6 worked on CentOS 6, upgrading to devtoolset 7 is better as
it will be supported for a longer time.
2018-08-13 10:28:03 +03:00
Markus Mäkelä
57471c7baa
Improve MaxCtrl test coverage
A few missing cases that simple to solve were reported by the coverage
tool.
2018-08-13 10:28:03 +03:00
Markus Mäkelä
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
Markus Mäkelä
064ad8fa4f
Improve MaxScale startup and shutdown in NPM tests
The tests are now less violent in how they stop MaxScale. Also the logs
are now removed before a new test run is executed.
2018-08-13 10:28:03 +03:00
Markus Mäkelä
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
Markus Mäkelä
06df290aeb
Use DevToolSet 6 with CentOS 6
DevToolSet 4 was EOL'ed December 2017.
2018-08-13 10:28:02 +03:00
Markus Mäkelä
c1f930d23d
Fix query classifier initialization data race
The initialization code does some modification to the global code
(something about a page cache) and causes warnings with TSAN.
2018-08-13 10:28:02 +03:00
Markus Mäkelä
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