12596 Commits

Author SHA1 Message Date
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
Johan Wikman
de970e579e Merge branch '2.3' into develop 2019-01-23 15:40:16 +02:00
Johan Wikman
09958afd61 Merge branch '2.3.3' into 2.3 2019-01-23 15:39:15 +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
465f9f16c4 MXS-2271 Remove unused monitor entrypoints 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
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
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
Johan Wikman
0d1743c76b Merge branch '2.3' into develop 2019-01-21 14:07:47 +02:00
Esa Korhonen
7fb80c530b Merge branch '2.3' into develop 2019-01-21 14:05:16 +02:00
Johan Wikman
f54d015267 Update 2.3 maintenance version 2019-01-21 13:43:53 +02:00
Johan Wikman
d350589ce1 Update 2.3.3 release date 2019-01-21 13:43:53 +02:00
Markus Mäkelä
5b7c63fef7 Fix quoted value skipping
The return value wasn't checked and the code assumed that a non-end
iterator was always returned.
2019-01-21 13:43:53 +02:00
Markus Mäkelä
9542641dae Fix buffer overrun on non-terminated comment
Also made the behavior consistent when an incomplete comment is found.
2019-01-21 13:43:53 +02:00
Johan Wikman
b4de91e02e Update 2.3.3 release date 2019-01-21 13:28:30 +02:00
Esa Korhonen
7f978f275f MXS-2223 Log a message when a slave is discriminated due to replication lag
Both the replication lag and the message printing state are saved in SERVER,
although the values are mostly used by readwritesplit. A log message is printed
both when a server goes over the limit and when it comes back below.
Because of concurrency issues, a message may be printed multiple times before
different threads detect the new message state.

Documentation updated to explain the change.
2019-01-21 13:02:18 +02:00
Markus Mäkelä
28644e9626
Fix quoted value skipping
The return value wasn't checked and the code assumed that a non-end
iterator was always returned.
2019-01-18 10:25:12 +02:00
Markus Mäkelä
2e95812b71
Fix buffer overrun on non-terminated comment
Also made the behavior consistent when an incomplete comment is found.
2019-01-18 10:24:59 +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
Esa Korhonen
3b55893a20 Combine maxscale/buffer.h with maxscale/buffer.hh 2019-01-17 12:37:40 +02:00
Johan Wikman
5d959a30ac Merge branch '2.3' into develop 2019-01-17 11:11:38 +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
640bf40eed MXS-2219 Make a non-URL async HTTP request READY
An asynchronous HTTP request for 0 URLs is immediately
in READY state.
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
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
Johan Wikman
7f6f5191cc MXS-2219 Update documentation
The clustrix monitor user must have SELECT grant on
- system.membership
- system.nodeinfo
2019-01-17 11:11:21 +02:00
Johan Wikman
994b76ff79 MXS-2219 Provide STL iterator for MXS_MONITORED_SERVER 2019-01-17 11:11:21 +02:00
Johan Wikman
a9fd9c92e2 MXS-2219 Add iterator adapter
Iterator adapter for making it possible to iterate over an
intrusive singly linked list in an STL fashion.
2019-01-17 11:11:21 +02:00
Johan Wikman
0dfdff1f95 Update 2.3.3 release notes and change log 2019-01-17 11:11:04 +02:00
Johan Wikman
95f6786b3c Update 2.3.3 release notes and change log 2019-01-17 11:02:12 +02:00
Markus Mäkelä
ebbb8a771c
Merge branch '2.3' into develop 2019-01-17 10:55:27 +02:00
Markus Mäkelä
92b50196ed
Merge branch '2.3.3' into 2.3 2019-01-17 10:49:37 +02:00
Markus Mäkelä
a469ef83b6
MXS-2217: Pick DCB owner before adding to epoll
There is a race condition between the addition of the DCB into epoll and
the execution of the event that initiates the protocol pointer for the DCB
and sends the handshake to the client. If a hangup event would occur
before the handshake would be sent, it would be possible that the DCB
would get freed before the code that sends the handshake is executed.

By picking the worker who owns the DCB before the DCB is placed into the
owner's epoll instance, we make sure no events arrive on the DCB while the
control is transferred from the accepting worker to the owning
worker.
2019-01-17 10:35:49 +02:00
Markus Mäkelä
a3fa2f8111
Merge branch '2.3' into develop 2019-01-16 16:31:14 +02:00
Markus Mäkelä
ba393dbfb2
Merge branch '2.3.3' into 2.3 2019-01-16 16:23:56 +02:00
Markus Mäkelä
519cd7d889
Don't call python3 directly
Calling it directly from the script adds a dependency on it and we don't
what that.
2019-01-16 16:19:35 +02:00
Markus Mäkelä
68d33a3ae4
MXS-2266: Add test case
Extended the existing tests to cover MXS-2266.
2019-01-16 16:19:35 +02:00
Markus Mäkelä
317166540f
MXS-2266: Close prepared statements with internal ID
The ID used to store the prepared statements uses the internal ID and
using the external ID caused unwanted memory use and a false warning.
2019-01-16 16:19:35 +02:00
Markus Mäkelä
39dc83f13c
Don't call python3 directly
Calling it directly from the script adds a dependency on it and we don't
what that.
2019-01-16 16:00:32 +02:00