6260 Commits

Author SHA1 Message Date
Markus Mäkelä
562c7be8fe
MXS-2106: Fix NULL value handling
The NULL values were not stored as NULL Avro values due to the fact that
the file format has no native NULL-ness for the basic types. To solve
this, all values must be stored as a union that contains the actual type
as well as the null type.

Unions were not implemented in the maxavro library but implementing means
simply recursing one level down.
2018-11-05 13:37:29 +02:00
Markus Mäkelä
7f36ec83da
MXS-2095: Add runtime detection of unknown SQL
If the query statement is wrongly treated as a table creation statement it
could cause a crash. To handle this, unknown SQL is now reported and the
processing is stopped early. This does not solve the root cause of the
problem but makes it possible to detect it in the future.
2018-11-05 13:37:28 +02:00
Johan Wikman
f34ca0d473 Fix peculiar wrapping 2018-11-01 12:39:18 +02:00
Toni Zlomislic
e1dedfb678 Update galeramon.c (#183)
* Update galeramon.c

support wsrep_sst_method "xtrabackup-v2" for available_when_donor maxscale option

* reformat line to fit <=110 chars / support xtrabackup-v2 sst method
2018-10-31 16:00:26 +02:00
Markus Mäkelä
47e7595a08
MXS-2115: Fix regression
The 5.5.5 prefix in the version strings was not added.
2018-10-30 18:43:37 +02:00
Markus Mäkelä
91c5f8580c
MXS-2119: Fix file permissions
The admin files are now created with 640 permissions and automatically
created directories now properly set the permissions for the group as
well. All files and directories created by avrorouter and binlogrouter
also now correctly limit the read and write permissions only to the owner
and the group.
2018-10-30 12:45:36 +02:00
Markus Mäkelä
eb10b723dd
MXS-2117: Fall back to old style query with 10.2.11
If a 10.2.11 or older server without a grant on all mysql tables is found,
the authenticator now falls back to the 10.1 behavior that uses subqueries
instead of CTEs. This is a more user friendly way of working around
MDEV-13453 that causes the problem as all functionality except the support
for composite roles is retained.
2018-10-30 12:45:36 +02:00
Markus Mäkelä
93b9ed744f
MXS-2111: Use authentication_string when password is empty
If the password field in mysql.user is empty, it is possible that the
actual password is stored in the authentication_string field. Most of the
time this happens due to MDEV-16774 which causes the password to be stored
in the authentication_string field.

Also added a test case that verifies the problem and that it is fixed by
this commit.
2018-10-30 12:45:36 +02:00
Markus Mäkelä
2594a0d913
Improve detection of problems caused by MDEV-13453
Instead of looking at the server version, the actual error message should
be inspected. This guarantees that the correct error message is logged
even with custom builds.
2018-10-30 12:45:36 +02:00
Markus Mäkelä
7e21e3aedd
MXS-2115: Fix handshake version string
The intention was to send the lowest backend version string automatically
to the client instead of the default handshake version. This did not work
as the service version string was used instead of the server version.
2018-10-30 12:45:23 +02:00
Markus Mäkelä
262f1d7e47
Fix build failures
The freopen return value caused warnings.
2018-10-19 15:20:34 +03:00
Markus Mäkelä
192563a947
MXS-2108: Fix open connection calculation
When a connection to a server is lost and the session command history is
disabled, the session will continue as long as at least one connection is
open. Previously the open connection calculation used the same code that
was used when a new session was created which only inspected the
configured server count instead of the actual open connection count.
2018-10-19 15:20:34 +03:00
Markus Mäkelä
f8cf5053bd
MXS-2103: Fix CREATE TEMPORARY TABLE detection
The table creation was not detected as the function used to extract the
table name did not return the fully qualified names. Even if it did return
a fully qualified name, it wouldn't have been correctly processed.
2018-10-18 20:26:58 +03:00
Markus Mäkelä
92057f6ff9
Add more logging to readwritesplit
When a read-only transaction fails due to a connection error, no message
would be logged. Also added an info level message for the case when a
backend connection would get closed before the session is in the correct
state and a debug assertion that the router session should never be closed
when the handleError method is called.
2018-10-16 11:04:57 +03:00
Markus Mäkelä
288fbc8c33
MXS-2075: Only enable stdout redirection for maxscale
The stdout redirection must not be enabled for the other programs as they
are not run as daemon processes.
2018-10-02 09:44:02 +03:00
Markus Mäkelä
62e5f988c5
MXS-2075: Redirect stdout and stderr to the log
If the log file is successfully opened, both stdout and stderr are
redirected to it. This helps catch ASAN reports without having to read the
system journal files.

As the output is redirected to a file, some of the output was made visible
only in non-daemon mode. This helps keep the log file clean and readable.
2018-10-02 09:44:02 +03:00
Markus Mäkelä
f65c890287
MXS-2049: Forward client credentials to backend server
Instead of requesting another set of credentials, the client credentials
are simply forwarded to the backend MariaDB server.
2018-10-02 09:44:01 +03:00
Markus Mäkelä
93d866c6a7
MXS-2073: Add missing TCP_NODELAY for client sockets
The client connections had the Nagle algorithm enabled which could cause
bad performance with smaller workloads. The common network configuration
code in utils.cc, currently used by the backend connections, sets it
properly.
2018-10-02 09:44:00 +03:00
Markus Mäkelä
ceb763c9be
Fix buffer size in cache rules
If a database, table and a column was defined, the null terminating
character would be written past the end of the buffer.
2018-09-30 22:35:13 +03:00
Markus Mäkelä
104a6d1bfb
Explicitly link against ASAN libraries
Some systems (Ubuntu Trusty) require explicit linking against ASAN
libraries.
2018-09-28 11:05:51 +03:00
Markus Mäkelä
e73301ad71
Update NPM packages
Updated packages for MaxCtrl and the REST API tests.
2018-09-26 11:08:24 +03:00
Markus Mäkelä
7d2a5b2c13
Fix readwritesplit debug assertion
The debug assertion is wrong as the code was changed to prioritize hints
over the router target selection. Also removed the superficial check for
master, slave and relay master states as they are implied by the fact that
the connection is in use.
2018-09-26 11:08:23 +03:00
Markus Mäkelä
d55c07dc2e
MXS-2066: Reset resultset collection by default
The collection of resultsets needs to be disabled by default when a
response is received to cover the cases where an error is returned.

The collection of results should also not be set for queries that do not
generate any responses.
2018-09-21 11:14:45 +03:00
Markus Mäkelä
60915f847f
MXS-2064: Log workaround for grant problems with MariaDB 10.2.10
When the 10.2 users query is executed with a MariaDB server older than
10.2.11, the query will fail due to inadequate grants on the 'users' table
generated as a part of the CTE. To work around the issue, a SELECT grant
on the whole mysql database is required. Logging the server where the
query fails also helps resolve the problem by pointing out where the grant
needs to be added.
2018-09-21 11:14:45 +03:00
Markus Mäkelä
8c2f6aafcc
MXS-2060: Load users from only valid servers
Users should only be loaded from a server if it is running and not in
maintenance.
2018-09-19 20:32:39 +03:00
Markus Mäkelä
40c4614ed1
Update mocha
Updated mocha to latest version for maxctrl and REST API test suites.
2018-09-19 20:32:39 +03:00
Markus Mäkelä
97a4cdcd49
MXS-2052: Log error on failed routing of session command
If no server receives the session command, an error is now logged.
2018-09-18 21:07:18 +03:00
Markus Mäkelä
d6ce6e4289
MXS-2035: Fix available_when_donor
The parameter got broken by the previous change.
2018-09-15 01:22:39 +03:00
Markus Mäkelä
c600b8ab92
MXS-2046: Fix double freeing of GWBUF
The response buffer from the master was freed twice.
2018-09-13 20:38:55 +03:00
Markus Mäkelä
bee7cc2002
MXS-2046: Fix additional memory leaks
A set of memory leaks were revealed by Valgrind.
2018-09-13 14:27:21 +03:00
Markus Mäkelä
fa96923983
MXS-2035: Add mariabackup support to Galeramon
The mariabackup is now treated the same way as xtrabackup.
2018-09-13 13:02:32 +03:00
Markus Mäkelä
a952255c19
MXS-2046: Fix binlogrouter memory leak
The client queries were never freed.
2018-09-13 13:02:31 +03:00
Markus Mäkelä
96a78685bc
Fix possible buffer overrun in readwritesplit
If the GWBUF length was larger than the stack buffer length, the code
would write past the buffer.
2018-09-12 22:09:38 +03:00
Markus Mäkelä
d7b7f43efb
Rename misleading function
The expecting resultset function does not expect a resultset but a text
protocol result.
2018-09-12 08:44:31 +03:00
Markus Mäkelä
e15b0e2147
MXS-2041: Fix crash on failed schemarouter session
When the setting up of filters for a session fails, the DCB is closed and
the client DCB's session pointer is set to NULL. This needs to be checked
in the schemarouter before the `m_client->session` pointer is used.

The act of setting the session pointer to NULL should not be necessary as
the session is freed once the reference count drops down to zero. Due to
the fact that changing this would require moderate changes in session code
means that it should not be done in a patch release as the risks are too
high.
2018-09-12 08:44:31 +03:00
Markus Mäkelä
9c08d78304
Add missing error messages
If tee filter creation fails, it would not log an error message.
2018-09-12 08:44:31 +03:00
Esa Korhonen
c04073a96c MXS-2040 Increase default monitor timeouts
All three timeouts are now three seconds. This should reduce the amount of
timeout errors users get during failover/switchover.
2018-09-11 12:31:41 +03:00
Esa Korhonen
ad71655a36 MXS-2036 Redirect slaves with stopped SQL threads
This is somewhat questionable, as the slaves won't be able to really
replicate from the new master. However, not doing this causes the wrong
master to be selected after failover unless the new master has a majority
of slaves under it.
2018-09-11 10:27:31 +03:00
dapeng huang
087272c3e4 fix multistatment hang (#180) 2018-09-11 08:39:12 +03:00
Markus Mäkelä
889877c0ab
MXS-1947: Add support for composite roles
Added support for composite roles for 10.2 and newer versions. As
recursive CTEs are required to extract the role mappings, composite roles
aren't supported on 10.1.
2018-09-10 21:47:47 +03:00
Markus Mäkelä
2e90e77baa
MXS-2027: Set load to inactive on error
The data loading should be set to inactive if an error is encountered, not
to active.
2018-09-04 11:04:44 +03:00
Markus Mäkelä
d7dd636c9a
Add table filtering to avrorouter
The filtering is implemented with PCRE2 regular expressions and as such is
not the most user-friendly interface.
2018-09-04 10:50:31 +03:00
Esa Korhonen
79ba89fba1 MXS-2034 Set query_retry_timeout
Was setting query_retry instead.
2018-09-03 10:46:32 +03:00
Markus Mäkelä
4c5e18b4f0
MXS-2033: Require only MASTER_SSL_CA
MASTER_SSL_CERT and MASTER_SSL_KEY are optional and should not be
required.
2018-08-30 00:30:46 +03:00
Markus Mäkelä
5f4aa46552
MXS-2027: Store LOAD DATA state inside MXS_SESSION
By storing the data gathere by readwritesplit inside the session, the
protocol will be aware of the state of the LOAD DATA LOCAL INFILE
execution. This prevents misinterpretation of the data which previously
led to closed connections, effectively rendering LOAD DATA LOCAL INFILE
unusable.

This change is a temporary solution to a problem that needs to be solved
at the protocol level. The changes required to implement this are too big
to add into a bug fix release.
2018-08-29 18:10:51 +03:00
Markus Mäkelä
e38e08089a
Skip parsing during LOAD DATA LOCAL INFILE
The code parsed queries even when a LOAD DATA LOCAL INFILE was in
progress. This caused the data to be misinterpreted as actual commands.
2018-08-29 18:10:51 +03:00
Markus Mäkelä
a50e8e9ce6
MXS-2024: Prevent stack overflow
If a large packet is received, the stack would overflow when the username
size was determined from the packet size. The code must not assume
anything about the size of the packet being read.
2018-08-27 20:35:09 +03:00
Markus Mäkelä
2c54f28fae
MXS-2024: Validate COM_CHANGE_USER packet before use
The use of strcpy on data that is assumed to be null terminated causes
reads and writes past buffers.
2018-08-24 20:52:52 +03:00
Marko
69722a32ca Fix crash caused by wildcards in NamedServeFilter source parameter
Use the formated IP address instead of the one with wildcard symbols.
2018-08-22 22:46:46 +03:00
Markus Mäkelä
4480995089
MXS-1996: Remove misleading errors
The errors are expected if the file is empty.
2018-08-22 14:23:25 +03:00