20 Commits

Author SHA1 Message Date
Markus Mäkelä
d6c44aaf52
MXS-1804: Allow large session commands
Session commands that span multiple packets are now allowed and will
work. However, if one is executed the session command history is disabled
as no interface for appending to session commands exists.

The backend protocol modules now also correctly track the current
command. This was a pre-requisite for large session commands as they
needed to be gathered into a single buffer and to do this the current
command had to be accurate.

Updated tests to expect success instead of failure for large prepared
statements.
2018-05-03 09:46:47 +03:00
Markus Mäkelä
c8d25f293f
MXS-1506: Clean up various functions
Reduced variable scopes and removed unused code.
2018-04-10 15:31:51 +03:00
Markus Mäkelä
0771701d94
Rename readwritesplit member variables
Prefixed the variables with the `m_` prefix and changed some of them to be
more descriptive.
2018-04-04 14:59:56 +03:00
Markus Mäkelä
15f15be49d
Move most readwritesplit functions into classes
Most of the funtionality is now a member function of either the RWSplit or
RWSplitSession class. This removes the need to pass the router and session
parameters to all functions.
2018-04-03 23:22:29 +03:00
Johan Wikman
0e968c2b28 MXS-1625 All RouteInfo functionality moved to routeinfo.cc
Provides a clearer separation between what deals with query
classification and what deals with query routing.

Functions have only been moved. No other cleanup has been
done.
2018-03-27 16:08:18 +03:00
Markus Mäkelä
e036582a98
Fix typo in readwritesplit log message
The `stmt` label was wrongly set to `pastmt`.
2018-03-08 14:03:46 +02:00
Johan Wikman
13c222488e RWS: Log packet length when logging transaction status 2018-02-25 20:56:02 +02:00
Markus Mäkelä
14a4008c84
MXS-1653: Remove false error message
Removed false error message about failed session commands. An error in
response to a session command is a perfectly valid result.

Also added the explicit commands that the master and slave return to the
warning that is logged when the results differ.
2018-02-07 16:07:17 +02:00
Markus Mäkelä
db61ec0d7e Add missing initialization in readwritesplit
A value was not always initialized for all queries when info level logging
was enabled.
2017-11-16 15:38:13 +02:00
Markus Mäkelä
ecb56ef540 Use references instead of copies of SRWBackend
As the DCB passed as the clientReply parameter is guaranteed to match one
of the DCBs in the RWBackends. By using a reference, the need to copy a
shared_ptr is removed (along with the atomic operation that it implies)
thus reducing the overhead in the clientReply and the functions it uses.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
fbc1a7d44b Fix handling of multi-packet queries in readwritesplit
If a prepared statement sends large amounts of data, the target server
where the data is sent will be tracked. The tracked target was not reset
after a multi-packet query was completed and the target itself was used to
check whether the session was processing a multi-packet query.

Changed the check to use the boolean variable instead of the target and
added a reset of the tracked target after a multi-packet query was
completed.
2017-09-25 10:46:44 +03:00
Markus Mäkelä
45e0e8bb59 Introduce internal protocol command enum
The enums exposed by the connector are not intended to be used by the
users of the library. The fact that the protocol, and other, modules used
it was in violation of how the library is intended to be used.

Adding an internal mapping into MaxScale also removes some of the
dependencies that the core has on the connector.
2017-09-14 15:30:43 +03:00
MassimilianoPinto
cb57e10761 Develop merge
Develop merge
2017-06-29 15:34:22 +02:00
Markus Mäkelä
33a0f8be88 MXS-852: Add support for text protocol prepared statements
When a statement is being prepared, the type and name of the statement is
stored in the router session. If the name of a statement to be executed is
found in the map, the query type that stored in the map is used.
2017-06-22 10:40:18 +03:00
Markus Mäkelä
c7520a2156 Add name and uri helpers to Backend
Providing helper functions for the commonly used parts of the server makes
code easier to read. It also removes any possibility for formatting
problems by moving the URI and name string handling inside the Backend
class.
2017-06-22 10:40:18 +03:00
Markus Mäkelä
37b6cf250d Rename readwritesplit variables
Renamed variables to better represent the types of variables they
represent. Reordered some of the functions so that the functions don't
need to be declared before they are used.
2017-06-22 10:40:18 +03:00
Markus Mäkelä
0c45eb5d17 Take SessionCommand into use in readwritesplit
Readwritesplit now uses the SessionCommand class as a "master list" of
executed session commands. This allows the session commands to be easily
copied over to slaves that are taken into use after session commands have
already been executed.

Currently, the code doesn't execute the session command history when a
mid-session reconnection occurs. A method to cleanly copy the session
commands needs to be exposed by the Backend class.
2017-06-22 10:40:17 +03:00
Markus Mäkelä
dfc1d0a413 Always include debug members in objects
Having the structures be of the same size with and without debug mode is
beneficial when debugging release binaries.
2017-06-22 10:40:16 +03:00
Markus Mäkelä
bd7a26d830 Abstract the session default database
The default database can now be manipulated with a set of functions
exposed by the maxscale/protocol/mysql.h header. This removes the need to
handle the structures themselves in the modules and is a step towards
moving the dcb->data contents inside the session.
2017-06-22 10:40:16 +03:00
Markus Mäkelä
c77dcea807 Compile readwritesplit as C++
Compiling readwritesplit as C++ allows the use of C++ containers.
2017-06-22 10:40:15 +03:00