1184 Commits

Author SHA1 Message Date
Johan Wikman
a9a2b753c0 Update 2.4.5 change date 2019-12-18 13:25:03 +02:00
Markus Mäkelä
a1009824a6
RCAP_TYPE_STMT_OUTPUT needs complete packets
It was possible that a null buffer was passed to clientReply if the
RCAP_TYPE_STMT_OUTPUT capability was needed and a partial packet was read.
2019-12-17 13:53:06 +02:00
Markus Mäkelä
ad323bb837
Merge branch '2.3' into 2.4 2019-12-13 11:24:42 +02:00
Markus Mäkelä
e057c751cd
Improve handleError error messages
The hangup and error handlers now have unique messages. Although the
behavior in the handlers is practically the same in both cases, the cause
of the error is not the same.

If a socket error is present, it is added to the error message. If an
error is present, it should clearly show the reason why the TCP socket was
closed.

The is_fake_event boolean helps distinguish fake events from real
ones. This makes figuring out the real source of hangup events easier.
2019-12-13 10:50:04 +02:00
Markus Mäkelä
c1b5d70eea
MXS-2803: Write all buffered data
Since the queued queries will never be inspected after the COM_CHANGE_USER
completes, they should all be written instead of only the first packet.
2019-12-13 10:49:36 +02:00
Markus Mäkelä
2b56737868
Fix debug assertion
The GWBUF_IS_CONTIGUOUS macro changed in 2.4 and it no longer allows null
arguments.
2019-12-13 10:49:36 +02:00
Johan Wikman
f6731a898d Update change date 2019-11-13 08:37:17 +02:00
Johan Wikman
fdfbf3e133 Update 2.4.3 change date 2019-11-05 12:21:00 +02:00
Johan Wikman
861e27eb00 Merge branch '2.3' into 2.4 2019-10-29 14:04:31 +02:00
Johan Wikman
df6c56e7ca Update 2.3.13 Change Date 2019-10-29 12:51:31 +02:00
Markus Mäkelä
64cae223f0 MXS-2721: Check that LocalClient creation succeeds
The creation can fail if a network socket cannot be opened and connected
to the host in question.
2019-10-29 09:26:41 +02:00
Markus Mäkelä
dc895e41ad
Merge branch '2.3' into 2.4 2019-10-11 09:51:48 +03:00
Markus Mäkelä
1202c00fc7
MXS-2721: Check that LocalClient creation succeeds
The creation can fail if a network socket cannot be opened and connected
to the host in question.
2019-10-10 21:24:35 +03:00
Esa Korhonen
428bc5740b MXS-2645 Decrement service client count also when authentication fails
The client count was incremented before authentication was complete, and
should be decremented if it fails. Otherwise service connection limit can
be easily reached.
2019-10-04 15:11:09 +03:00
Markus Mäkelä
2d9d9356c9
Merge branch '2.3' into 2.4 2019-10-04 12:56:52 +03:00
Markus Mäkelä
869effc352
MXS-2707: Retain commands that respond
Only commands that return a response should to be retained. Otherwise the
bookkeeping of m_current_query will be wrong.
2019-10-03 22:17:44 +03:00
Markus Mäkelä
f9a6649d77
Merge branch '2.3' into 2.4 2019-09-24 21:42:32 +03:00
Markus Mäkelä
fcc7642328
MXS-2694: Add support for COM_BINLOG_DUMP
The resultset processing now understands COM_BINLOG_DUMP and treats it as
a never-ending resultset.
2019-09-24 21:41:24 +03:00
Markus Mäkelä
45aa40c10a
Fix RWBackend state tracking with multi-result queries
If a query returned multiple resultsets and the connection was broken
between the resultsets, the backend would not know that parts of the
response were already sent. This is caused by the cyclic nature of the
state machine when multi-result responses are being processed.

To fix the problem, the result size is tracked to know how many bytes have
been sent to the client. This is a backport of the
MySQLProtocol::Result::size from 2.5(develop).
2019-07-30 13:53:23 +03:00
Marko
a9b01ff4cc Merge branch '2.3' into 2.4 2019-07-28 21:43:58 +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ä
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ä
5b3c0b8b81
Merge branch '2.3' into 2.4 2019-07-16 13:17:35 +03:00
Markus Mäkelä
c878d796be
Merge branch '2.2' into 2.3 2019-07-16 12:59:03 +03:00
wuzang.hdp
ee83a6ca0d fix memory leak on handling COM_CHANGE_USER 2019-07-12 11:52:23 +03:00
Markus Mäkelä
4d5b9cae9c
MXS-2593: Remove unnecessary hangups
The backend DCBs do not have to send hangups in the close protocol API
method. If the conditions for the hangup were true, the session was
already stopping meaning that the client DCB was already closed.
2019-07-06 08:15:22 +03:00
Markus Mäkelä
3e85500491
Merge branch '2.3' into 2.4 2019-07-02 08:38:15 +03:00
Markus Mäkelä
40f35618ad
MXS-2562: Fix out-of-order error during COM_CHANGE_USER
If an error is generated while a COM_CHANGE_USER is being done, it would
always use the sequence number 1. To properly handle this case and send
the correct sequence number, the COM_CHANGE_USER progress needs to be
tracked at the session level.

The information needs to be shared between the backend and client
protocols as the final OK to the COM_CHANGE_USER, with the sequence number
3, is the one that the backend server returns. Only after this response
has been received and routed to the client can the COM_CHANGE_USER
processing stop.
2019-06-28 20:25:31 +03:00
Markus Mäkelä
74d15cee09
MXS-2562: Always send errors with sequence number 1
As is explained in MDEV-19893:

   Client reads from socket, gets the packet from 1. with seqno=0, which
   it does not expect, since seqno is supposed to be incremented. Client
   complains, throws tantrums and exceptions.

To cater for clients that do not expect out-of-bound messages
(i.e. server-initiated packets with seqno 0), all messages generated by
MaxScale should use at least sequence number 1.
2019-06-28 20:25:31 +03:00
Markus Mäkelä
5ab5e914e7
MXS-2582: Deep-copy PS buffers in RWBackend::write
Deep-copying prevents subsequent modifications done by the caller from
affecting the data that can be potentially stored in the write queue of
the backend's DCB.
2019-06-28 09:46:15 +03:00
Markus Mäkelä
fcc19f3c66
Merge branch '2.3' into 2.4 2019-06-27 08:53:33 +03:00
Markus Mäkelä
25a076d072
Fix buffer sizes in PS extraction code
The code used 4 byte buffers for 2 byte values.
2019-06-26 15:49:50 +03:00
Markus Mäkelä
d41d4021a8
Merge branch '2.3' into 2.4.0 2019-06-26 09:20:35 +03:00
Markus Mäkelä
67d82146f1
Fix packet length assertion
The `used_len + len` can be the same as `total_len`.
2019-06-26 09:19:24 +03:00
Markus Mäkelä
88dae197b0
Make packet boundary assertion less costly
mxs::Buffer::iterator is not a random-access iterator and hence will have
linear cost. This is too costly to do on every packet with even moderately
sized resultsets.
2019-06-26 09:13:03 +03:00
Johan Wikman
f961bf1d96 Merge branch '2.3' into 2.4.0 2019-06-25 11:46:44 +03:00
Johan Wikman
b8bb8702bd Fix broken Change Dates
Were not correct, so were not updated with all others.
2019-06-25 09:52:42 +03:00
Johan Wikman
2ab9aa9a94 Update 2.4.0 Change Date 2019-06-25 09:19:55 +03:00
Markus Mäkelä
873ea92915
Assert that packet is inside the buffer
The buffer containing the response should contain only complete packets.
2019-06-25 09:05:49 +03:00
Niclas Antti
f5615cc174 MXS-2555 Add support for unix sockets to LocalClient 2019-06-19 15:31:34 +03:00
Niclas Antti
2343326ecc MXS-2555 Add execute_kill version, that kills all but a given mysql_thread_id
NOTE: This does not work whit unix scokets. The reason is that LocalClient
assumes network sockets. TODO: to add unix socket support.
2019-06-19 15:31:34 +03:00
Niclas Antti
56e5c417c1 MXS-2555 uncrustify mysql_common.cc, and a minor bug fix in smartrouter.cc 2019-06-19 15:31:34 +03:00
Markus Mäkelä
7dde0edb54
Clean up unexpected error handling in readwritesplit
By using the Error class, the code can be cleaned up and simplified.
2019-06-14 15:18:01 +03:00
Markus Mäkelä
c819271cab
Merge branch '2.3' into develop 2019-06-14 09:40:19 +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
Markus Mäkelä
8311dba654
Send the OK outside the KILL functions
By sending the OK for the KILL commands outside the function, they can be
used to kill connections that do not expect responses.
2019-06-13 16:44:26 +03:00
Markus Mäkelä
1f46f1bfca
Merge branch '2.3' into develop 2019-06-12 12:24:07 +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
Johan Wikman
a2b046a482 MXS-2512 Use typenames consistently 2019-06-11 09:44:27 +03:00
Johan Wikman
b09a4e676d MXS-2512 Do not recalculate information that exists
As the end of the error packet is known, it is better to pass
around an iterator to that instead of recalculating it.
2019-06-11 09:44:27 +03:00