10822 Commits

Author SHA1 Message Date
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
Markus Mäkelä
ca155fbfe9
Merge branch '2.1' into 2.2 2018-06-18 11:32:13 +03:00
Esa Korhonen
2f987d0b10 MXS-1845 Only select a master if current master is no longer usable
The purpose is to make the selected master server sticky. The master is reselected only
if the current master is no longer a valid master.
2018-06-18 11:06:58 +03:00
Markus Mäkelä
d923042115
MXS-1930: Fix server version checks
The server versions now checks for 10.3 when deciding whether to send new
capabilities.
2018-06-18 10:55:39 +03:00
Markus Mäkelä
95935991ab
MXS-1881: Move Rpl related code out of Avro files
Organized the Rpl and Avro code in a way that they aren't mixed.
2018-06-16 23:29:40 +03:00
Markus Mäkelä
a3a4bb3da6
MXS-1881: Add TableCreateEvent JSON serialization
Serializing the object allows replicated events to be processed even if
the CREATE TABLE statement is not in the binary logs.
2018-06-16 23:29:40 +03:00
Markus Mäkelä
3417842e75
MXS-1881: Add table creation method to RowEventHandler
The new method is called for each new CREATE TABLE statement that is
processed as well as all ALTER TABLE statemets that modify the table
structure.

Right now the entry point not in use but it opens up the possibility of
persisting the CREATE TABLE statements at creation time. Currently the
tables are only persisted when the first actual event for the table is
received.
2018-06-16 23:29:39 +03:00
Markus Mäkelä
c27529c9a4
MXS-1881: Expand GTID helper class
Added string conversion methods to the gtid_pos_t class that can be used
to store and load a GTID value.

Also added the missing rpl.cc file that previously only had the Rpl class
constructor in it.
2018-06-16 23:29:39 +03:00
Markus Mäkelä
ac6370afcf
Clean up common binlogrouter headers
Cleaned up blr_constants.h and moved the REP_HEADER construction helper
into binlog_common.h.
2018-06-16 23:29:39 +03:00
Markus Mäkelä
8721c9117a
Expose function for checking MYSQL connection errors
If a query done via the connector fails, the return value can be inspected
with the function. This helps separate fatal problems from transient ones.
2018-06-16 23:29:39 +03:00
Markus Mäkelä
e74591cfe5
MXS-1881: Delegate event processing to the Rpl class
The actual processing of the replicated events is now delegated to the Rpl
class. This class only deals with the raw binary format log events which
allows it to be used for both binlogs stored on disk as well as binlogs
that have just been replicated.
2018-06-16 23:29:39 +03:00
Markus Mäkelä
4def9382f2
MXS-1881: Remove unneeded code
The code that checks for stop events is not needed as it is only used for
log messages. These aren't really useful to the end user so they can be
removed.

Moved the modification of the event size in case binlog checksums are
enabled outside of the handle_one_event function. This will make it
possible to move most of the processing done inside it into a reusable
class of its own.

Also fixed the memory leak for the event data.
2018-06-16 23:29:39 +03:00
Markus Mäkelä
c39fa4009e
MXS-1881: Pass the RowEventConverer as a parameter
The RowEventConverter is now passed as a parameter to the Avro
instance. Wrapped the value in an std::auto_ptr to make the cleanup
automatic (when it is implemented).

Fixed a typo in the event handler member variable and removed the unused
stats member.
2018-06-16 23:29:39 +03:00
Markus Mäkelä
8f76cf5f5a
MXS-1881: Remove file indexing
The file indexing provided very little benefit for the intended purpose of
the router. Removing it makes the whole system more robust and simplifies
the code by a large amount.
2018-06-16 23:29:38 +03:00
Esa Korhonen
037498675f Merge branch '2.2' into develop
No changes because of heavy conflicts. The features from 2.2 will be included
in a later commit.
2018-06-15 16:28:02 +03:00
Markus Mäkelä
2005164222
Fix slave reconnection logic
Allowing calls to select_connect_backend_servers even when all slaves are
connected solves the debug assertion in select_connect_backend_servers
that happens when the execution of a queued query causes a new connection
to be created.
2018-06-15 16:16:53 +03:00
Markus Mäkelä
3ed6411741
Fix debug assert on reconnection with session commands
When a query was routed to a server that must first be connected to, the
expected response count was not updated for the executed session commands.
2018-06-15 16:16:53 +03:00
Markus Mäkelä
9dd8043359
Add network throttling documentation
Added documentation for MXS-1690.
2018-06-15 16:16:53 +03:00