893 Commits

Author SHA1 Message Date
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
92b27500c7 MXS-2276 Fix things due to MXS_MONITOR -> Monitor change 2019-01-25 10:30:27 +02:00
Johan Wikman
42b3402a71 MXS-2276 Use dynamic servers also for cluster check
Once the monitor has been able to connect to a clustrix node
and obtain the clustrix nodes, it'll primarily use those nodes
when looking for a Clustrix node to be used as the "hub".
With this change it is sufficient (but perhaps unwise) to provide
a single node boostrap node in the configuration file.

Some other rearrangements and renamings of functions has also been
made.
2019-01-25 10:30:27 +02:00
Johan Wikman
6937bb6663 MXS-2274 Create globally unique name for dynamic servers
Convention needs to be that the runtime object creating other objects
needs to incorporate its own name in the name of any object created.
Together with the '@@' prefix that ensures that the created name will
be reasonably globally unique.
2019-01-24 17:42:29 +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
17fc2ba88a Store error status into QueryResult object
The QueryResult-object remembers if a conversion failed. This makes checking
for errors more convenient, as just one check per row is required. The conversion
functions always return a valid value.
2019-01-22 15:34:19 +02:00
Johan Wikman
a7f0bcc4c5 MXS-2219 Close server connection if unusable
If a server cannot be used, close the associated MYSQL connection.
Further, when an existing connection is used, verify that the server
is still part of the quorum.
2019-01-21 15:41:55 +02:00
Johan Wikman
c51895eaad MXS-2219 Replace for_each with regular for loops
In this context the former provides no advantage.
2019-01-21 15:41:55 +02:00
Johan Wikman
01c3da9e0f MXS-2219 Check that monitored server is part of quorum
When the monitor connects to a Clustrix node, it checks that
the node is part of the quorum, before taking it into use.
2019-01-21 15:41:55 +02:00
Johan Wikman
6b556859ce MXS-2219 Use system.membership as primary table
From system.membership we can find out what server exist in the
cluster while system.nodeinfo contains information about those
servers. If a node goes down, it will disappear from system.nodeinfo,
but not from system.membership. Consequently, we must start from
system.membership and then fetch more information from system.nodeinfo.

Incidentally, a query like

    SELECT ms.nid, ni.iface_ip
    FROM system.membership AS ms
        LEFT JOIN system.nodeinfo AS ni ON ms.nid=ni.nodeid;

should provide all information in one go, but it seems that such joins
are not supported on the system tables.
2019-01-21 15:41:55 +02:00
Johan Wikman
f7c840df26 MXS-2219 Update datastructures instead of recreating them
The node infos of the Clustrix servers are now kept around and
and updated based upon changing conditions instead of regularly
being re-created.

Further, the server is now looked up by name only right after
having been created (and that only due to runtime_create_server()
currently being used).

The state of the dynamically created server is now updated directly
as a result of the health-check ping, while the state of the bootstrap
servers is updated during the tick()-call according to the monitor
"protocol".
2019-01-21 15:41:55 +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
ac61e205d8 MXS-2219 Dynamically create Clustrix servers
MaxScale server objects are now created for all Clustrix nodes.
Currently the name is "Clustrix-Server-N" where N is the number
of the node.

The server is created using runtime_create_server() that has been
modified so that it optionally will not persist the created server.
That is probably just a temporary solution as a monitor should not
need to include .../core/internal-stuff.
2019-01-17 11:11:21 +02:00
Johan Wikman
bd2eb3d5dc MXS-2219 Allow starting Clx monitor with no servers 2019-01-17 11:11:21 +02:00
Johan Wikman
89c059411d MXS-2219 Add health check threshold
Make it configurable how many times a node may fail to respond
on the health check port before it is considered to be down.
2019-01-17 11:11:21 +02:00
Johan Wikman
880842e55d MXS-2219 Perform cluster monitoring as well
Now the monitor
- will frequently ping the health port of each server
- less frequently check from system.membership the actual
  number of available nodes
and act accordingly.

Currently, the updated servers are the ones listed in the conf
file. Subsequently this will be changed so that the servers listed
in the configuration file are only used for bootstrapping the monitor
and server objects are then created dynamically according to what is
found in the cluster.
2019-01-17 11:11:21 +02:00
Esa Korhonen
dae99b2acd Merge branch '2.3' into develop 2019-01-15 15:57:06 +02:00
Esa Korhonen
8cef8b9472 Compile MariaDBMonitor unit tests only if flag is set 2019-01-15 15:44:21 +02:00
Esa Korhonen
b4d91d4b9a Move query result helper class to maxsql
Added some asserts to ensure the class is used correctly.
2019-01-14 10:43:17 +02:00
Esa Korhonen
8b53e30678 MXS-2220 Move server status functions inside class 2019-01-08 15:12:47 +02:00
Johan Wikman
f8545a0b7f MXS-2219 Address review comments 2019-01-07 12:59:57 +02:00
Johan Wikman
4512295e40 MXS-2219 Implement rudimentary Clustrix monitoring
The monitor now pings the health check ports of the Clustrix nodes.
A response translates to RUNNING and a non-response to DOWN.
2019-01-07 12:59:27 +02:00
Markus Mäkelä
f0f9c21d1c
Merge branch '2.3' into develop 2019-01-07 10:54:42 +02:00
Markus Mäkelä
8c437c6440
Fix crash in galeramon
An std::string was assigned a null value which will cause a crash.
2019-01-04 12:00:48 +02:00
Esa Korhonen
cf9ac9004e Fix compilation error
A variable had the same name as a type, which confused some compilers.
2019-01-04 10:40:11 +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
eacf88f6a5 MXS-2220 Add server version and type information struct
The old fields are still used.
2018-12-19 13:18:16 +02:00
Johan Wikman
115feab946 MXS-2164 Add skeleton Clustrix monitor 2018-12-18 15:17:09 +02:00
Esa Korhonen
569c66fa28 MXS-2220 Store server parameters in stl containers
The custom parameters are now protected from concurrent access.
2018-12-18 12:34:06 +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
8a8ac26e32 Cleanup monitor.hh
Also removes an unused field from several monitors.
2018-12-11 10:41:56 +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
9f721f725e MXS-2205 Convert maxscale/protocol/mysql.h to .hh 2018-12-05 11:12:20 +02:00
Markus Mäkelä
ad12ff6d06
MXS-2196: Rename dcb.h to dcb.hh 2018-12-04 11:50:43 +02:00
Esa Korhonen
8a570eb6a1 MXS-2205 Combine maxscale/monitor.h with maxscale/monitor.hh 2018-12-03 15:28:06 +02:00
Esa Korhonen
97bb7e7e1a MXS-2205 Combine maxscale/modutil.h with maxscale/modutil.hh 2018-12-03 15:28:06 +02:00
Esa Korhonen
35cdbc7220 MXS-2205 Convert modulecmd.h to .hh 2018-12-03 14:06:02 +02:00
Esa Korhonen
3e5818fcb6 MXS-2205 Convert mysql_utils.h to .hh 2018-12-03 14:05:21 +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
Markus Mäkelä
77585bdb8c
MXS-2197: Make config.h and service.h C++ headers
This is the first step into converting the other headers into C++.
2018-11-30 12:15:57 +02:00
Esa Korhonen
a1e1ac0012 Move string_printf to maxbase
Can be used in tests.
2018-11-29 12:21:40 +02:00
Johan Wikman
55a39268c6 MXS-2163 Make MariaDBMon recognize Clustrix
To allow MariaDBMon to be used with Clustrix we need to handle
Clustrix separately as its apparent version is 5.0.45, which is
lower than what MariaDBMon supports. Further, we must ensure that
Clustrix does not query the slave status as there are no slaves
in the M/S sense in a Clustrix cluster.

NOTE: Once there is a specific Clustrix monitor, this code should
be removed.
2018-11-28 15:27:23 +02:00
Markus Mäkelä
f87ff431c1
Merge branch '2.2' into 2.3 2018-11-27 11:46:47 +02:00