Commit Graph

195 Commits

Author SHA1 Message Date
5a698be45c MXS-2218 Centralize worker shutdown handling 2019-01-08 16:01:36 +02:00
c27a24ab37 MXS-2218 If startup fails, main worker must also be shutdown 2019-01-08 16:01:36 +02:00
6ba2cb61df MXS-2218 Implement housekeeper in terms of MainWorker 2019-01-08 16:01:36 +02:00
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
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
5a9e84d39a Merge branch '2.3' into develop 2018-12-18 00:00:00 +02:00
35d31801bb Merge branch '2.2' into 2.3 2018-12-17 23:52:56 +02:00
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
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
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
ad12ff6d06 MXS-2196: Rename dcb.h to dcb.hh 2018-12-04 11:50:43 +02:00
3b5e45ceee MXS-2196: Combine session.h and session.hh
Combined the public session headers into one.
2018-12-04 11:43:38 +02:00
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
3e5818fcb6 MXS-2205 Convert mysql_utils.h to .hh 2018-12-03 14:05:21 +02:00
1701f87f00 MXS-2205 Convert internal/maxscale.h and internal/dcb.h to .hh 2018-12-03 13:49:08 +02:00
36792607d8 MXS-2205 Combine internal/modules.h with internal/modules.hh 2018-12-03 13:36:25 +02:00
344c7dde4a MXS-2205 Combine internal monitor headers
Contents of monitor.h moved to monitor.hh
2018-12-03 13:32:09 +02:00
0c7e737eb7 Move some mysql/mariadb utilities to maxutils
Can be used in system tests later on.
2018-11-30 13:03:37 +02:00
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
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
75f9921ca2 Merge branch '2.2' into develop 2018-10-02 10:18:09 +03:00
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
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
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
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
71ffef5708 Partially revert 4ba011266843857bbd3201e5b925a47e88e1808f
Add back leading operator enforcement.
2018-09-20 15:57:30 +03:00
58c0b4f5f4 MXS-1632: Remove the unused statistics code
The statistics code was almost completely unused.
2018-09-10 14:14:20 +03:00
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
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
763e1395ae Print port with 'enable-statement-logging' 2018-09-03 11:08:33 +03:00
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
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
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
8b653133a7 Add shutdown detection
The maxscale_is_shutting_down function is used to detect when MaxScale
should stop. This fixes a race condition in the code where the workers has
not yet been initialized but a termination signal has been received. It
also replaces the misuse of the service_should_stop variable with a proper
function.
2018-08-29 11:06:11 +03:00
c92aa02961 Don't use log before initialization
The print_log_n_stderr function used to implicitly initialize the log
manager. As this is no longer done, no logging must be done before the log
manager is initialized.
2018-08-27 14:03:39 +03:00
fe7d7475a4 Improve PID file check
The executable name of the PID is now checked to be maxscale. This fixes
the problem where MaxScale would refuse to start if a stale PID file had a
PID of a process that's not a MaxScale process.
2018-08-23 15:46:46 +03:00
ad36a50e97 Remove log initialization form print_log_n_stderr
The log manager must not be initialized twice. If an error is to be logged
to a file, the log manager has already been initialized.
2018-08-23 15:46:46 +03:00
8e7b012852 Don't call some of atexit functions twice
Registering of atexit functions was fixed so these functions don't need
to be called here anymore.
2018-08-22 22:51:32 +03:00
3f53eddbde MXS-2020 Replace ss[_info]_dassert with mxb_assert[_message] 2018-08-22 11:34:59 +03:00
3576780f78 MXS-2008 Update gateway and tests to initialize maxbase
Update gateway and tests to initialize maxbase using

  maxbase::init();

instead of initializing individual components.
2018-08-21 10:02:39 +03:00
88f1795412 MXS-2008 Move Worker and MessageQueue to maxbase 2018-08-21 10:02:39 +03:00
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
c38dcff53c MXS-2019: Remove header and footer output
Now that the exit handlers work correctly, the output of `maxscale
--version` no longer consists of a single line but multiple lines in both
stdout and stderr. Removing the printing to stderr guarantees that the
correct output is produced.
2018-08-20 10:04:12 +03:00
667e9df97c Merge branch '2.2' into develop 2018-08-17 18:10:44 +03:00
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
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
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
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
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