1021 Commits

Author SHA1 Message Date
Esa Korhonen
e6bf020b9e Continue name resolution fixing, add unit test
name_lookup() now returns all results given by getnameinfo(). When searching
for a server, finding one matching address in the lookup-results is enough for
a match.

Also, added a test for name_lookup(). The test is minimal on its own, as hardcoded
test cases are not generally valid.
2019-08-16 12:52:52 +03:00
Markus Mäkelä
bf551c5b1e
Merge branch '2.3' into 2.4 2019-08-09 03:01:00 +03:00
Markus Mäkelä
9f6efef67a
MXS-2576: Update states atomically in csmon
This prevents false transient states from occurring.
2019-08-09 01:54:09 +03:00
Esa Korhonen
d4b712ae84 MXS-2546 Add DNS-resolving to topology detection
When matching hostnames between MaxScale server configuration and the
SHOW SLAVE STATUS-output, use DNS-resolution if a simple string comparison
doesn't find an answer. Results of the resolution are saved to avoid
repeating the operation for the same address.
2019-07-22 11:10:23 +03:00
Esa Korhonen
5df1f2561c MXS-2546 Save master server to slave connection object
Simplifies later checks and removes duplicate code. The "assume_unique_hostnames"-
setting is no longer required within the MariaDBServer-class.
2019-07-19 17:10:10 +03:00
Esa Korhonen
2a1925744b MXS-2546 Separate slave connection settings to its own class
The settings are different from the other fields in that they should not change
on their own. Most manipulation functions only require the settings.

Also takes into use a class for host and port data.
2019-07-19 17:00:18 +03:00
Esa Korhonen
0257e6e690 MXS-2546 Remove external master tracking
It was only used for logging.
2019-07-19 16:39:03 +03:00
Markus Mäkelä
c280da003b
Merge branch '2.3' into 2.4 2019-07-10 09:30:04 +03:00
Markus Mäkelä
a91726100c
Merge branch '2.2' into 2.3 2019-07-10 09:09:24 +03:00
Markus Mäkelä
c7d90636b0
MXS-2594: Fix priority usage without node priorities
The first node without a priority would be chosen as the candidate master
and the rest would be ignored. The code must check if neither of the two
nodes have priorities and if so must choose the better one.
2019-07-10 09:06:27 +03:00
Johan Wikman
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
Esa Korhonen
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
Johan Wikman
2ab9aa9a94 Update 2.4.0 Change Date 2019-06-25 09:19:55 +03:00
Esa Korhonen
5528a8e8fb Merge branch '2.3' into develop 2019-06-19 17:27:57 +03:00
Esa Korhonen
39df829384 Don't kick out super-users when performing rejoin
When rejoining a server, preventing writes is not as essential as in switchover.
2019-06-19 17:14:39 +03:00
Markus Mäkelä
64d25a48bd
Merge commit 'a60bd376108f71fccf40001c1496f32c11137fe4' into develop 2019-06-18 15:51:17 +03:00
Esa Korhonen
a60bd37610 MXS-2367 Print slave connection errors when replication fails
The slave connection I/O-tread stays running if replication credentials are
wrong when connecting to master. This causes a switchover/failover timeout.
When this happens, print the error in the slave connection status as this
clarifies the problem to the user.
2019-06-18 15:02:21 +03:00
Esa Korhonen
648eda9262 Remove deprecated parameters from MariaDBMon
Also deprecates an unused parameter.
2019-06-13 14:35:50 +03:00
Esa Korhonen
6ee9736803 Clean up scheduled event handling
Removes some duplicated code.
2019-06-13 13:19:48 +03:00
Esa Korhonen
d0e6921604 Improve switchover undo when new master fails
Now the monitor properly restores the old master by running promotion code on it.
Also, binlog is disabled when enabling server events.
2019-06-11 17:15:43 +03:00
Johan Wikman
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
Esa Korhonen
b49aeae1c8 Avoid using obsolete functions in reset-replication
Removes some duplicate functions.
2019-06-10 15:04:25 +03:00
Esa Korhonen
4efa9dbeea Remove maxscale/alloc.h
The remaining contents were moved to maxbase/alloc.h.
2019-06-10 14:11:25 +03:00
Esa Korhonen
fc9ef715bd Move last MariaDB-Monitor settings inside class 2019-06-07 11:42:21 +03:00
Esa Korhonen
926f0057c2 Move QueryResult-class to a separate file
The maxsql/src/mariadb.cc-file contains only general utility functions.
2019-06-07 11:32:46 +03:00
Johan Wikman
8fa8181009 MXS-2540 Use new conf. mech. in Clustrix monitor 2019-06-05 11:10:28 +03:00
Johan Wikman
69dea5a81e MXS-2537 Turn 'cluster_monitor_interval' into duration 2019-06-05 11:02:34 +03:00
Johan Wikman
60d065473e MXS-2481 Handle sqlite3 oom error 2019-05-28 12:36:21 +03:00
Johan Wikman
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
Johan Wikman
8204c5099b MXS-2481 Ensure directory exists before creating db 2019-05-28 12:36:21 +03:00
Esa Korhonen
a82841333d Merge branch '2.3' into develop 2019-05-28 10:57:18 +03:00
Esa Korhonen
d128c9a09b MXS-2504 Kick out super-users from master server during switchover
The monitor queries for logged in users with super-privileges and kicks them out to
prevent writes to master. Normal users can stay since their writes are prevented by
read_only. Also, the master-status is removed from the master manually to signal to
routers that no more writes should go to master.
2019-05-27 18:11:46 +03:00
Markus Mäkelä
17fa1ce616
Fix galeramon regression
The comparisons were done wrong: strcasecmp returns 0 for equal strings.
2019-05-22 10:02:48 +03:00
Johan Wikman
d0153f6ce3 clustrixmonitor: Add missing include 2019-05-21 12:50:10 +03:00
Esa Korhonen
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
Esa Korhonen
650230455a MXS-2169 Allow unsafe failover when 'enforce_simple_topology' is on
If gtid of master is unknown (as is typical when master is down when MaxScale
starts) the domain id is guessed from the slaves instead. This is usually
safe.
2019-05-20 10:43:54 +03:00
Esa Korhonen
4ee30f5c52 MXS-2169 Allow a downed server to be selected as topology master
This is required for the case when MaxScale is started when the master is
already down.
2019-05-17 13:46:33 +03:00
Esa Korhonen
d2f3e56d0a MXS-2169 Add 'enforce_simple_topology'-setting
Does not add any functionality yet.
2019-05-17 13:46:33 +03:00
Esa Korhonen
c801789ff3 Cleanup monitor running state 2019-05-17 13:34:48 +03:00
Esa Korhonen
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
Esa Korhonen
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
Esa Korhonen
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
Esa Korhonen
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
Markus Mäkelä
418ccf861d
Format routers and monitors 2019-05-10 10:31:12 +03:00
Johan Wikman
381940ce8c Merge branch '2.3' into develop 2019-05-09 14:35:44 +03:00
Markus Mäkelä
567ad9b8b8
Fix galeramon regression
The comparisons were wrong: strcasecmp returns 0 for equal strings.
2019-05-09 12:30:29 +03:00
Johan Wikman
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
Johan Wikman
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
Johan Wikman
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
Johan Wikman
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