7808 Commits

Author SHA1 Message Date
Markus Mäkelä
be429c2c57
MXS-2490: Always restore original statement ID
By always restoring the ID, we are guaranteed to only store the query in
the form that it was originally sent in. This should be changed so that
the ID that the client sends can be used as-is in the backends.
2019-06-20 14:27:04 +03:00
Markus Mäkelä
805be70a78
Add more information to rwsplit info messages
The statement ID for all binary protocol statements and the error given to
handleError are now logged.
2019-06-20 14:27:03 +03:00
Markus Mäkelä
301b1b63ab
MXS-2569: Always terminate schemas with newlines
If the stored file didn't have a newline in the schema, the schema and the
first row would be on the same line.
2019-06-20 12:32:30 +03:00
Markus Mäkelä
7673ee685d
Distinguish stopped and finished workers
By having a separate FINISHED state and a STOPPED state, it is possible to
know at which point in the worker's lifetime an event is done. Posting of
messages before a worker is started is allowed but posting them after the
worker has stopped is not.

This fixes avrorouter related failures and all other failures that stem
from worker messages being ignored at startup.
2019-06-20 12:32:30 +03:00
Esa Korhonen
39df829384 Don't kick out super-users when performing rejoin
When rejoining a server, preventing writes is not as essential as in switchover.
2019-06-19 17:14:39 +03:00
Markus Mäkelä
3d8475f8ed
Merge branch '2.2' into 2.3 2019-06-19 12:37:23 +03:00
Markus Mäkelä
27fb397041
MXS-2547: Do shutdown on main worker
By stopping the REST API before the workers and moving the shutdown to the
same worker that handles REST API requests, we prevent the hang on
shutdown. This also makes the signal handler signal-safe.
2019-06-19 10:31:47 +03:00
Markus Mäkelä
69b3879357
MXS-2547: Don't post messages to stopped workers
If a worker has been stopped, tasks must not be executed on it. To prevent
this, the calling code should check whether the worker has been
stopped. This does not prevent the case where a message is successfully
posted to a worker but the worker is stopped before it processes it.
2019-06-19 10:31:47 +03:00
Markus Mäkelä
b7294a28af
MXS-2547: Assert that workers aren't stopped
If a worker is stopped, none of the Worker::execute or post_message
methods should be called.
2019-06-19 10:31:47 +03:00
Esa Korhonen
a60bd37610 MXS-2367 Print slave connection errors when replication fails
The slave connection I/O-tread stays running if replication credentials are
wrong when connecting to master. This causes a switchover/failover timeout.
When this happens, print the error in the slave connection status as this
clarifies the problem to the user.
2019-06-18 15:02:21 +03:00
Markus Mäkelä
6cbe9d1258
MXS-2550: Fix default module parameters
The parameters weren't processed when they were added from the module
defaults.
2019-06-18 07:06:51 +03:00
Markus Mäkelä
f6a5b59067
MXS-2563: Fix query retrying on slave failure
If one slave is executing a query while another one is executing a session
command and the one that is executing the session command fails, the
ongoing query would get retried even though the server that failed was not
executing it. If the server was executing a session command, nothing needs
to be done.
2019-06-17 14:07:52 +03:00
Esa Korhonen
cf866a6a57 Merge branch '2.2' into 2.3 2019-06-14 10:49:51 +03:00
Markus Mäkelä
2accfad329
Handle trailing unexpected ERR packets
RWBackend did not expect that a resultset and an unexpected ERR packet
could be stored in the same buffer. This can happen for example if a
server shuts down immediately after the resultset is sent.
2019-06-14 08:12:02 +03:00
Esa Korhonen
acfaae9d46 MXS-2480 Use in-memory-database in PAM authenticator
This was already fixed in develop, but the fix is both small and useful
so should be backported.
2019-06-13 17:47:08 +03:00
Markus Mäkelä
bb92d61a1b
Fix KILL command packet boundary detection
If a packet with a KILL query was followed with another packet in the same
network buffer, the code wouldn't work as it expected to receive only one
packet at a time.
2019-06-12 12:20:26 +03:00
Esa Korhonen
95606370c8 MXS-2551 Do not print deprecated parameters into serialized config files
In MaxScale, a "deprecated" parameter is not in use and can be ignored.
Leaving the parameters out of serialized configuration files avoids warning
messages.
2019-06-11 15:55:35 +03:00
Esa Korhonen
1ba77b59e2 MXS-2548 Show correct monitor state in "maxadmin list monitors"
The code OR:d with 0.
2019-06-06 17:09:41 +03:00
Markus Mäkelä
c219187a1e
Merge branch '2.2' into 2.3 2019-06-03 13:27:57 +03:00
Markus Mäkelä
d68f66fede
MXS-2538: Send master charset in the handshake packet
By iterating over the servers and sending the master's charset we are
guaranteed a "known good" charset. This also solves the problem where a
deactivated server reference would be used as the charset and server
version source.
2019-05-31 23:01:18 +03:00
Markus Mäkelä
e9c652555d
MXS-2538: Fix hang on unknown KILL
Unknown KILL commands are now forwarded as-is to the routers.
2019-05-31 14:01:16 +03:00
Markus Mäkelä
220fea3546
MXS-2464: Retry failed session commands
If the execution of a session command fails on a master, it is retried
again. If the master is not available, the response will be returned from
one of the slaves.
2019-05-31 14:01:15 +03:00
Markus Mäkelä
6d089e3283
Clear session commands in Backend::close
If a reconnection would take place, the old commands would get executed.
2019-05-31 14:01:15 +03:00
Markus Mäkelä
cb089f69e6
Add read retry assertion
The retrying of a read on a slave should only be done when the failing
server is waiting for a result and it was the last server from which a
result was expected.
2019-05-31 14:01:15 +03:00
Markus Mäkelä
625740e69d
MXS-2464: Fix crash on failed session command
If the master fails when a session command is being executed with
delayed_retry enabled, a null query would get placed into the query
queue. This change simply prevents the crash and closes the session even
though the query could be retried.
2019-05-31 14:01:15 +03:00
Markus Mäkelä
9481992bb9
Fix dbfwfilter release mode build failure
GCC 9 complained about null format strings even though the argument given
was never null.
2019-05-31 14:01:15 +03:00
Markus Mäkelä
4e6ca33053
Add UBSAN flag to builds
The -DWITH_UBSAN flag enables the undefined behavior detection provided by
GCC.
2019-05-31 14:01:14 +03:00
Markus Mäkelä
ee7e63a611
MXS-2464: Assert that responses are expected
A query should not be queued if no responses are expected. The code that
executes queued queries should be dead code and this assertion would catch
it.
2019-05-31 14:01:14 +03:00
Markus Mäkelä
1012b95544
Merge branch '2.2' into 2.3 2019-05-31 12:40:15 +03:00
Markus Mäkelä
2b3a9b2b57
Initialize MXS_SESSION::autocommit 2019-05-29 18:46:33 +03:00
Markus Mäkelä
81254953d1
MXS-2520: Allow master reconnection on reads
If only the master is available and a reconnection must take place, it
must be allowed to happen in all cases.
2019-05-29 18:46:33 +03:00
Esa Korhonen
442d8bed9a MXS-2479 Add username and host to PAM authenticator log messages 2019-05-29 17:32:27 +03:00
Markus Mäkelä
114e095e1b
MXS-2525: Fix non-plugin authentication
Older clients assume the plugin used for authentication is
mysql_native_password. If the client doesn't request plugin
authentication, don't treat it as an error.
2019-05-29 12:41:53 +03:00
Markus Mäkelä
dcdcc0e44f
Fix avrorouter build failure
Signed to unsigned comparison.
2019-05-28 15:18:34 +03:00
Markus Mäkelä
bef8881cab
Merge branch '2.2' into 2.3 2019-05-28 14:17:43 +03:00
Esa Korhonen
d128c9a09b MXS-2504 Kick out super-users from master server during switchover
The monitor queries for logged in users with super-privileges and kicks them out to
prevent writes to master. Normal users can stay since their writes are prevented by
read_only. Also, the master-status is removed from the master manually to signal to
routers that no more writes should go to master.
2019-05-27 18:11:46 +03:00
Markus Mäkelä
387bf0ccc2
MXS-2507: Fix avrorouter token processing
The token comparison function did the comparison wrong: The token needs to
be an exact match instead of a partial one.
2019-05-27 09:34:38 +03:00
Markus Mäkelä
05ed272c16
Fix format-truncation warnings in blr
The custom message must be smaller than the actual message to guarantee no
truncation takes place.
2019-05-27 03:24:05 +03:00
Markus Mäkelä
eda547c86f
MXS-1851: Add hard-coded protocol module check
This way a hard to track crash is avoided and the user knows how to fix
it.
2019-05-24 13:55:43 +03:00
Esa Korhonen
a1697e2aa6 MXS-2479 PAMBackendAuth is more tolerant of extra messages.
The authenticator can now receive additional questions from the server even
after the original password-query.
2019-05-24 11:31:55 +03:00
Esa Korhonen
bd8aa64547 MXS-2479 Accept additional messages in PAM authenticator
Plugins may send additional messages during authentication. These messages
often contain notifications such as password expiration dates. Both the client
and backend side authenticators now handle such messages. The messages are not
sent to the user, only the log. The requirement that only "Password: " is queried
still stands.
2019-05-23 14:14:25 +03:00
Markus Mäkelä
8317fec745
MXS-2496: Check for ALL PRIVILEGES grant
If a user has ALL PRIVILEGES as a global privilege, it overshadows the
SHOW DATABASES grant.
2019-05-22 09:56:35 +03:00
Markus Mäkelä
b294acf276
MXS-2496: Fix SHOW DATABASES grant check
The code expected that the grant was given to the actual user, not a role.
2019-05-21 13:43:51 +03:00
Markus Mäkelä
96a477ec89
MXS-2490: Send error to client on unknown PS handle
If a client requests an unknown binary protocol prepared statement handle,
a custom error shows the actual ID used instead of the "empty" ID of 0
that the backend sends.
2019-05-17 14:13:44 +03:00
Markus Mäkelä
f94355770f
Merge branch '2.2' into 2.3 2019-05-17 14:10:28 +03:00
Markus Mäkelä
bf63698991
MXS-2464: Bring back the runtime query queue check
The code that checked that only non-empty queries are stored in the query
queue was left out when the query queue fix was backported to 2.3. Since
MXS-2464 is caused by a still unknown bug, the runtime check should help
figure out in which cases the problem occurs.
2019-05-17 13:03:03 +03:00
Markus Mäkelä
2cd4da32a7
MXS-2494: Fix user loading queries for MariaDB 10.1+
The queries now properly check for the plugin.
2019-05-16 10:41:04 +03:00
Johan Wikman
b80aa081fe Fix test_buffer test case 2019-05-15 12:17:10 +03:00
Johan Wikman
01c4beec10 MXS-2470 Update tail pointer in gwbuf_clone 2019-05-14 13:36:33 +03:00
Johan Wikman
600e23ae2d MXS-2470 Add unit test that reveals problem 2019-05-14 13:36:33 +03:00