4117 Commits

Author SHA1 Message Date
Esa Korhonen
173f44b351 MXS-1703: Move additional classes to separate file
Also use stl containers in monitor definition.
2018-03-07 13:26:02 +02:00
Esa Korhonen
8ef1385d1a MXS-1703: Turn MariaDB Monitor struct to class with public fields
Allows using std::string for strings. Also, cleanup.
2018-03-07 13:25:52 +02:00
Esa Korhonen
1de8f5ffdc MXS-1703: Compile mariadbmon.h as C++ 2018-03-07 13:25:29 +02:00
Esa Korhonen
35232d8ad8 MXS-1703: Use dedicated header in NDBClusterMon
NDBClusterMonitor used the MariaDBMonitor header instead of its own.
2018-03-07 13:24:45 +02:00
Markus Mäkelä
d6b8147119
Merge branch '2.2' into develop 2018-03-06 17:02:03 +02:00
Markus Mäkelä
d5226fa7d1
MXS-1698: Fix double SSL connection
When backend SSL connections were created, the connection creation was
done twice. This was due to the lacking detection of an already
established SSL connection.
2018-03-06 13:35:15 +02:00
Markus Mäkelä
016a6a6bd2
Add more info output to readwritesplit replies
When readwritesplit receives a reply from a backend, an info level log
message is now logged. This allows easier debugging of situations where
replies aren't properly returned by the router.
2018-03-06 13:35:15 +02:00
Johan Wikman
8232c5d449 Merge branch '2.2' into develop 2018-03-06 10:38:54 +02:00
Johan Wikman
8bfb4f231a Merge branch '2.1' into 2.2 2018-03-06 10:38:01 +02:00
Markus Mäkelä
019312c4ee
Cherry-pick: Don't write errors to dummy sessions
If a DCB is closed before a response to the handshake packet is received,
the DCB's session will point to the dummy session. In this case no error
should be written to the DCB.

This is a cherry-pick of commit f53e112bf49766f1cc55516c2d7ee571461d483f
from the 2.2 branch.
2018-03-05 13:58:09 +02:00
Markus Mäkelä
93f3529bb4
MXS-1697: Treat missing libraries as an error
If the avrorouter is being build and the required libraries are not found,
the configuration process should fail. Adding the command to bypass this
into the error message should make it easier to disable this part if it is
not needed.
2018-03-05 13:58:09 +02:00
Markus Mäkelä
f066ba8753
MXS-1693: Accept 'mysql_native_password' as plugin name
When the authenticator loads users, it should also accept users who have
explicitly defined 'mysql_native_password' as their authentication plugin.
2018-03-05 13:58:09 +02:00
Markus Mäkelä
e5934dfb11
Expand SHOW DATABASES warning message
The message now states the impliciations of missing permissions. If the
MaxScale user does not have the permissions to view all databases, it will
only see its own databases.
2018-03-05 13:58:09 +02:00
Johan Wikman
ea83420620 Merge branch '2.2' into develop 2018-03-01 18:08:45 +02:00
Johan Wikman
544e0eb60b Merge branch '2.1' into 2.2 2018-03-01 17:57:40 +02:00
Johan Wikman
b46c52d65c MXS-1684 Match space+linefeed as linefeed
A linefeed is whitespace, so given the rules

  "\n"+    return '\n'
  {SPACE}  ;

a line consisting of space followed by a linefeed, will be matched
as space and not as a linefeed and hence will cause the parser to
barf.
2018-03-01 17:57:07 +02:00
Johan Wikman
39d3c42c94 Merge branch '2.1' into 2.2 2018-03-01 17:52:42 +02:00
Johan Wikman
13c222488e RWS: Log packet length when logging transaction status 2018-02-25 20:56:02 +02:00
Johan Wikman
9b36ba5e0a MXS-1677: Don't assume all queries are in text form
After a temporary table is created, readwritesplit will check whether a
query drops or targets that temporary table. The check for query type was
missing from the table dropping part of the code. The temporary table read
part was checking that the query is a text form query.

Added a debug assertion to the query parsing function in qc_sqlite to
catch this type of interface misuse.
2018-02-24 17:02:51 +02:00
Johan Wikman
b67ab83486 Revert "Use dedicated header in NDBClusterMon"
This reverts commit b9d80f6061d6b536d7a15febf0367e5f6dba0e84.
2018-02-24 15:43:15 +02:00
Johan Wikman
0bbf0246f9 Revert "Compile mariadbmon.h as C++"
This reverts commit 60d57aee61d96832aeec1b8a61d36803c38ca77c.
2018-02-24 15:40:21 +02:00
Johan Wikman
236e906d88 Revert "Turn MariaDB Monitor struct to class with public fields"
This reverts commit cb6f70119d9857b277306e9af5881fe29c574a32.
2018-02-24 15:37:50 +02:00
Johan Wikman
13661ab4a6 Revert "MariaDB Monitor: Move additional classes to separate file"
This reverts commit ff55106610881d55db88eca9e2ef6a056cbc8d51.
2018-02-24 15:35:36 +02:00
Johan Wikman
e721733434 Revert "MariaDBMon: Move replication manipulation functions to a separate file"
This reverts commit 8cdd23dda2add6486abb685834def94c72a09b6c.
2018-02-24 15:35:02 +02:00
Esa Korhonen
8cdd23dda2 MariaDBMon: Move replication manipulation functions to a separate file
Refactoring continues. This update moves some of the replication manipulation
functions to a separate file and turns them into class methods.
2018-02-22 10:51:52 +02:00
Johan Wikman
e385e6fcd4 Merge branch '2.2' into develop 2018-02-22 10:13:55 +02:00
Markus Mäkelä
03eb30fbc6
Check SHOW DATABASES privilege on startup
MySQLAuth requires the SHOW DATABASES privilege to see all the databases
so it should be checked that the current user has the permission. A
missing permission will cause errors that are hard to resolve.
2018-02-22 10:06:29 +02:00
Esa Korhonen
ff55106610 MariaDB Monitor: Move additional classes to separate file
Also use stl containers in monitor definition.
2018-02-21 12:24:24 +02:00
Esa Korhonen
cb6f70119d Turn MariaDB Monitor struct to class with public fields
Allows using std::string for strings. Also, cleanup.
2018-02-21 11:00:42 +02:00
Markus Mäkelä
1ecd791887
MXS-1678: Store master_id even when IO thread is stopped
When the IO thread of a relay master is stopped, the knowledge that it is
not a real master but a relay master is lost. To prevent this loss of
information, the master server's server_id value should always be stored
if it is available.
2018-02-21 09:35:42 +02:00
Markus Mäkelä
f3e00431de
Fix MXS-1418 regression
If a server is removed from a service, readconnroute will not verify that
the server it is connected to is still the same root master. This fixes
the regression of MXS-1418.
2018-02-20 15:35:52 +02:00
Esa Korhonen
60d57aee61 Compile mariadbmon.h as C++ 2018-02-20 11:14:21 +02:00
Esa Korhonen
b9d80f6061 Use dedicated header in NDBClusterMon
NDBClusterMonitor used the MariaDBMonitor header instead of its own.
2018-02-20 11:09:04 +02:00
Johan Wikman
5665ecc591 Merge branch '2.2' into develop 2018-02-15 16:33:36 +02:00
Esa Korhonen
754d80da75 Do not auto_rejoin if maxscale is passive 2018-02-14 17:30:02 +02:00
Markus Mäkelä
4853fb0c64
Prevent double free of rerouted queries
When the routing of a queued query fails, the route_stored_query function
extract the SQL from and frees the already freed buffer.
2018-02-14 14:47:03 +02:00
Markus Mäkelä
3b2ec4ab5a
Change references from MySQL to MariaDB
A few were missed when the renaming was done. Also renamed the file to
mariadbmon.cc.
2018-02-14 14:47:03 +02:00
Johan Wikman
f388e2f838 Merge branch '2.2' into develop 2018-02-12 14:00:40 +02:00
Esa Korhonen
b94f3b8792 Failover: do not check cluster stabilization if no slaves
Caused debug assert.
2018-02-12 12:37:41 +02:00
Esa Korhonen
b8d3da4968 Add error tolerance to "servers_no_promotion"
Previously, if the list contained servers that were not monitored by
the monitor yet were valid servers, an error value would be returned
and the monitor failed to start.

With this update, the non-monitored servers are simply ignored when
forming the final list.

Also, added printing of the list to diagnostics.
2018-02-12 10:49:28 +02:00
Esa Korhonen
faaf43ff39 Add gtid to monitor diagnostics, clean up formatting
Gtid:s are now queried every monitor loop.

dignostics() no longer prints slave related info if the server has
no slave connection.
2018-02-10 12:32:56 +02:00
Johan Wikman
e346968e0e Merge branch '2.1' into 2.2 2018-02-10 08:28:11 +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
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
fcde23e6fe Merge branch '2.2' into develop 2018-02-08 18:40:29 +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ä
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
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ä
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