Commit Graph

75 Commits

Author SHA1 Message Date
f6731a898d Update change date 2019-11-13 08:37:17 +02:00
fdfbf3e133 Update 2.4.3 change date 2019-11-05 12:21:00 +02:00
861e27eb00 Merge branch '2.3' into 2.4 2019-10-29 14:04:31 +02:00
baf9e4078a MXS-2446 Ensure that the URLs reflects m_nodes_by_id
If code that may remove items from m_nodes_by_id (Clustrix nodes
keyed by id) succeeds, we must update the vector of health check
URLs also in the case that code that _may_ add items to m_nodes_by_id
fails.
2019-07-03 12:42:22 +03:00
1d87b88c50 Avoid using sqlite3_errstr()
The function is not in old SQLite3-versions such as the one used by
Centos6.
2019-06-27 10:55:24 +03:00
2ab9aa9a94 Update 2.4.0 Change Date 2019-06-25 09:19:55 +03:00
04fdaf1fdb MXS-2556 Make config::Configuration aware of its object
The name of the object (i.e. the section name from the configuration
file), is now stored in the configuration object for that object.

That way, more contextual and hence morfe user friendly errors and
warnings can be generated.
2019-06-11 11:05:15 +03:00
8fa8181009 MXS-2540 Use new conf. mech. in Clustrix monitor 2019-06-05 11:10:28 +03:00
69dea5a81e MXS-2537 Turn 'cluster_monitor_interval' into duration 2019-06-05 11:02:34 +03:00
60d065473e MXS-2481 Handle sqlite3 oom error 2019-05-28 12:36:21 +03:00
feae0cda17 MXS-2481 Dont log confusing things
At first start there will be no persistent information. No point
in logging that we will not use that information.
2019-05-28 12:36:21 +03:00
8204c5099b MXS-2481 Ensure directory exists before creating db 2019-05-28 12:36:21 +03:00
d0153f6ce3 clustrixmonitor: Add missing include 2019-05-21 12:50:10 +03:00
cf46004bd8 Make the servers-array in Monitor private
This prevents derived classes from modifying the array directly,
which would be unsafe.
2019-05-21 10:58:24 +03:00
c801789ff3 Cleanup monitor running state 2019-05-17 13:34:48 +03:00
08b4c26652 Monitor types and fields cleanup
Moves some enums to class enums. Moves some free functions to class methods.
2019-05-17 13:34:48 +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
d3a1f5c51f MXS-2463 Prefer range loops
Also consistently use 'kv' as in key-value as the element name
when the collection looped over is a map.
2019-05-07 10:36:21 +03:00
4cf29bea36 MXS-2463 Rename m_nodes to m_nodes_by_id
Makes it obvious it is a map.
2019-05-07 10:36:21 +03:00
3c9ad0e452 MXS-2463 Ignore persisted data if bootstraps have changed
If there have been any changes in the bootstrap servers specified
for the Clustrix monitor, then the persistent connection information
is not used.

Otherwise, if the bootstrap server is changed and inaccessible, we
may connect to another cluster than the intended one.
2019-05-07 10:36:21 +03:00
ff33453e1a MXS-2463 Prepare for another set of queries
Persisted information about dynamic nodes must be used only if
the bootrap information has not been changed, as otherwise we risk
using information that is not valid.
2019-05-07 10:36:21 +03:00
6f607e13de MXS-2446 Do not assume created server exists
"Once you eliminate the impossible, whatever remains, no matter
 how improbable, must be the truth." Arthur Conan Doyle

Since server objects are never destroyed, currently the only
explanation for the crash described in MXS-2446 is that a server
created at runtime could not, immediately after the creation, be
found using its name.
2019-05-06 12:13:29 +03:00
86b099b487 MXS-2468 When the URLs change, HTTP GET must be cancelled
If the nodes change while a multi HTTP GET is in process, the
corresponding delayed called must be cancelled. Otherwise we
eventually would end up attempting to update the state of the
nodes using the wrong result.
2019-05-03 15:00:00 +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
8b29e70f63 MXS-2428 Allow fixed Clustrix configuration
If 'dynamic_node_detection' has been set to false, then the
Clustrix monitor will not dynamically figure out what nodes are
available, but instead use the bootstrap nodes as such.

With 'dynamic_node_detection' being false, the Clustrix monitor
will do no cluster checks, but simply ping the health port of
each server.
2019-04-16 13:58:27 +03:00
e09a6c8100 MXS-2428 Add 'dynamic_node_detection' 'health_check_port'
'dynamic_node_detection' specifies whether the Clustrix monitor
should dynamically figure out what nodes there are, or just rely
upon static information.

'health_check_port' specifies the port to be used when perforing
the health check ping.
2019-04-16 13:58:27 +03:00
893059c537 MXS-2424 Use persisted nodes if bootstrap node missing
At runtime the Clustrix monitor will save to an sqlite3
database information about detected nodes and delete that
information if a node disappears.

At startup, if the monitor fails to connect to a bootstrap
node, it will try to connect any of the persisted nodes and
start from there.

This means that in general it is sufficient if the Clustrix
monitor at the very first startup can connect to a bootstrap
node; thereafter it will get by even if the bootstrap node
would disappear for good.
2019-04-12 16:29:21 +03:00
164ca7b5f1 MXS-2424 Stop passing redundant information around
mysql_get_host_info(MYSQL*) returns enough information to identify
the connection.
2019-04-12 16:29:21 +03:00
c422aafe1d MXS-2424 Refactor for further changes
In subsequent change(s) persisted node information will be used
as a last resort to connect to a Clustrix node.
2019-04-12 16:29:21 +03:00
875146f53c MXS-2424 Store information about dynamic Clustrix nodes
Information about the detected Clustrix nodes is now stored to
a Clustrix monitor specific sqlite-database. This will be used
for bootstrapping the Clustrix monitor, in case a statically
defined bootstrap server is unavailable.
2019-04-12 16:29:21 +03:00
d89f0c062b MXS-2271 Change Monitor->m_name to std::string
Also, monitor address is no longer printed.
2019-04-02 13:08:38 +03:00
84bf241dd1 MXS-2339 A running Clustrix node is regarded as master
In this context master should be interpreted as "can be read
and written to".

Marking them as master requires less changes in RWS to make it
usable with a Clustrix cluster.
2019-04-02 08:13:50 +03:00
858327acf7 Rename Being Drained to Draining
With this, the words are unique and can be searched for more easily. This
does not fix the test failure of mxs2273_being_drained.
2019-03-28 13:21:24 +02:00
bf5f80b13b Fix ClustrixMonitor
The cluster check can only be made after the monitor has been
started. If done when monitor is configured it will at startup
be done when services are not yet available and hence they will
not be populated with the dynamically discovered servers.
2019-03-25 13:56:39 +02:00
203bba0e1d Add support for multiple runtime error messages
Storing all the runtime errors makes it possible to return all of them
them via the REST API. MaxAdmin will still only show the latest error but
MaxCtrl will now show all errors if more than one error occurs.
2019-03-21 18:19:10 +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
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
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
21d9ec34cf MXS-2330 Use simpler queries
Since the current node id can be obtained using the function gtmnid()
the queries for finding out whether a node is in the quorum and whether
it is softfailed can be made simpler.
2019-02-15 08:09:03 +02:00
5c34550b40 MXS-2330 Do not use softfailed node as hub
When a softfailed node is finally revoked, it will appear as the
single node in a functioning Clustrix cluster. To ensure that the
Clustrix monitor will not stick to that node, if the node that is
used as hub is softfailed, it is immediately replaced with another
node.
2019-02-15 08:09:03 +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
cac1d76e48 MXS-2314 Monitor decides whether servers are added to services
When the servers of a service are defined by a monitor, then
at startup all servers of the monitor should be added to relevant
services. Likewise, when a server is added to or removed from a
monitor at runtime, those changes should affect services as well.

However, whether that should happen or not depends upon the monitor.
In the case of the Clustrix monitor this should not happen as it
adds and removes servers depending on the runtime state of the
Clustrix cluster.
2019-02-11 13:03:18 +02:00
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
692dd195ec MXS-2275 Trigger cluster check if node is down
The likely reason for a node being down is that some cluster level
modifications have been performed. Consequently a cluster check should
be triggered in that case.
2019-02-04 12:02:58 +02:00
b582119d27 MXS-2275 Check for softfailed nodes
When checking the node info, also include information about wheter
a node is being SOFTFAILed. If it is, turn on the `Being Drained`
bit.

A node is SOFTFAILed with the intention of removing it, so better
not to create new connections to it as they later would be broken
when the node is actually taken down.
2019-02-01 11:00:53 +02:00
55b1e031d6 MXS-2275 Fix breakage due to rebasing 2019-02-01 11:00:53 +02:00
6d60714a17 MXS-2275 Always log monitor instance name
When logging something, always log the monitor instance name
as well.
2019-02-01 11:00:53 +02:00