4594 Commits

Author SHA1 Message Date
Markus Mäkelä
196821c6fc Assign the service pointer for backend DCBs
The backend DCBs didn't have a valid service pointer whereas the client
DCBs had one. The necessity of the pointer can be questioned as a similar
pointer is located in the session.
2017-12-13 16:42:55 +02:00
Markus Mäkelä
4b9bb9e65f Assign service pointer in BLR DCBs
The DCBs that were manually allocated by the binlogrouter were not
assigned the service pointers.
2017-12-12 08:47:02 +02:00
Markus Mäkelä
66be882ae0 Don't reload users for dummy sessions
The service for a dummy session will be NULL. If authentication fails for
a dummy session, then no service level actions should be taken.

Only the binlogrouter can trigger authentication failure with a dummy
session as it creates connections before the service itself has started.
2017-12-11 12:31:40 +02:00
Markus Mäkelä
8ed1ff67c2 Fix avro regression
The fact whether a query explicitly defined a query was ignored by the
statement parsing function and it always assumed the database was
explicitly defined. This caused the TABLE keyword in a CREATE TABLE
statement to be falsely identified as the current database.
2017-12-07 13:19:06 +02:00
Markus Mäkelä
97d41e6ca0 MXS-1555: Never explicitly assign the readqueue
The readqueue should never be explicitly assigned and should only ever be
appended to. This guarantees that the packets are read and processed in
the correct order.

Also removed an unused function that deals with the readqueue
manipulation.
2017-12-05 12:09:52 +02:00
Markus Mäkelä
6f185ff5db MXS-1555: Fix persistent pool qualification
When packets were routed individually, the qualification for the
persistent pool was done before the current command was updated. In
addition to this, the previous commit doesn't seem like it can even build.
2017-12-05 12:09:52 +02:00
Markus Mäkelä
c8b6838bce MXS-1555: Fix statement tracking for readwritesplit
The statement tracking was given the same buffer multiple times when a
large packet was spread across multiple buffers when a router with
RCAP_TYPE_STMT_INPUT was present.

The command tracking packet processing is redundant for routers that
require RCAP_TYPE_STMT as the same processing is done later when the
buffer is split into packets and routed. By using the split packets, the
protocol module can simplify the command tracking by a great deal for most
routers.
2017-12-04 14:49:13 +02:00
Markus Mäkelä
5664cb8bf6 Fix protocol command tracking
The command byte was always read at an offset of 4 instead of the current
offset plus 4.
2017-12-01 11:30:13 +02:00
Markus Mäkelä
0506669738 Only refresh users on failed authentication
When backend authentication failed due to errors other than wrong
credentials, the users were unconditionally reloaded. This caused a spike
of activity whenever authentication failed for other reasons.

Also fixed the test that checks for this to look for the correct error
message.
2017-12-01 06:01:18 +02:00
Markus Mäkelä
96d9c47016 MXS-1553: Enforce SSL usage for monitors
If a server is configured to use SSL, then MaxScale should respect the
configuration and refuse to use a connection that is not encrypted.
2017-12-01 03:50:57 +02:00
Markus Mäkelä
f2a0cc8b31 Don't send hangup error on connection close
If the client has sent a COM_QUIT, the hangup error message should not be
written.
2017-11-30 17:25:06 +02:00
Markus Mäkelä
d5d41349ae MXS-1509: Add ignore_external_masters parameter
The new parameter allows ignoring of master servers that are external to
the monitor configuration. This allows sub-trees of the actual replication
tree to be used as fully fledged replication trees.
2017-11-30 12:39:00 +02:00
Markus Mäkelä
7c2a173a17 MXS-1536: Always recreate TABLE_MAP objects
When a table map event is read after an alter table, the old TABLE_MAP
object contains old information. Due to this, as well as the added benefit
of making the code easier to read, the recycling of TABLE_MAP objects was
removed. In practice, there were no benefits to re-mapping the tables to a
different ID.
2017-11-30 12:38:43 +02:00
Markus Mäkelä
a32789d4ac MXS-1536: Fix ALTER TABLE parsing
The ALTER TABLE parsing didn't properly handle escaped values and it used
the current database unconditionally.
2017-11-30 12:38:43 +02:00
Markus Mäkelä
764863cb3f MXS-1536: Add Annotate_rows event processing
The Annotate_rows events were not processed which caused the following
table map event to be ignored.

Also removed a false debug assertion. The byte count can be zero and the
pointer is not guaranteed to point to anything valid.
2017-11-30 12:38:43 +02:00
Markus Mäkelä
0ca04cb5d5 MXS-1536: Fix crash in CREATE TABLE
If a CREATE TABLE statement had a quoted keyword as the name of a field,
the calculated column count and actual column counts would differ.

In addition to this, oneline comments before the end of the statement
would truncate the SQL due to the fact that the whitespace was squashed
before the comment removal was done.
2017-11-30 12:38:43 +02:00
MassimilianoPinto
2217091019 MXS-1546: revert commit e16eee0cc3c6307f732c2e43d995d3c86cdd67a7
MXS-1546: revert commit e16eee0cc3c6307f732c2e43d995d3c86cdd67a7

This code is not necessary in MaxScale 2.1
2017-11-29 18:22:05 +01:00
Johan Wikman
4ee9f54f5d MXS-1529 Ensure that config file is a file
If the provided configuration file argument does not refer to a
regular file, MaxScale refuses to start.
2017-11-28 15:56:59 +02:00
Johan Wikman
5c9d8c53d9 MXS-1529 Rename file_is_[readable|writable]
Rename file_is_[readable|writable] to path_is_[readable|writable]
as it makes the check for both files and directories.
2017-11-28 15:40:59 +02:00
Johan Wikman
6359b7983f MXS-1529 Prevent endless realloc loop
If the provided config path refers to a directory it can still
be opened and an attempt to read be made. However, as reading
will fail but end-of-file not be reached, we can't rely upon
'feof()' for detecting when to bail out.

As it is a user error to provide a directory as the config path,
that will be detected and deemed an error in a subsequent commit.
2017-11-28 15:33:50 +02:00
Johan Wikman
a6e83f41f6 Add missing "%s" format 2017-11-28 14:31:57 +02:00
MassimilianoPinto
e16eee0cc3 MXS-1546: Don't check binlog read position when last event is HEARTBEAT_EVENT
Don't check binlog read position when last event is HEARTBEAT_EVENT
2017-11-28 13:24:35 +01:00
MassimilianoPinto
c44dd4a26c MXS-1530: stop replication unsupported binlog events
Stop replicating from master if unsupported binlog events are seen.

Also report error message for unsupported events
(blr_read_events_all_events) at maxscale start-up and with
maxbinlogcheck utility
2017-11-27 18:42:38 +01:00
Markus Mäkelä
7c21eb3ec4 Do not force router_options usage
The usage of the router_options has become optional in 2.1. This means
that the binlogrouter should not fail to start if no router_options are
defined.

Also lowered the error about master.ini to a warning as it is expected to
happen on a fresh installation.
2017-11-24 14:50:07 +02:00
MassimilianoPinto
927b4addc8 MXS-1530: check ANNOTATE_ROWS flag in connecting slave
MXS-1530: check ANNOTATE_ROWS flag in connecting slave.

In MariaDB 10.2.4 replicate_annotate_row_events and
binlog_annotate_row_events have default to ON: this change checks
whether the connecting slave is not has ANNOTATE_ROWS in
blr_slave_binlog_dump(), those ANNOTATE_ROWS events can be sent or not
to the slave.
2017-11-24 09:38:17 +01:00
Markus Mäkelä
7cc4018c15 Use SQLSTATE 08S01 for hangup errors
This will tell the connectors that the connection cannot be used.
2017-11-15 15:00:40 +02:00
Markus Mäkelä
060a96d7f3 Send error on client DCB hangup events
Sending an error to the client allows the connector to show more
information to the user when the DCB is closed due to a reason internal to
MaxScale.

The error message states that the connection was killed by MaxScale to
distinct it from the error sent by the server. The error number and SQL
state are still the same as both errors should be treated the same way.
2017-11-15 14:57:28 +02:00
Markus Mäkelä
63ae436bd5 MXS-1019: Make peer certificate verification configurable
The new `ssl_verify_peer_certificate` parameter controls whether the peer
certificate is verified. This allows self-signed certificates to be
properly used with MaxScale.
2017-11-14 16:51:34 +02:00
Markus Mäkelä
4da28789ac Fix SSL regression
This builds on commit 1287b0e595a5f99026f66df7eeaef091b8ffc774 and cleans
up the original code. This fixes a bug introduced in the aforementioned
commit and cleans up the code.
2017-11-08 10:13:19 +02:00
Markus Mäkelä
1287b0e595 Backport authentication fix from 2.2
The authentication code assumed that the initial request only had
authentication related data. This is not true if the client library
predicts that the authentication will succeed and it sends a query right
after it sends the authentication data.
2017-11-03 11:00:54 +02:00
Markus Mäkelä
63cbf56cb2 MXS-1500: Fix real_type values
The characters in the type weren't checked for correctness which caused
the processing to read more characters than was intended.
2017-10-30 10:25:03 +02:00
MassimilianoPinto
f805716700 MXS-1497: Don't skip events with LOG_EVENT_IGNORABLE_F flag
Currently binlog server doesn't send to slaves these event types:
- MARIADB10_START_ENCRYPTION_EVENT
- IGNORABLE_EVENT

It also skips events with LOG_EVENT_IGNORABLE_F flag.

This modification allows sending events with that flag.
2017-10-26 11:32:06 +02:00
Markus Mäkelä
ff8916046c Add link to documentation in --help output
The link points to the MaxScale 2.1 documentation root.
2017-10-21 14:55:56 +03:00
Markus Mäkelä
eac6d239fc MXS-1468: Fix created monitor serialization
When servers were added to monitors that were created at runtime, the
server list serialization overwrote the original persisted configuration
of the monitor. To solve this problem, the serialization of the server
list and the monitor parameters were combined.
2017-10-11 11:30:58 +03:00
Markus Mäkelä
617abd0d52 Fix read of uninitialized memory when DNS lookup fails
If the DNS lookup fails, the destination string buffer is used as-is and
thus it needs to be initialized to an empty string.
2017-10-04 00:45:05 +03:00
Markus Mäkelä
9280f1a5d7 MXS-1367: Add timeouts for retried queries
The total timeout for the retrying of interrupted queries can now be
configured with the `query_retry_timeout` parameter. It controls the total
timeout in seconds that the query can take.

The actual connection, read and write timeouts of the connector aren't a
good configuration value to use for abstracted queries as the time that it
takes to execute a query can be composed of both connections, reads and
writes. This is caused by the usage of MYSQL_OPT_RECONNECT that hides the
fact that the connector reconnects to the server when a query is
attempted.
2017-10-03 13:03:49 +03:00
Markus Mäkelä
67ef7bd058 MXS-1367: Take mxs_mysql_query into use
The use of a wrapper function allows automated retrying of the queries
without requiring any changes to the code that uses it.
2017-10-03 10:57:12 +03:00
Markus Mäkelä
f1f8a4b5b2 MXS-1367: Retry interrupted queries
The new `query_retries` parameter controls how many times an interrupted
query is retried. This retrying of interrupted queries will reduce the
rate of false positives that MaxScale monitors detect.
2017-10-03 10:57:10 +03:00
Markus Mäkelä
1772cc9021 Move blr_set_checksum into blr.h
The function is used in two different files so it needs to be in the
header.
2017-10-02 10:47:27 +03:00
Markus Mäkelä
69557c650e Fix stack trace generation
The stack traces weren't logged as the LOG_ALERT priority wasn't enabled
by default. As an alert is intended to be something that must leave a
trace somewhere, and as such, it must not be possible to disable it. For
this reason, it is acceptable to always log the message if the priority is
LOG_ALERT.

Added the -rdynamic linker flag so that all symbols are exported when
linking MaxScale.

As the stack trace is printed in a signal handler, the first attempt
should be to print the stack trace to the standard output. This way the
output is printed before an attempt to use malloc is made when it is
logged to the logfile.
2017-09-30 12:37:40 +03:00
Markus Mäkelä
94a55f6602 Add missing declaration of blr_set_checksum
The function was used before it was declared.
2017-09-30 08:37:12 +03:00
MassimilianoPinto
1827f042e8 MXS-1459: Assign binlog checksum value at startup
Binlog checksum default value is wrong if a slave connects with
checksum = NONE before master registration or master is not accessible
at startup
2017-09-29 18:57:09 +02:00
MassimilianoPinto
32709b3e46 MXS-1458: Mark backend server as inactive if router is not configured.
MXS-1458: Mark backend server as inactive if router is not configured.
2017-09-28 10:01:29 +02:00
Markus Mäkelä
016ad77b62 MXS-1457: Inject service credentials if no users are loaded
If the authenticator option is enabled, no users are loaded and no errors
have occurred in the user loading process, the service credentials are
injected.
2017-09-27 20:00:39 +03:00
Markus Mäkelä
395b445336 MXS-1457: Ignore removed servers when loading users
When users are loaded, removed or deleted servers are ignored.
2017-09-27 19:28:05 +03:00
Johan Wikman
23fb0bf928 MXS-1449 Firewall: Allow 'USE <db>'
When the database firewall filter is used in white-list mode,
'USE <db>' should be allowed. When connecting, it is always
possible to specify the database anyway so restricting
'USE <db>' serves no purpose.
2017-09-27 12:59:20 +03:00
Johan Wikman
c1a7008479 MXS-1449 Sort case statements
Faster to later check for something specific.
2017-09-27 12:59:20 +03:00
Markus Mäkelä
f06c34f66c MXS-1456: Fix crash on empty script value
If a script variable resolves to an empty string, the replacement attempt
will fail with an out-of-memory error. The following realloc call will
fail as it requires a positive value for the new size.
2017-09-27 10:32:26 +03:00
Johan Wikman
df4f3cb302 MXS-1450 Remove leading whitespace
Leading whitespace is removed from a sent maxadmin command
before the command is interpreted.
2017-09-26 13:47:08 +03:00
Johan Wikman
bfe387b73f MXS-1450 Remove manual history, sort includes
Remove manually maintained revision history and sort include
files.
2017-09-26 13:43:59 +03:00