8856 Commits

Author SHA1 Message Date
Markus Mäkelä
489520a5c0 Process backend packets only once
When the router requires statement based output, the gathering of complete
packets can be skipped as the process of splitting the complete packets
into individual packets implies that only complete packets are handled.

Also added a quicker check for stored protocol commands than a call to
protocol_get_srv_command.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
5c9b953d69 Fix crash in backend command tracking
The backend protocol command tracking didn't check whether the session was
the dummy session. The DCB's session is always set to this value when it
is put into the persistent pool.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
9d3fc27a3c Fix backend protocol command tracking
If a query was processed in the client protocol module when a prepared
statement was being executed by the backend module, the current command
would get overwritten. This caused a debug assertion in readwritesplit to
trigger as the result was neither a single packet nor a collected result.

The RCAP_TYPE_STMT_INPUT capability guarantees that a buffer contains a
complete packet. This information can be used to track the currently
executed command based on the buffer contents which allows asynchronicity
betweent the client and backend protocol. In practice this only comes in
play when routers queue queries for later execution.
2017-10-12 12:29:43 +03:00
Johan Wikman
1e2ef0be70 Order members to ensure alignment
8 + 4 + 4 ensures 16 with 8 byte alignment, which means that
'data' is certain to be 8 byte aligned. 4 + 8 + 4 might result
in something else in some funky environment.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
4ddd9c9ec5 Fix compilation failure in readwritesplit
The debug assertion was missing a parameter.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
0a5ade8927 Check before clearing statements stored in the session
If the session has no stored statements, there's no need to clear them.
2017-10-12 12:29:43 +03:00
Johan Wikman
5d18ab86ea Allocate shared buffer and its data in one chunk
The GWBUF shared buffer and its data is now allocated in one
chunk so that the data directly follows the shared buffer.
That way, creating a GWBUF will involve 2 and not 3 calls to
malloc and freeing one will involve 2 and not 3 calls to free.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
e8f8a3bcdb Inline get_backend_from_dcb
The function is used very often so inlining it should help.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
fbb45ead1a Add minor performance improvements to readwritesplit
The multi-statement detection did not check for the existence of
semicolons before doing the heavier processing.

Calculcate the packet length only once for the result state management.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
b1e224ac84 Clean up get_backend_from_dcb
Replace the original version of the function with the reference version
and use it everywhere. Added runtime assertions to check that an invalid
DCB is never processed.
2017-10-12 12:29:43 +03:00
Johan Wikman
87c01428be Make mxs_mysql_get_command inline 2017-10-12 12:29:43 +03:00
Johan Wikman
a51d23ded0 Bail out earlier when walking parse tree
No point walking the parse tree, if no information will be
collected.
2017-10-12 12:29:43 +03: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ä
a6eeed98fe Fix handling of collected results
The result collection did not reset properly when a non-resultset was
returned for a request. As collected result need to be distinguishable
from single packet responses, a new buffer type was added.

The new buffer type is used by readwritesplit which uses result collection
for preparation of prepared statements.

Moved the current command tracking to the RWBackend class as the command
tracked by the protocol is can change before a response to the executed
command is received.

Removed a false debug assertion in the mxs_mysql_extract_ps_response
function that was triggered when a very large prepared statement response
was processed in multiple parts.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
948f66f918 Make each packet contiguous for RCAP_TYPE_STMT_OUTPUT
As each packet is routed separately, they must be made contiguous before
routing them.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
6c5fa071d5 Inline backend related functions
Inlined the getter/setter type functions that are often used. Profiling
shows that inlining the RWBackend get/set functions for the reply state
manipulation reduces the relative cost of the function to acceptable
levels. Inlining the Backend state function did not have as large an
effect but it appears contribute a slight performance boost.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
a8cf5998dd Use custom result set detection functions
The functions that the readwritesplit uses can assume that the buffer
contains only one packet in contiguous memory.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
7840c86b7f Remove unnecessary result processing in readwritesplit
The result processing code did unnecessary work to confirm that the result
buffers are contiguous. The code also assumed that multiple packets can be
routed at the same time when in fact only one contiguous result packet is
returned at a time.

By assuming that the buffers are contiguous and contain only one packet,
most of the copying and buffer manipulation can be avoided.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
8085ee15be Fix GCC7 warnings in cache filter
The thread count did not have enough space for a INT_MAX.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
1b6e5baa56 Fix GCC7 warnings in binlogrouter
GCC7 reported possible destination buffer overflow in binlogrouter.
2017-10-12 12:29:43 +03:00
Johan Wikman
5a585b1c8a Fix buffer overflow in test program 2017-10-12 12:29:43 +03:00
Johan Wikman
73e41e8eb9 Update bug-list of MaxScale 2.2.0 release notes 2017-10-12 12:29:43 +03:00
Johan Wikman
c4439bc657 Update Change Log for 2.2 2017-10-12 12:29:43 +03:00
Markus Mäkelä
07f166ed8c Fix issue processing script
The script now properly processes repeating commas inside double quotes.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
9a743ec9f3 Add note about MaxCtrl to release notes
Added a note about MaxCtrl in the release notes.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
5521c84258 Fix GTID setup in tests
The GTID setup in tests executed code that was not supposed to be executed
when GTID is in use.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
fa25f5aba8 Fix sync_slaves
The function did not check whether the file name was valid.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
16530b4a97 Clean up setup_binlog_gtid
Removed redundant operations and cleaned up unused code.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
8be898d1d3 Disable multi-MaxScale initialization by default
Only tests that require multiple MaxScale instances should enable the
multi-MaxScale mode.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
81dba9767c Order member variable initialization in TestConnections
The variables are now initialized in order and always in the constructor.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
40cbf37d64 Add example to REST API module command documentation
Added an example that demonstrates how to call a module command with
parameters via the REST API.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
7b261ac99d Use absolute paths in kerberos_setup
The files were located in the vagrant user's home directory but superuser
access is needed to copy them into /etc.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
e58f6d6317 Add methods for changing the active MaxScale instance
The new function allows two MaxScale instances to be controlled via the
same TestConnections object. This will allow testing of Maxscale clusters.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
65b4612ff4 Run smoke tests by default
The tests are now run as the shorter version by default.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
1521bae3b5 Use new MaxScale object names in mxs1457_ignore_deleted
The names of the monitors and services in tests that use MaxScale 2.2 need
to use the hyphen-transformed versions of the object names.
2017-10-12 12:29:43 +03:00
Markus Mäkelä
8a55bbfca8 Fix typo in IP testing database
The test had a typo in the SQL that created the database so the later
queries that referred to it always failed.
2017-10-12 12:29:43 +03:00
MassimilianoPinto
69cddb2695 MXS-1466: Add support for new variables: @@log_bin, @@max_connections, @@gtid_strict_mode etc
MXS-1466: Add support for new variables: @log_bin, @@max_connections,
@@gtid_strict_mode etc
2017-10-09 18:57:23 +02:00
Johan Wikman
df816ea2a9 MXS-1460 Add failover_script parameter
The failover script can now be specified in the configuration file.
2017-10-03 15:24:29 +03:00
Markus Mäkelä
613994ca8a Merge branch '2.2' into 2.2-mrm 2017-10-03 15:15:39 +03:00
Markus Mäkelä
54a7051a3f Fix tests broken by the merge
The merge caused compilation failures in two of the files.
2017-10-03 15:14:06 +03:00
Markus Mäkelä
8c3c103060 Merge branch '2.2' into 2.2-mrm 2017-10-03 14:52:21 +03:00
Markus Mäkelä
7ca8db14de MXS-1444: Add monitor parameter alteration
The parameter handling for monitors can now be done in a consistent manner
by establishing a rule that the monitor owns the parameter object as long
as it is running. This will allow parameters to be added and removed
safely both from outside and inside monitors.

Currently this functionality is only used by mysqlmon to disable failover
after an attempt to perform a failover has failed.
2017-10-03 14:50:20 +03:00
Markus Mäkelä
4ee5c991c2 MXS-1452: Extend kill parsing test
The test now correctly checks for usernames and integer overflow.
2017-10-03 14:47:16 +03:00
Markus Mäkelä
96d160f897 MXS-1452: Add support for KILL USER <name>
Added support for killing queries by username. This will kill all
connections from that particular user on all servers.
2017-10-03 14:47:16 +03:00
Markus Mäkelä
4150dee952 Extend KILL parsing test
Added test cases for `KILL [ HARD | SOFT ] [CONNECTION | QUERY ]`.
2017-10-03 14:47:16 +03:00
Markus Mäkelä
49b179bf69 Add HARD/SOFT to executed KILL commands
The HARD and SOFT keywords are parsed and added to the executed KILL
commands.
2017-10-03 14:47:16 +03:00
Markus Mäkelä
4dd6842447 Send KILL commands to backends
KILL commands are now sent to the backends in an asynchronous manner. As
the LocalClient class is used to connect to the servers, this will cause
an extra connection to be created on top of the original connections
created by the session.

If the user does not have the permissions to execute the KILL, the error
message is currently lost. This could be solved by adding a "result
handler" into the LocalClient class which is called with the result.
2017-10-03 14:47:16 +03:00
Markus Mäkelä
a7e610a70a Extract shared session information in LocalClient constructor
When the LocalClient is constructed, it is possible to extract all the
needed information at that time. The only obstacle is the fact that the
LocalClient is constructed at the same time the session is. Since the
client DCB is created before the session, it is safe to extract the shared
data directly from it.
2017-10-03 14:47:16 +03:00
Markus Mäkelä
cd83aa40db Stop monitors first when shutting down
As monitors aren't synchronized with the worker threads, they need to be
shut down first.
2017-10-03 14:47:16 +03:00
Markus Mäkelä
27d1be7f96 Merge branch '2.2' of github.com:mariadb-corporation/MaxScale into 2.2 2017-10-03 14:46:14 +03:00