9596 Commits

Author SHA1 Message Date
Esa Korhonen
2bd1d4ab88 Documentation: add note on switchover command and log_slave_updates 2018-02-10 12:26:47 +02:00
Johan Wikman
e346968e0e Merge branch '2.1' into 2.2 2018-02-10 08:28:11 +02:00
Johan Wikman
b4760c5bbe MXS-1661 Introduce 'users_refresh_time'
It is now possible to explicitly specify how frequently MaxScale
may refresh the users of a service.
2018-02-09 13:33:17 +02:00
Johan Wikman
ae160f3ff2 MXS-1661 Now only the time affects the reloading of users
Now the users will be reloaded at most once during each
USERS_REFRESH_TIME period. Earlier they could be reloaded at
at most USERS_REFRESH_MAX_PER_TIME times, which in practice meant
that with repeated unauthorized login attempts they were reloaded
N times in rapid succession, without the situation being likely to
change in between.
2018-02-09 13:33:17 +02:00
Johan Wikman
b23ad6d2ef MXS-1661 Turn error into warning and suppress logging
The error regarding the refresh rate having been exceeded

    error: [RWSplit] Refresh rate limit exceeded ...

has been turned into a warning. Further, the warning will be
logged at most once per refresh period that currently is 30s.
2018-02-09 13:33:17 +02:00
Johan Wikman
816983691a MXS-1660 Turn client hostname lookup failure into a warning
This is used only in case of everything else fails and this lookup
is not unlikely to fail if the client comes from some machine on
an internal network.
2018-02-09 12:03:13 +02:00
Markus Mäkelä
83ce603e3e
Fix CentOS 6 build failure
The __sync load builtins do not work with pointers to constant variables.
2018-02-09 09:19:46 +02:00
Esa Korhonen
a0d9c7da74 External master server support for failover/switchover
If the master is replicating from an external master, the monitor will save the
host:port of the external server. During demotion, the old master stops the external
replication while the new master begins it. Also, any commands that would add
to gtid have to be omitted when an external master is in play.
2018-02-08 18:44:08 +02:00
Johan Wikman
5a33a5a013 Merge branch '2.1' into 2.2 2018-02-08 18:39:45 +02:00
Johan Wikman
716f39bc8b local_address: Add directories to path 2018-02-08 18:31:23 +02:00
Markus Mäkelä
e641de2930
Fix cdc_datatypes
The test did not correctly handle quoted or NULL value comparisons.
2018-02-08 16:59:00 +02:00
Markus Mäkelä
036a4cedcf
MXS-1653: Add test case
Added test case that reproduces the problem.
2018-02-08 16:59:00 +02:00
Markus Mäkelä
fa37198da1
MXS-1653: Fix hang on preparation of BEGIN
When a BEGIN statement is prepared using the binary protocol, it returns a
single OK packet. Due to a bug in the code that deals with multi-statement
results and EOF packets, the response was never sent to the client.

Also added back the error messages of failed session commands to the INFO
level. This way it's still possible to see why a session command fails but
the log isn't flooded by them in normal usage.
2018-02-08 16:59:00 +02:00
Markus Mäkelä
5f4c723fef
Fix typo in QLAfilter documentation
The readconnroute module name was written as readconnrouter, with an extra
`r` at the end.
2018-02-08 15:23:39 +02:00
Markus Mäkelä
91f4372478
Update mxs280_select_outfile
The error message is no longer logged as it wasn't a real error.
2018-02-08 14:04:16 +02:00
Johan Wikman
b91fa7d395 Merge remote-tracking branch 'origin/2.2' into 2.2 2018-02-08 13:44:40 +02:00
Johan Wikman
b34e44d34a Merge branch '2.1' into 2.2 2018-02-08 13:43:52 +02:00
Markus Mäkelä
a6fc2d3f88
Add missing <string> header
load_utils.cc used std::string without including the header.
2018-02-08 13:40:11 +02:00
Markus Mäkelä
ed28d986e9
Fix debug assertion when no master is present
If no master is present, the debug assertion would dereference a NULL
pointer.
2018-02-08 13:33:31 +02:00
Johan Wikman
155fcd08df Do not fail local_address test if only one IP available
Instead do as much as possible.
2018-02-08 13:15:34 +02:00
Markus Mäkelä
2a987716a8
Build tests by default
The tests are now built by default. This should make it easier for users
to verify that they have a working MaxScale.

Also made the building of test_parse_kill conditional like the rest of the
tests.
2018-02-08 12:48:56 +02:00
Markus Mäkelä
b2f17494ad
Always build Connector-C
The connector is now unconditionally build from source.
2018-02-08 12:48:56 +02:00
Markus Mäkelä
b059d78a30
Fix master loss on split cluster
When four servers (A, B, C and E where E and A replicate from each other
and A is the master for B and C) form a cluster and only three of them (A,
B and C) are configured into MaxScale, a failover operation from A to B
(making B the current master) and a restart of A causes B to lose its
master status.

The following diagram illustrates the state of the cluster at the end of
the process described above.

      +----------------------+
      |        +---+         |
  +------------+ B <-+       |
+-v-+ |        +---+ |       |
| E | |              |       |
+-^-+ |  +---+     +-+-+     |
  +------+ A |     | C |     |
      |  +---+     +---+     |
      |                      |
      +----------------------+

The external server E was not correctly ignored in the replication
topology generation causing both A and B to be seen as the lowest slave
nodes in the tree. From a theoretical point of view this is the correct
interpretation as there are two distinct trees and neither of them
contains any true masters.

In practice, MaxScale should treat any servers that replicate from an
external master as root level master nodes. Doing this guarantees that they
are labeled as masters if they have slaves replicating from them.
2018-02-08 12:48:56 +02:00
Markus Mäkelä
2504ff19b3
MXS-1653: Fix slave session command processing
The responses of slaves that arrived before the master were always
compared to the empty value of 0x00. If the slave connection replied after
the master, the comparison was correct.

This commit introduces a map of slaves and their responses that
are handled once the master's response arrives.
2018-02-08 12:48:56 +02:00
Johan Wikman
bff4f05e3b Merge branch '2.1' into 2.2 2018-02-08 12:47:48 +02:00
Johan Wikman
458edb9b1d Do not crash if "127.0.0.1" is not present 2018-02-08 12:47:34 +02:00
Johan Wikman
b15a460416 MXS-1659 Do not include C++ headers from C header 2018-02-08 12:45:18 +02:00
Johan Wikman
7f045beb59 Fix include conflict in qc_mysqlembedded
qc_mysqlembedded must include the headers from the embedded
library and not from Connector-C.

So, it must be ensured the embedded library include directories
are first.
2018-02-08 12:44:30 +02:00
Markus Mäkelä
823fe902d4
Add passive to help alter maxscale output
The command was missing from the help output.
2018-02-08 12:35:04 +02:00
Markus Mäkelä
2b25ec13d8
Include the connector directory in the right place
The directory where the headers are located should be included only after
the connector is built or found.
2018-02-08 12:35:03 +02:00
Esa Korhonen
8fbcaae569 Add documentation on "servers_no_promotion" 2018-02-08 10:45:00 +02:00
Esa Korhonen
f8cdee4fca MariaDB Monitor documentation: combine timeouts under one heading 2018-02-08 10:45:00 +02:00
Johan Wikman
13498d8ec8 MXS-1655 Allow symbolic links to files in config directory 2018-02-07 16:43:13 +02:00
Johan Wikman
6c42221c9c MXS-1654 Prevent crash in debug mode if no master is found 2018-02-07 16:43:13 +02:00
Esa Korhonen
fa8f6a5da3 Fix monitor error with empty servers_no_promotion 2018-02-07 16:11:47 +02:00
Markus Mäkelä
14a4008c84
MXS-1653: Remove false error message
Removed false error message about failed session commands. An error in
response to a session command is a perfectly valid result.

Also added the explicit commands that the master and slave return to the
warning that is logged when the results differ.
2018-02-07 16:07:17 +02:00
Markus Mäkelä
2181c9d240
Include MariaDB Connector-C headers first
The MariaDB Connector-C headers that are built by MaxScale must be
included before any system headers.

Fixed code that explicitly included the <mysql.h> header to use the
<maxscale/protocol/mysql.h> wrapper instead.
2018-02-07 16:07:17 +02:00
Markus Mäkelä
6dbec397dc
Fix false debug assertion and clarify error message
The debug assertion wasn't well placed as it is perfectly possible that a
master connnection exists but it is not in use. This can be further
checked by asserting that the master is indeed closed and not in use.

Moved the original debug assertion into a separate branch that should
catch any errors in the routing logic.
2018-02-07 16:07:16 +02:00
Markus Mäkelä
8558ace801
Clean up ignore_external_masters code
Removed redundant checks and cleared only bits that aren't already
cleared.
2018-02-07 16:07:16 +02:00
Markus Mäkelä
6a1aba70e7
Add test case for ignore_external_masters + failover
The test checks that failover works even when the master of the monitored
cluster is a slave to an external masters. The test also verifies that the
servers do not get unexpected status labels.
2018-02-07 16:07:16 +02:00
Markus Mäkelä
8bf756ca56
Update root_master when using a standalone master
When detect_standalone_master is enabled, the root_master variable was not
updated after the master was changed by the standalone server detection
mechanism. This caused debug assertions to fire in addition to possibly
causing some of the ignore_external_masters logic to break.
2018-02-07 16:07:16 +02:00
Markus Mäkelä
4420730f31
Start all tests with read_only disabled
Explicitly checking and setting read_only allows all tests to have a
consistent backend state.
2018-02-07 16:07:16 +02:00
Esa Korhonen
1cf3de4a74 Add config parameter for excluding servers from failover
"servers_no_promotion" is a comma-separated list of servers
which cannot be chosen when selecting a new master during failover
(auto or manual), or when automatically selecting a new master
for switchover (currently disabled).

The servers in the list are redirected normally and can be promoted
by switchover when manually selecting a new master.
2018-02-07 14:07:10 +02:00
Markus Mäkelä
99b08a0d6a
Document parameter types and defaults for binlogrouter
The parameter documentation for `send_slave_heartbeat` and `semisync` did
not explicitly state the type of the parameters.
2018-02-06 21:46:05 +02:00
Markus Mäkelä
6f6c11e6a3
Ignore events for closed DCBs
If a closed DCB receives an event, it is ignored.
2018-02-06 16:36:04 +02:00
Markus Mäkelä
4089b6b6fd
MXS-1647: Detect API version mismatch
If the API versions do not match, MaxScale will treat this as an
error. The API versioning would allow backwards compatible changes but the
functionality to handle that is not implemented in MaxScale.

Updated API versions based on changes done to module APIs in 2.2.
2018-02-06 14:51:07 +02:00
Markus Mäkelä
6132ebd24f
MXS-1643: Add test case
Added test case that checks that the correct state changes are made and no
extra events are triggered.

Also cleaned up the log checking function.
2018-02-06 14:51:07 +02:00
Johan Wikman
90fdbf8860 MXS-1652 Add possibility to log SQL statements
With the flag --debug=enable-statement-logging it is now possible
to instruct MaxScale to log all SQL statements it sends to the
servers.

The format of the logged string looks like:

    notice : SQL(127.0.0.1): 0, "SELECT ..."

First the fixed string "SQL", followed by the server address in
parenthesis followed by the actual return value of mysql_query(),
followed by the statement itself.

The "SQL" string makes the lines easy to grep for and having the
return value before the statement makes it easier to spot since
the length of the return value string does not wary much, but the
length of the statements do wary a lot.
2018-02-06 14:30:29 +02:00
Esa Korhonen
4a478d31f3 Print Gtid IO position during monitor diagnostics 2018-02-05 17:21:20 +02:00
Markus Mäkelä
f6afb0c6d1
MXS-1643: Make Master and Slave status mutually exclusive
The Master status now prevents Slave status from being assigned to a
server. In practice this simply means that the master will not have both
the Master and Slave status bits.
2018-02-05 16:53:43 +02:00