269 Commits

Author SHA1 Message Date
Johan Wikman
ab93216064 MXS-2314 Server added to monitor should be added to service
If the servers of a service are defined by a monitor (the config
has 'cluster=SomeMonitor'), then the addition of a server to a
a monitor should lead to that server being added to the service.
2019-02-11 13:03:18 +02:00
Johan Wikman
b4eb87dfcc MXS-2314 Populate services with servers
The services whose servers are defined using a monitor, will
now be populated from the monitor.

Note, no consideration has yet been given to runtime changes.
2019-02-11 13:03:18 +02:00
Esa Korhonen
35ab911d5c MXS-2304 Use configuration class methods instead of separate implementations
Replaces parameter add/set/remove/free.
2019-02-07 13:51:16 +02:00
Esa Korhonen
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
Esa Korhonen
934be45b68 MXS-2304 Remove config_get_string() and config_get_value_string()
Some functions accessing internal pointers still remain.
2019-02-06 12:58:59 +02:00
Esa Korhonen
4132c9bbbc MXS-2304 Use get_c_str_copy instead of config_copy_string()
Also uses get_string() in core-code when appropriate.
2019-02-05 10:28:37 +02:00
Esa Korhonen
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
Esa Korhonen
f2d2202ea3 MXS-2304 Use get_enum() instead of config_get_enum() 2019-02-01 10:29:24 +02:00
Esa Korhonen
c8a84cebd0 MXS-2304 Use get_integer() instead of config_get_integer() 2019-01-31 18:12:25 +02:00
Esa Korhonen
03411e825d MXS-2271 Move journal_max_age inside settings container 2019-01-31 17:05:35 +02:00
Esa Korhonen
ce9b49d8d5 MXS-2271 Move script-related settings to the settings-container
Also moves related functions to class methods.
2019-01-31 17:05:34 +02:00
Esa Korhonen
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
Johan Wikman
8204b7d875 MXS-2273 Fix issues related to changes in Monitor 2019-01-30 12:38:36 +02:00
Johan Wikman
b650dd4f67 MXS-2273 Drop unnecessary SERVER prefix in names
MXS_MONITORED_SERVER provides enough scope.
2019-01-30 12:16:57 +02:00
Johan Wikman
bc4a52acb0 MXS-2273 Set SERVER_BEING_DRAINED properly
The maintenance and being-drained modes are now set using the same
mechanism.
2019-01-30 12:16:57 +02:00
Johan Wikman
e3d74bd18d MXS-2273 Generalise names
The maintenance flag and being-drain flags will be turned on using
the same variable, so the variable and constant names needs to be
generalized.
2019-01-30 12:16:57 +02:00
Johan Wikman
159d9ccba9 MXS-2273 Move constants to more appropriate locations
Constants now used in the context of MXS_MONITORED_SERVER or
Monitor are now moved from SERVER to MXS_MONITORED_SERVER or
Monitor, respectively.
2019-01-30 12:16:57 +02:00
Johan Wikman
57a94b417d MXS-2273 Move maint_request from SERVER to MXS_MONITORED_SERVER
The _request_ for setting the status of a server relates to the
monitor and its MXS_MONITORED_SERVER, not to the SERVER itself.
2019-01-30 12:16:57 +02:00
Johan Wikman
727d3feb3b MXS-2273 Move code for setting maintenance bit to monitor.cc
Applies to being-drained as well.

Better that this special handling is handled by Monitor that needs it.
2019-01-30 12:16:57 +02:00
Esa Korhonen
6326172325 MXS-2271 Rename basic Monitor fields
Adds the m_-prefix.
2019-01-28 15:41:00 +02:00
Esa Korhonen
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
Esa Korhonen
546b80de4b MXS-2271 Move monitor interval to settings container 2019-01-25 13:46:01 +02:00
Esa Korhonen
10dc0f53e0 MXS-2177 Move check_monitor_permissions() into class 2019-01-25 13:46:01 +02:00
Johan Wikman
0fe5b0bec9 MXS-2276 Expose lower level mon_ping_or_connect_to_db
The functionality is useful also when you do not have a
MXS_MONITORED_SERVER instance.
2019-01-25 10:28:34 +02:00
Esa Korhonen
f559bf3d95 MXS-2271 Move disk space settings to a settings-container 2019-01-24 09:49:53 +02:00
Esa Korhonen
00594cc369 MXS-2271 Move global monitor list inside a local class
Cleans up list locking and handling.
2019-01-24 09:49:53 +02:00
Esa Korhonen
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
Esa Korhonen
9ac8bf93bb MXS-2271 Rename monitor-related classes
MXS_MONITOR->Monitor
MonitorInstance->MonitorWorker
MonitorInstanceSimple->MonitorWorkerSimple
2019-01-22 15:59:17 +02:00
Esa Korhonen
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
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
dd16a09342 MXS-2271 Move some initializers out of monitor_create() 2019-01-17 18:24:28 +02:00
Esa Korhonen
40f58ddec8 MXS-2271 Use std::mutex instead of pthread_mutex 2019-01-17 17:51:39 +02:00
Esa Korhonen
3125d1babf MXS-2271 Convert MXS_MONITOR and MXS_MONITORED_SERVER to classes
First step in monitor refactoring and cleanup.
2019-01-17 17:43:54 +02:00
Johan Wikman
f7d97825fb MXS-2219 Add monitor_stash_current_status
The functions stores the current server status to the monitored
server's mon_prev_status and pending_status fields.

To be used at the start of the monitor loop, before the pending
status fields are updated.
2019-01-17 11:11:21 +02:00
Esa Korhonen
1c647f3753 MXS-2220 Move most remaining functions inside class
Most of the ones still remaining outside are special cases.
Also, removed locking from status manipulation functions as it
has not been required for quite some time.
2019-01-08 15:15:34 +02:00
Esa Korhonen
d5c78eb31f MXS-2220 Move more server functions inside class 2019-01-08 15:12:47 +02:00
Esa Korhonen
8b53e30678 MXS-2220 Move server status functions inside class 2019-01-08 15:12:47 +02:00
Esa Korhonen
93aff0640c MXS-2220 Cleanup server header
Moved items around in preparation for more changes.
2019-01-07 16:10:15 +02:00
Esa Korhonen
764d9a4e75 MXS-2220 Move monitor user and password fields to internal class
Also changed the lengths of the buffers.
2019-01-07 16:10:15 +02:00
Esa Korhonen
40485d746c MXS-2220 Change server name to constant string 2019-01-03 12:13:15 +02:00
Esa Korhonen
09aa54720d MXS-2220 Read server version using public methods
Version related fields have been removed from the public class.
2019-01-03 11:23:14 +02:00
Esa Korhonen
6209d737e9 MXS-2220 server_alloc returns internal type
Also adds default initializers to SERVER fields.
2018-12-14 10:31:57 +02:00
Esa Korhonen
2b0eac2cd0 Move server disk space threshold setting to private Server-class
The setting can be read and written simultaneously and is protected with
a mutex.

The public SERVER-class is now abstract.
2018-12-14 10:18:14 +02:00
Esa Korhonen
63e334d6c0 MXS-2220 mxs::server_status() accepts status flags
The overload is required to get rid of dummy SERVER objects.
2018-12-13 10:20:06 +02:00
Esa Korhonen
8a8ac26e32 Cleanup monitor.hh
Also removes an unused field from several monitors.
2018-12-11 10:41:56 +02:00
Esa Korhonen
e979a73cc0 Remove the STRSRVSTATUS macro
Use server_status() instead.
2018-12-10 15:55:07 +02:00
Esa Korhonen
86574c16fb Return std::string in server_status() 2018-12-10 15:55:07 +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
Esa Korhonen
bec9455a74 MXS-2205 Combine routingworker.h with routingworker.hh 2018-12-05 11:12:20 +02:00
Esa Korhonen
3e5818fcb6 MXS-2205 Convert mysql_utils.h to .hh 2018-12-03 14:05:21 +02:00