Commit Graph

229 Commits

Author SHA1 Message Date
476dc80bc9 Move settings shared between MariaDBMonitor and MariaDBServer to container
Removes the need to communicate these settings via call parameters.
2019-05-10 14:48:41 +03:00
d10c7a4140 Rearrange MariaDB-Monitor settings variables
Moves some of the settings to a dedicated container to separate them
from other fields.
2019-05-10 14:48:41 +03:00
a9b1e3a442 Move some Monitor fields to private and protected
None of the fields should be publicly writable and some should not even
be writable from derived classes.
2019-05-10 14:48:41 +03:00
418ccf861d Format routers and monitors 2019-05-10 10:31:12 +03:00
3d420dee6f MXS-2329 Use durations in MariaDB monitor 2019-04-30 13:02:53 +03:00
75c0ac5323 Move items from MonitorWorker to MonitorWorkerSimple
MonitorWorker only enforces the use of a worker thread but otherwise
does not define how the monitor is implemented.
2019-04-24 11:27:11 +03:00
067660e3e7 Merge branch '2.3' into develop 2019-04-16 16:55:12 +03:00
2ca9337da1 Merge branch '2.2' into 2.3 2019-04-16 16:34:57 +03:00
5ba305c2c1 MXS-2426 Do not permanently disable automatic cluster operations when they fail
Only disabled for "failcount" monitor ticks. Also turns some related log
messages to notices.
2019-04-16 11:26:34 +03:00
3c188bf421 Merge branch '2.3' into develop 2019-04-16 11:23:49 +03:00
f8a22d0ac0 MXS-2344 Add setting for enabling SSL for replication
If the monitor setting "replication_master_ssl" is set to on, any CHANGE MASTER TO-command
will have MASTER_SSL=1. If set to off or unset, MASTER_SSL is left unchanged to match existing
behaviour.
2019-04-15 19:15:45 +03:00
4c6306e363 Merge commit '5cdba97ec7ee7f1ef74249b952774adf1b111464' into develop 2019-03-22 13:25:58 +02:00
5cdba97ec7 Merge commit '216eb904c557509ea5a3216e68e274df957ab807' into 2.3 2019-03-22 10:48:31 +02:00
216eb904c5 MXS-1991 Allow replication_user and replication_password be set runtime
Because runtime changes are performed one at a time, adding replication credentials
to a mariadbmon which didn't have any would cause an error to be printed, and
the monitor would not start.

This is now fixed by allowing replication_user without replication_password. This
is not an ideal solution as a configuration file with only replication_user would be
accepted. Also, when adding the credentials to a monitor, replication_user must be
given first to avoid the error.
2019-03-21 17:06:24 +02:00
09ae5d741c MXS-2384 Update servers concurrently in MariaDB-Monitor
All servers are now updated in their own threads simultaneously. This
should reduce the possibility of having significantly different gtid:s
shown for different servers.
2019-03-20 10:40:45 +02:00
3ac1b40b63 MXS-2271 Refactor disk space checking
The functions are now in MonitorServer. Disk space can only be checked
during specific ticks. If a server misses a tick (e.g. is down) it will
be checked after disk_space_check_interval has passed.
2019-03-20 10:40:45 +02:00
6b14479b6c MXS-2271 Rename MXS_MONITORED_SERVER to MonitorServer 2019-03-19 13:32:38 +02:00
14b4fa632a MXS-2271 Move Monitor inside maxscale-namespace
Rearranged monitor.cc by namespace.
2019-03-15 12:57:35 +02:00
5e3f837b42 MXS-2271 Continue monitor header cleanup
No more free functions. Local functions moved to anonymous namespace.
2019-03-15 12:57:35 +02:00
f05a2317d9 Merge branch '2.3' into develop 2019-03-12 11:22:34 +02:00
040562f718 MXS-2342 Run MariaDBMonitor diagnostics concurrent with the monitor loop
This fixes some situations where MaxAdmin/MaxCtrl would block and wait
until a monitor operation or tick is complete. This also fixes a deadlock
caused by calling monitor diagnostics inside a monitor script.

Concurrency is enabled by adding one mutex per server object to protect
array-like fields from concurrent reading/writing.
2019-03-12 10:50:16 +02:00
a8949b2560 MXS-2271 Move free monitor functions into classes
Functions are divided to MonitorManager, Monitor, or the monitored
server.
2019-03-12 10:29:55 +02:00
40f24aaaee MXS-2271 Remove m_monitor self pointer 2019-03-12 10:29:55 +02:00
1858fe9127 MXS-2271 Monitor modifications always go through Monitor::configure()
Previously, runtime monitor modifications could directly alter monitor fields,
which could leave the text-form parameters and reality out-of-sync. Also,
the configure-function was not called for the entire monitor-object, only the
module-implementation.

Now, all modifications go through the overridden configure-function, which calls the
base-class function. As most configuration changes are given in text-form, this
removes the need for specific setters. The only exceptions are the server add/remove
operations, which must modify the text-form serverlist.
2019-03-12 10:19:45 +02:00
9572ff84ea Merge branch '2.3' into develop 2019-03-05 10:37:56 +02:00
6332f0876b Merge remote-tracking branch 'origin/2.3' into 2.3 2019-03-05 04:59:26 +02:00
83fc3b1bc2 Merge branch '2.3' into develop 2019-03-04 17:43:53 +02:00
4fd4b726a1 MXS-2325 Only enable events that were enabled on the master
The monitor now continuously updates a list of enabled server events. When
promoting a new master in failover/switchover, only events that were enabled
on the previous master are enabled on the new. This avoids enabling events
that may have been disabled on the master yet stayed in the SLAVESIDE_DISABLED-
state on the slave.

In the case of reset-replication command, events on the new master are only
enabled if the monitor had a master when the command was launched. Otherwise
all events remain disabled.
2019-03-04 16:00:07 +02:00
7904cdaefb Fix assume_unique_hostnames
It was always set to true when the servers were created.
2019-03-04 08:53:12 +02:00
2a63fb0776 MXS-2304 Store config parameter container as value in monitor and service 2019-02-22 16:53:17 +02:00
5828c93112 MXS-2304 Convert static config parameter methods to non-static
Parameter handling changed in several places.
2019-02-22 15:17:55 +02:00
7a99b5d253 MXS-2314 Define monitor state in terms of worker state
Worker::STOPPED    -> MONITOR_STATE_STOPPED
Worker::POLLING    -> MONITOR_STATE_RUNNING
Worker::PROCESSING -> MONITOR_STATE_RUNNING

By defining the monitor state from the worker state there is
no risk they will ever get out of sync. And there is one thing
less to maintain.
2019-02-11 13:03:18 +02:00
ed80680da9 MXS-2304 Add ctor/dtor and other functions to parameter class
The manipulation functions are currently static so that the container can be initialized
if required. This will be fixed later.

The new functions are taken into use in monitor management.
2019-02-07 13:51:16 +02:00
5a409f313a MXS-2304 Config string handling cleanup
Using correct functions in most cases.
2019-02-05 10:52:46 +02:00
b357717149 MXS-2304 Use get_bool() instead of config_get_bool() 2019-02-01 17:18:49 +02:00
7cb969b0d9 MXS-2271 Clean up server list parsing functions, use in monitor config
The functions now return the parsed array.
2019-02-01 14:59:51 +02:00
c8a84cebd0 MXS-2304 Use get_integer() instead of config_get_integer() 2019-01-31 18:12:25 +02:00
0903648542 MXS-2271 Move connection settings inside settings struct
Since the settings are now protected fields, all related functions were
moved inside the monitor class. mon_ping_or_connect_to_db() is now a method
of MXS_MONITORED_SERVER. The connection settings class is defined inside the
server since that is the class actually using the settings.
2019-01-31 17:00:47 +02:00
cef4e836bc MXS-2271 Store monitored servers in a vector
The array is still a public member because it's used in several non-member functions.
2019-01-28 15:41:00 +02:00
f6cec41dd8 MXS-2271 Monitor config name and instance name are parameters of createInstance()
Also adds/moves some comments from previous entrypoints. Name and module
are now constant fields.
2019-01-24 09:49:53 +02:00
9ac8bf93bb MXS-2271 Rename monitor-related classes
MXS_MONITOR->Monitor
MonitorInstance->MonitorWorker
MonitorInstanceSimple->MonitorWorkerSimple
2019-01-22 15:59:17 +02:00
dadb6a1a79 MXS-2271 All monitors inherit from MXS_MONITOR
Most of the API entrypoints are replaced with virtual functions.
2019-01-22 15:59:17 +02:00
bec9455a74 MXS-2205 Combine routingworker.h with routingworker.hh 2018-12-05 11:12:20 +02:00
ad12ff6d06 MXS-2196: Rename dcb.h to dcb.hh 2018-12-04 11:50:43 +02:00
35cdbc7220 MXS-2205 Convert modulecmd.h to .hh 2018-12-03 14:06:02 +02:00
3e5818fcb6 MXS-2205 Convert mysql_utils.h to .hh 2018-12-03 14:05:21 +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
a1e1ac0012 Move string_printf to maxbase
Can be used in tests.
2018-11-29 12:21:40 +02:00
0a5a3309e0 Add missing quotes when printing server names
Some of the log messages didn't have the quotes.
2018-11-23 14:02:09 +02:00
fb52e565fe Store capabilities of monitored server
Checking the version number in various places in the code gets confusing.
It's better to check the version in one place and record the relevant data.
2018-11-21 17:36:52 +02:00