2738 Commits

Author SHA1 Message Date
Markus Mäkelä
e105f06ea3
Log latest session command on unexpected result 2020-08-21 09:50:29 +03:00
Markus Mäkelä
aaec73a8c8
MXS-3089: Close backend on failed session command
This correctly triggers the session command response processing to accept
results from other servers than the current master backend if the session
can continue. If the session cannot continue, it will be stopped
immediately.
2020-07-23 09:26:53 +03:00
Johan Wikman
aa11c960b1 2.3.20 Update change date 2020-06-05 09:31:45 +03:00
Johan Wikman
f527a8f2e6 2.3.19 Update Change Date 2020-04-23 14:23:57 +03:00
Johan Wikman
e0cd6adb26 Update change date for 2.3.18 2020-03-10 10:45:47 +02:00
Johan Wikman
919686f7ad Merge branch '2.3.17' into 2.3 2020-02-12 08:22:59 +02:00
Markus Mäkelä
fd875cbf6d
Remove faulty debug assertion
The use of the server state is not transactional across multiple uses of
the function. This means that any assertions on the target state can fail
if the monitor updates the state between target selection and the
assertion.
2020-02-11 22:34:39 +02:00
Johan Wikman
cfb3f79b54 Update 2.3.17 Change Date 2020-02-10 15:28:38 +02:00
Markus Mäkelä
4641dc208f
Fix sescmd debug assert
The assertion will not hold for COM_CHANGE_USER. This prevents the debug
assertion but the actual backend code should also be changed.
2020-01-23 18:38:05 +02:00
Markus Mäkelä
c04d6748d3
Fix debug assertion on inconsistent sescmd result
The slave backend would be closed twice if it would both respond with a
different result and be closed due to a hangup before the master
responded.

Added a test case that reproduced the problem.
2020-01-23 18:38:05 +02:00
Johan Wikman
790d90f229 Update 2.3.16 Change Date 2020-01-15 11:08:51 +02:00
Markus Mäkelä
b0a1eddb6c
Store ignored error information
The errors that are ignored by readwritesplit are now stored as the
current close reason in the Backend. This allows the information about the
error to be retained and it can be used later in the error handler to
display the true reason why the connection was closed.
2019-12-17 13:48:51 +02:00
Markus Mäkelä
5c4ac03c07
Log a message in readconnroute's handleError
This way there's trace that something unexpected happened and that the
session closed unexpectedly.
2019-11-08 13:44:21 +02:00
Johan Wikman
df6c56e7ca Update 2.3.13 Change Date 2019-10-29 12:51:31 +02:00
Markus Mäkelä
ac5b5d527a
MXS-2610: Prevent watchdog timeouts in avrorouter
The file processing can take a very long time and as it is done on a
routing worker, the workaround needs to be used.
2019-10-29 11:33:10 +02:00
Markus Mäkelä
f46f873dc1
Add verbose backend status helper
This allows the same verbose information to be logged in the cases where
it is of use. Mostly this information can be used to figure out why a
certain session was closed.
2019-09-19 13:41:49 +03:00
Markus Mäkelä
fd0c156655
MXS-2564: Reconnect only when necessary
By doing the reconnection only when a new query arrives, we prevent the
excessive reconnecting that is done when a server's actual and monitored
states are in conflict.
2019-09-19 13:41:49 +03:00
Markus Mäkelä
40d05e8278
Report more details when the master is unavailable
By dumping the connection state we'll know when the connection was opened
and closed and the reason why it was closed.
2019-09-19 12:55:31 +03:00
Marko
7a1abc26d8 MXS-2631 Fix the ignoring of the system tables 2019-08-29 01:00:49 +03:00
Markus Mäkelä
1748e6599d
MXS-2609: Fix session command mixup on master failure
If a master failed during an ongoing session command history replay, it
would be treated as if a normal session command failed which would result
in the already executed session command being re-executed on all servers
at the wrong logical position.

To fix this, the history replay must be distinguished from normal session
command execution. When a connection replaying the history fails, the
query routing simply needs to be attempted again.
2019-08-09 01:54:09 +03:00
Markus Mäkelä
8bc4e42f2d
Fix query queuing on session command execution
If session command execution during server reconnection caused a query to
be queued, the query would be put on the tail end of the queue. This would
cause queries to be reordered if the queue wasn't empty. The correct thing
to do would be to put the next pending query back at the front of the
queue.
2019-08-09 01:54:09 +03:00
Markus Mäkelä
bb6f9213d4
Fix debug assert on master reconnection
If a master reconnection occurred after the session command history was
disabled due to the limit being exceeded, a debug assertion would be hit
in prepare_target. This assert makes sure that a connection can be safely
created to the server which means that in release mode builds the session
state would be inconsistent on the new master.

As this is an unrecoverable situation, the session should stop immediately
even if delayed_retry is enabled. Currently the session will continue
until the delayed retry timeout is hit. This happens due to the fact that
the delayed retry mechanism handles all errors in a similar way.
2019-08-09 01:54:09 +03:00
Markus Mäkelä
fd72332ea4
Improve master failure error message
The message will now always contain the server name.
2019-08-05 12:48:19 +03:00
Markus Mäkelä
dda02b45ee
MXS-2520: Do master replacement if it's possible
This allows a new master to be chosen regardless of the target server
type.
2019-07-29 10:26:30 +03:00
Marko
918a2964d5 MXS-2592 Add configuration for session specific in-memory log
When enabled each session will write log messages in the in-memory log.
If session ends in error this log is written to the actual log in disk.
2019-07-28 20:56:22 +03:00
Markus Mäkelä
b07ffdb2fa
Fix hang on transaction replay
The expected response counter was not decremented if a transaction replay
was started. This caused the connections to hang which in turn caused the
failure of the mxs1507_trx_stress test case.
2019-07-26 09:34:08 +03:00
Markus Mäkelä
f31f09fc66
Don't print errors with master_failure_mode=error_on_write
The errors are expeted and should not be logged.
2019-07-23 14:12:58 +03:00
Markus Mäkelä
12bd26398f
MXS-2486: Add missing schemarouter capabilities
The capabilities that the schemarouter declared were missing the
RCAP_TYPE_PACKET_OUTPUT which caused partial packets to be returned to it.
2019-07-23 09:57:53 +03:00
Markus Mäkelä
fbeb5d9c84
Always ignore server-internal databases
The mysql, information_schema and performance_schema databases should
always be ignored if found on multiple servers.
2019-07-23 09:38:29 +03:00
Markus Mäkelä
1ddcbc9ae1
Log error message on slave session command failure
If the slave's response differs from the master and the slave sent an
error packet, log the contents of the error. This should make it obvious
as to what caused the failure.
2019-07-18 17:58:22 +03:00
Markus Mäkelä
84f4688ebb
Fix readwritesplit response count assertion
The assertion in routeQuery that expects there to be at least one ongoing
query would be triggered if a query was received after a master had failed
but before the session would close. To make sure the internal logic stays
consistent, the error handler should only decrement the expected response
count if the session can continue.
2019-07-18 12:24:06 +03:00
Markus Mäkelä
3649efde0b
MXS-2605: Remove false debug assertion
The assertion doesn't count executed session commands and thus is not
reliable.
2019-07-16 21:45:36 +03:00
Markus Mäkelä
21dfcb5648
Fix COM_STMT_LONG_DATA routing
The initial COM_STMT_LONG_DATA would not trigger the "pinning" of the
statement to a known node.
2019-07-10 11:06:51 +03:00
Markus Mäkelä
e516c11ac5
MXS-2587: Never route stored queries in routeQuery
This could end up in infinite mutual recursion if no responses are
expected. Although this does not happen now that MXS-2587 is fixed, the
code should not even be there.
2019-07-05 14:19:44 +03:00
Markus Mäkelä
953dd4098b
MXS-2587: Prevent queries after failed trx replay
If a transaction replay fails, no queries must be routed before the
connection is closed. This could happen if the client received the error
from the replay failure and closes the connection before the fake hangup
generated by the replay failure is processed.
2019-07-04 08:21:16 +03:00
Markus Mäkelä
4954c7f6b7
Fix sending of unknown PS error
The error was only generated for COM_STMT_EXECUTE commands when all PS
commands should trigger it. In addition, large packets would get sent two
errors upon the arrival of the trailing end.
2019-07-01 10:25:41 +03:00
Markus Mäkelä
3b6387c952
MXS-2562: Stop immediately on mid-resultset failure
If a server fails mid-resultset, there's not a lot we can do to recover
the situation. A few cases could be handled (e.g. generate an ERR if the
resultset has proceeded to the row processing stage) but these fall
outside the scope of the original issue.
2019-06-28 20:25:31 +03:00
Markus Mäkelä
5eba688c1b
MXS-2521: Detect COM_STMT_EXECUTE without metadata
If a COM_STMT_EXECUTE has no metadata in it and it has more than one
parameter, it must be routed to the same backend where the previous
COM_STMT_EXECUTE with the same ID was routed to. This prevents MDEV-19811
that is triggered by MaxScale routing the queries to different backends.
2019-06-27 08:29:30 +03:00
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ä
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
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ä
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ä
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ä
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
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
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