212 Commits

Author SHA1 Message Date
Esa Korhonen
1514a77345 Improve main thread detection
Now properly checks if configuration and diagnostics functions are ran in either
main() or in the admin worker. This is useful for debugging and enforcing
thread safety.

Also, monitors are now started and stopped in the admin worker.
2019-07-31 12:36:05 +03:00
Marko
a9b01ff4cc Merge branch '2.3' into 2.4 2019-07-28 21:43:58 +03:00
Marko
918a2964d5 MXS-2592 Add configuration for session specific in-memory log
When enabled each session will write log messages in the in-memory log.
If session ends in error this log is written to the actual log in disk.
2019-07-28 20:56:22 +03:00
Markus Mäkelä
835049d506
Merge branch '2.3' into 2.4 2019-07-19 12:25:26 +03:00
Markus Mäkelä
146b940245
Dump statements on fatal signal
This should make it easier to figure out what is going on at the time of
the crash if statement collection is enabled.
2019-07-19 12:03:36 +03:00
Johan Wikman
0ba779d5a2 Update 2.4.0 Change Date 2019-06-25 10:11:55 +03:00
Markus Mäkelä
aeebf941f6
Merge branch '2.3' into develop 2019-06-19 13:28:58 +03:00
Markus Mäkelä
3d8475f8ed
Merge branch '2.2' into 2.3 2019-06-19 12:37:23 +03:00
Markus Mäkelä
27fb397041
MXS-2547: Do shutdown on main worker
By stopping the REST API before the workers and moving the shutdown to the
same worker that handles REST API requests, we prevent the hang on
shutdown. This also makes the signal handler signal-safe.
2019-06-19 10:31:47 +03:00
Esa Korhonen
4efa9dbeea Remove maxscale/alloc.h
The remaining contents were moved to maxbase/alloc.h.
2019-06-10 14:11:25 +03:00
Marko
3d66e68e95 MXS-2170 Start MaxScale normally if it gets the same PID as previous
MaxScale

Check is made to see if the found MaxScale PID is owned by the process
itself.
2019-05-07 22:23:46 +03:00
Markus Mäkelä
5ac24de6b0
Remove log_to_shm
The feature was removed in 2.3 and was ignored if configured.
2019-05-06 16:05:50 +03:00
Esa Korhonen
82b4338eca Remove MonitorManager calls from Monitor functions
Also adds admin thread checks to MonitorManager functions and combines
anonymous namespaces.
2019-04-30 13:45:48 +03:00
Esa Korhonen
ac5ee1278c MXS-2271 Cleanup internal monitor header and its functions
Some functions still accessed the servers-array. Most functions are now
inside class. Removed unused defines.
2019-03-12 15:32:56 +02:00
Esa Korhonen
3fa4a85a1e MXS-2304 Use values instead of pointers in CONFIG_CONTEXT
Simplifies ctor/dtor.
2019-02-22 16:39:45 +02:00
Esa Korhonen
3321a591ef MXS-2271 Move some monitor management functions to an internal class
The class MonitorManager contains monitor-related functions that should not
be called from modules. MonitorManager can access private fields and methods
of the monitor.
2019-01-22 10:31:06 +02:00
Esa Korhonen
d4674faa7d Convert maxscale/query_classifier.h to .hh
The header was not merged with queryclassifier.hh since the latter
does not include the former.
2019-01-15 18:18:39 +02:00
Johan Wikman
5a698be45c MXS-2218 Centralize worker shutdown handling 2019-01-08 16:01:36 +02:00
Johan Wikman
c27a24ab37 MXS-2218 If startup fails, main worker must also be shutdown 2019-01-08 16:01:36 +02:00
Johan Wikman
6ba2cb61df MXS-2218 Implement housekeeper in terms of MainWorker 2019-01-08 16:01:36 +02:00
Johan Wikman
d50ae1fb8a MXS-2218 Treat all routing workers the same way
All routing workers are now started an stopped the same way.
2019-01-08 16:01:36 +02:00
Johan Wikman
35dfa05767 MXS-2218 Run MainWorker in main thread
The previous main routing worker is now run in a separate thread.
Next step is to treat all routing workers in an identical fashion.
MainWorker is not yet used for anything, but in a subsequent change
the old housekeeper functionality will be moved in top of MainWorker.
2019-01-08 16:01:36 +02:00
Markus Mäkelä
5a9e84d39a
Merge branch '2.3' into develop 2018-12-18 00:00:00 +02:00
Markus Mäkelä
35d31801bb
Merge branch '2.2' into 2.3 2018-12-17 23:52:56 +02:00
Niclas Antti
f2a3a5737a MXS-2221 Fatal signal handling does not always create a core
Quick and simple fix, but this should be overhauled. See MXS-599.
2018-12-11 14:22:35 +02:00
Johan Wikman
c0c9a9858d MXS-2197 Rename maxscale/log.h to maxscale/log.hh
In files either include maxscale/log.hh or remove include entirelly
as maxscale/ccdefs.hh includes it.
2018-12-10 12:58:17 +02:00
Markus Mäkelä
7aa60b4a24
MXS-2196: Start listeners after worker threads
If the startup of the listeners requires communication with all of the
workers, the workers must be up and running for that to happen.

Due to the fact that the main thread is still a worker thread, the
initialization code is not extra straightforward. By queuing an event to
the main worker, the startup of all listeners is done at a fully
operational state with all workers fully functional.

The service initialization code was also flawed in the sense that it would
cause a deadlock if any of the threads would have to check for the user
permissions. This is mainly a problem with the authenticator modules but
the benefits of the per service pre-loading of users is most likely
superficial. In theory startup will be faster as each thread now queries
the users in parallel.
2018-12-04 11:50:43 +02:00
Markus Mäkelä
ad12ff6d06
MXS-2196: Rename dcb.h to dcb.hh 2018-12-04 11:50:43 +02:00
Markus Mäkelä
3b5e45ceee
MXS-2196: Combine session.h and session.hh
Combined the public session headers into one.
2018-12-04 11:43:38 +02:00
Esa Korhonen
d9ae298102 MXS-2205 Combine maxscale/server.h with maxscale/server.hh
The server-struct is still used in several .h-files.
2018-12-03 16:47:27 +02:00
Esa Korhonen
3e5818fcb6 MXS-2205 Convert mysql_utils.h to .hh 2018-12-03 14:05:21 +02:00
Esa Korhonen
1701f87f00 MXS-2205 Convert internal/maxscale.h and internal/dcb.h to .hh 2018-12-03 13:49:08 +02:00
Esa Korhonen
36792607d8 MXS-2205 Combine internal/modules.h with internal/modules.hh 2018-12-03 13:36:25 +02:00
Esa Korhonen
344c7dde4a MXS-2205 Combine internal monitor headers
Contents of monitor.h moved to monitor.hh
2018-12-03 13:32:09 +02:00
Esa Korhonen
0c7e737eb7 Move some mysql/mariadb utilities to maxutils
Can be used in system tests later on.
2018-11-30 13:03:37 +02:00
Niclas Antti
1108132cbd MXS-2057 Do not require systemd libraries
Exclude systemd usage if the library is not installed.
Only excluding what is necessary. This keeps the object size the
same and still compiles most of the code.
2018-11-09 16:45:59 +02:00
Niclas Antti
f29e5b65de MXS-2057 systemd watchdog
Systemd wathdog notification at a little more than 2/3 of the
systemd configured time. In the service config (maxscale.service)
add e.g. WatchdogSec=30s to set and enable the watchdog.
For building: install libsystemd-dev.

The next commit will modify cmake configuration and code to
conditionally compile the new code based on existence of libsystemd-dev.
2018-11-09 16:45:59 +02:00
Markus Mäkelä
75f9921ca2
Merge branch '2.2' into develop 2018-10-02 10:18:09 +03:00
Markus Mäkelä
288fbc8c33
MXS-2075: Only enable stdout redirection for maxscale
The stdout redirection must not be enabled for the other programs as they
are not run as daemon processes.
2018-10-02 09:44:02 +03:00
Markus Mäkelä
62e5f988c5
MXS-2075: Redirect stdout and stderr to the log
If the log file is successfully opened, both stdout and stderr are
redirected to it. This helps catch ASAN reports without having to read the
system journal files.

As the output is redirected to a file, some of the output was made visible
only in non-daemon mode. This helps keep the log file clean and readable.
2018-10-02 09:44:02 +03:00
Markus Mäkelä
9278da1f54
MXS-2067: Remove spinlock.h
Removed the spinlock.h header and replaced with plain pthread types and
functions.
2018-09-28 12:18:24 +03:00
Markus Mäkelä
f17dfdbc2b
Fix filter destruction
The filter instances weren't cleared before the dynamically loaded
libraries were unloaded which caused a crash.
2018-09-24 12:08:04 +03:00
Markus Mäkelä
71ffef5708
Partially revert 4ba011266843857bbd3201e5b925a47e88e1808f
Add back leading operator enforcement.
2018-09-20 15:57:30 +03:00
Markus Mäkelä
58c0b4f5f4
MXS-1632: Remove the unused statistics code
The statistics code was almost completely unused.
2018-09-10 14:14:20 +03:00
Niclas Antti
c447e5cf15 Uncrustify maxscale
See script directory for method. The script to run in the top level
MaxScale directory is called maxscale-uncrustify.sh, which uses
another script, list-src, from the same directory (so you need to set
your PATH). The uncrustify version was 0.66.
2018-09-09 22:26:19 +03:00
Markus Mäkelä
26dfb19ea4
Make routingworker.hh public
Given that worker.hh was public, it made sense to make routingworker.hh
public as well. This removes the need to include private headers in
modules and allows C++ constructs to be used in C++ code when previously
only the C API was available.
2018-09-04 13:04:08 +03:00
Esa Korhonen
763e1395ae Print port with 'enable-statement-logging' 2018-09-03 11:08:33 +03:00
Johan Wikman
32c4e60516 Do not re-initialize the log
Do not re-initialize the log without it having been finished
in between.
2018-08-30 15:03:06 +03:00
Markus Mäkelä
d9ddf0f720
Reinstate implicit log initialization
As some of the functionality depends on the log being default initialized
in the case an error occurs, the code needed to be reinstated.
2018-08-29 11:06:12 +03:00
Markus Mäkelä
9adc08a686
Move log initialization into a function
This will be of help when the implicit log initialization is added back.
2018-08-29 11:06:11 +03:00