10839 Commits

Author SHA1 Message Date
Markus Mäkelä
75ddfe4c14
Merge branch '2.2' into develop 2018-06-21 14:02:00 +03:00
Markus Mäkelä
0f61c4b6a4
MXS-872: Also check that mysql.user.default_role exists
The column is used so it should be checked that it exists. Also
altered the SQL to use statements that do not return resultsets.
2018-06-21 14:00:29 +03:00
Johan Wikman
254084fc5e MXS-1935 Accept "PREPARE name FROM @var" 2018-06-21 12:51:47 +03:00
Johan Wikman
457d74f6b4 MXS-1935 Add test that exposes problem
"PREPARE a FROM @var" is not classified.
2018-06-21 12:51:47 +03:00
Johan Wikman
45bda0f72e MXS-1936 Make qc_mysqlembedded compatible with qc_sqlite
qc_mysqlembedded must also be updated to handle the new type
QUERY_TYPE_DEALLOC_PREPARE. Some adjustements were also needed
elsewhere.
2018-06-21 12:51:47 +03:00
Markus Mäkelä
92b1767fb1
Merge branch '2.2' into develop 2018-06-21 11:45:23 +03:00
Markus Mäkelä
9e4b86ff0a
MXS-1935: Accent NULL from qc_get_preparable_stmt in readwritesplit
If the prepared statement cannot be extracted from the query, treat it as
a query with an unknown type.
2018-06-21 10:04:34 +03:00
Markus Mäkelä
067bca6e58
Document comment syntax
Documented comment syntax and explicitly stated that trailing comments are
not supported.
2018-06-20 20:59:58 +03:00
Esa Korhonen
8bd9e1d473 Check monitor permissions when reconnecting to server
Previously, the permissions would only be checked at monitor start.
Now, the permissions are checked if [Auth Error] is on or server
was reconnected.
2018-06-20 17:54:46 +03:00
Markus Mäkelä
396f5d96c2
Merge branch '2.2' into develop 2018-06-20 14:43:03 +03:00
Markus Mäkelä
14e03613a0
MXS-872: Use the new query only when privileges are OK
If the service user does not have adequate grants to the mysql tables, the
legacy query is used. This prevents an upgrade failure when the user was
lacking the new privileges.
2018-06-20 14:41:56 +03:00
Markus Mäkelä
0914f67175
MXS-872: Document new grant requirement
The user now requires SELECT privileges on the mysql.roles_mapping
table.

Currently this is a mandatory grant but it needs to be made into an
optional requirement. This allows upgrades from 2.2.9 to 2.2.10 without
needing new grants.
2018-06-20 14:41:56 +03:00
Markus Mäkelä
7a0a6c3af1
MXS-1932: Add test case
Added test case that reproduces the problem and verifies that it is fixed.
2018-06-20 14:41:56 +03:00
Markus Mäkelä
28ae1bf24e
MXS-1932: Ignore hidden files in maxscale.cnf.d
All files that are hidden (i.e. start with a period) are now ignored by
the configuration file processing.
2018-06-20 14:41:55 +03:00
Johan Wikman
68e514f08b Fix test_event
If the logged line is found, it is not an error, if it is not,
it is.
2018-06-20 13:01:20 +03:00
Johan Wikman
47b2036afa Merge branch '2.2' into develop 2018-06-20 12:55:15 +03:00
Johan Wikman
5d4b3bc419 MXS-1887 Prevent gwbuf_copy_data() performance hit
The cache filter walks through the resultset in order to detect
when the resultset ends. That is, it reads each packet header as
they arrive.

In case the resultset is large, the cache will have to read several
packet headers. That it does using gwbuf_copy_data(). However, as that
was done using the first received GWBUF as the starting point, it meant
that in gwbuf_copy_data() the buffer chain was walked over and over
and over again, with a significant performance hit as the result.

Now we separetely store the last buffer received, and the the starting
offset of it. That way there will be no buffer chain walking.

As this is a common problem, GWBUF could cache the offset of the tail,
thus removing the performance penalty if you read from an offset that
happens to be in the tail. However, it's better to do that as a part
of a general overhaul of GWBUF.
2018-06-20 12:45:22 +03:00
Markus Mäkelä
6278f27ab6
Merge branch '2.2' into develop 2018-06-20 10:26:29 +03:00
Johan Wikman
bc5acafa64 Define maxscale [c|cpp]defs.[h|hh] in terms of maxbase 2018-06-20 09:53:19 +03:00
Johan Wikman
9c6c0a4d95 Add common headers to maxbase
To be included first in all headers. Defined and included common
ground and provides a place when one can affect all code.
2018-06-20 09:53:19 +03:00
Markus Mäkelä
5350817790
Flush hosts in parallel
The Mariadb_nodes class now performs the node flushing in parallel. This
should speed up startup. Also increased the max_connect_errors.
2018-06-20 08:45:18 +03:00
Markus Mäkelä
8f71e803c1
Copy test logs in parallel
The log copying is now done in parallel for all VMs.
2018-06-20 08:40:17 +03:00
Markus Mäkelä
980caa5be5
MXS-1926: Ignore server shutdown errors
If the server sends a server shutdown error, it is safe for readwritesplit
to ignore it. When the TCP connection is closed, the router error handling
will discard the connection, optionally replacing it.
2018-06-20 00:34:16 +03:00
Markus Mäkelä
b018781764
MXS-872: Add support for roles
The users query for the MySQLAuth now handles users with default roles.
2018-06-19 12:52:00 +03:00
Markus Mäkelä
bf4673d3f7
MXS-872: Add role test case
The test case checks whether roles work via MaxScale.
2018-06-19 12:51:55 +03:00
Markus Mäkelä
8eaa265168
MXS-1931: Remove use of gw_MySQL_get_next_packet
The function implemented redundant functionality and replacement with
modutil_get_next_MySQL_packet was planned.

When faced with a packet header spread over multiple buffers, the packet
length calculation would read past the buffer end. This is fixed by taking
modutil_get_next_MySQL_packet into use.

Identical behavior to the old function is achieved by calling
gwbuf_make_contiguous for each packet to store them in a contiguous area
of memory. This should be either removed and only done when
RCAP_TYPE_CONTIGUOUS_INPUT is requested or be made an innate feature of
statement based routing.
2018-06-18 20:42:23 +03:00
Esa Korhonen
58207ec414 MXS-1775 Check disk space warning bit when selecting a new master for failover
This also applies to autoselect switchover. The disk space warning has the least
priority, as the other criteria could lead to replication failures. Also, print
the reason the new master was selected over the second best candidate.
2018-06-18 17:59:19 +03:00
Esa Korhonen
019d62bbb8 MXS-1886 Better auto-rejoin error description and tolerance
Contains changes from commit 09df01752812444c6e7c409a8957d292f7de63cf
adapted to the 2.3 branch.
2018-06-18 16:35:28 +03:00
Esa Korhonen
d3e9cc9a4f MXS-1886 Auto-failover error tolerance
Contains changes from commit 9e68d8ec3ddf1621f533067021c4b3042f695e80
adapted to the 2.3 branch.
2018-06-18 16:35:28 +03:00
Niclas Antti
72bfc73706 Throttle Filter: Properly disconnect the client session.
The client session was not disconnected when the query threashold
was exceeded in a DelayedCall.
2018-06-18 15:27:44 +03:00
Niclas Antti
81deedd857 MXS-1777 use maxbase library
The library directory structure could be simplified for ease of use, but better done with a separate commit.
2018-06-18 15:27:44 +03:00
Niclas Antti
d2e1cfdf4e MXS-1777 fix CMakeLists.txt for utility library
Last minute directory changes were not fully applied in CMakeLists.txt
2018-06-18 15:27:44 +03:00
Markus Mäkelä
5438140e33
Wait for monitor in mxs1476
Use Maxscales::wait_for_monitor instead of hard-coded sleeps. This should
make testing faster, more accurate as well as more robust.
2018-06-18 14:25:05 +03:00
Markus Mäkelä
9d961ece3a
Clear galeramon server info in pre_tick
The server information in galeramon is gathered every monitoring
interval. To prevent stale information from being used, the server
information needs to be cleared at the start of each monitoring interval.
2018-06-18 14:25:05 +03:00
Markus Mäkelä
026313fcc7
Clear status bits of server that are down
At the start of the monitor tick, the monitor pending status is set to the
value of the current server status. This allows the informative and
history bits to survive even if a server goes down.

To make sure that no stale state bits are in effect when the post_tick
method is called, the pending status must be cleared of all status bits.
2018-06-18 14:25:05 +03:00
Markus Mäkelä
87796a4bb5
Update bug547 to expect correct behavior
Readconnroute with router_options=slave will use a master if one is
available. The test still expected the old behavior where masters were
never used with router_options=slave.
2018-06-18 14:25:05 +03:00
Markus Mäkelä
1f166482b2
Fix slave reconnection regression
The state of the backend needs to be checked before any pending session
commands are executed on it.

Added debug assertions to catch invalid use of the status functions of
closed backends.
2018-06-18 14:25:05 +03:00
Markus Mäkelä
7a354bb28e
Add slave reconnection regression test
After a session command fails on all connected slaves but succeeds on the
master, the servers that failed are discarded from the pool of valid
servers. If there are available servers, they will be taken into use when
the next read query is performed.

When a query is routed to an unconnected slave, it is taken into use and
the session command history is replayed. If the execution of the history
failed and there were more session commands to be executed, any queued
queries would get lost. This is due to a missing check that would detect
the fact that the server has been discarded.
2018-06-18 14:25:05 +03:00
Markus Mäkelä
45f39e7fdd
Wait for monitor in mxs1719
Replaced hard-coded sleep with dynamic waiting.
2018-06-18 14:10:27 +03:00
Markus Mäkelä
bd6155b950
MXS-1914: Resolve symbols at link time
Enabled link time symbol resolution to administrative modules.
2018-06-18 12:58:51 +03:00
Markus Mäkelä
13893cca3d
MXS-1914: Move maxscale_shutdown() into the core
The core library now contains the maxscale_shutdown() command. This makes
it possible to resolve all symbols at link time even for administrative
modules.
2018-06-18 12:58:50 +03:00
Markus Mäkelä
df24f09ce5
Merge branch '2.2' into develop 2018-06-18 11:39:10 +03:00
Johan Wikman
0f187807c1 MXS-421 Add system test 2018-06-18 11:32:50 +03:00
Johan Wikman
d0c74b5c8f MXS-421 Log event in case of authentication failure
- CDC authenticator
- MySQL authenticator
- PAM authenticator
2018-06-18 11:32:50 +03:00
Johan Wikman
6dd479104f MXS-421 Enable the turning on of events 2018-06-18 11:32:50 +03:00
Johan Wikman
6e3d3c0dcf MXS-421 Test that used facility has an effect
If the facility of an event is LOG_AUTH, it should by default
end up in /var/log/auth.log.
2018-06-18 11:32:50 +03:00
Johan Wikman
4c1b7f761c MXS-421 Add maxscale::event concept
MaxScale now defines events for which the syslog
facility and level can explicitly be defined by the
administrator. Currently there is only one such
event, namelt AUTHENTICATION_FAILURE.

In a subsequent commit, config.cc will be modified so
that event-related configuration parameters are passed
to event::configure() and in another subsequent commit
the authenticators will be modifed to use this mechanism.

In practice a line like:

   MXS_WARNING("%s: login attempt for user '%s'@[%s]:%s, "
               "authentication failed.",
               dcb->service->name, client_data->user,
               dcb->remote, dcb->path);

will be changed to

    MXS_LOG_EVENT(event::AUTHENTICATION_FAILURE,
                  "%s: login attempt for user '%s'@[%s]:%s, "
                  "authentication failed.",
                  dcb->service->name, client_data->user,
                  dcb->remote, dcb->path);
2018-06-18 11:32:50 +03:00
Markus Mäkelä
6df0804e70
Add missing tls-passphrase documentation
The tls-passphrase was not documented in MaxCtrl. Also regenerated the
documentation.
2018-06-18 11:32:28 +03:00
Markus Mäkelä
24bb8b0b2c
Clean up mxs548_short_session_change_user
The test unnecessarily did an unconditional drop of the user resulting in
errors. Also prevented stopping of MaxScale if it wasn't started in the
first place.
2018-06-18 11:32:28 +03:00
Markus Mäkelä
2ad8b77f11
Fix current command tracking in MariaDBClient
The debug assertion introduced by commit 3d1c2b421a fails when a
COM_CHANGE_USER was executed. This was caused by the fact that the
authentication data was being interpreted as a command when it should've
been ignored.

Added a debug assertion into the reauthentication code to make sure the
current command remains the same.
2018-06-18 11:32:28 +03:00