8854 Commits

Author SHA1 Message Date
Johan Wikman
37c804e0d3 MXS-1327 Warn if debug priority enabled in release mode
Turning debug on has no effect if MaxScale has been built in
release mode. A warning will now be displayed to the user if
that is attempted.
2017-10-19 12:56:12 +03:00
Johan Wikman
501c35d7b2 Correct typo in cache documentation 2017-10-19 11:40:21 +03:00
Johan Wikman
6618049c24 Add note about PL/SQL support 2017-10-19 11:40:21 +03:00
MassimilianoPinto
f0d16e3ac5 Typo fixed
Typo fixed
2017-10-13 16:20:05 +02:00
Johan Wikman
9cec8fa0fb MXS-1464 Update ChangeLog and release notes 2017-10-12 14:56:09 +03:00
Johan Wikman
d1df1837a4 MXS-1464 When pre-parsing, only check maxscale section
When pre-parsing the configuration file, the existence of environment
variables is only done for the [maxscale] section. For other sections
a nicer error message is obtained if the comlplaint is made when the
configuration file is actually loaded.

Mechanism for providing custom error message from the pre-parsing
function added.
2017-10-12 14:56:09 +03:00
Johan Wikman
22f4b02b44 MXS-1464 Substitute environment variables
If 'substitute_variables' has been set to true, then the value of
a parameter like `some_param=$SOME_VAR' is replaced with the value
of the environment variable 'SOME_VAR'.

It is a fatal error to refer to a variable that does not exist.
2017-10-12 14:56:09 +03:00
Johan Wikman
1666c9f0b6 MXS-1464 Add config 'substitute_variables'
With this variables set to true, if $VAR is used as a value in the
configuration file, then `$VAR` will be replaced with the value of
the environment variable VAR.
2017-10-12 14:56:09 +03:00
Markus Mäkelä
2534c9b824 Update replication-manager test
The test now checks whether replication-manager launched by a script
works. This is closer to how one of the original blog posts define the
setup.
2017-10-12 13:16:12 +03:00
Markus Mäkelä
938484a73e Allow remote server to be used for maxctrl test suite
The test suite now works with remote servers and is now fully integrated
to the regression test suite.
2017-10-12 13:16:12 +03:00
Markus Mäkelä
47b1004134 Add proper cluster testing scripts
The scripts start MaxScale processes on two different servers. The support
framework for the tests is in place but the tests themselves still need to
be modified to allow the use of non-localhost addresses.
2017-10-12 13:16:12 +03:00
Markus Mäkelä
9617b55905 Run MaxCtrl test suite in the regression test suite
The MaxCtrl test suite is now a part of the regression test suite. The
cluster tests are expected to fail as that is yet to be implemented.

Also fixed the return value of TestConnections::ssh_maxscale.
2017-10-12 13:16:12 +03:00
Johan Wikman
6e4cb3b293 Update release date 2017-10-12 11:16:34 +03:00
Johan Wikman
fc488ee278 Update release notes 2017-10-11 09:27:01 +03:00
Markus Mäkelä
88325a9d36 Fix resultset handling with binary data
When binary data was processed, it was possible that the values were
misinterpreted as OK packets which caused debug assertions to trigger.

In addition to this, readwritesplit did not handle the case when all
packets were routed individually.
2017-10-11 09:19:40 +03:00
Markus Mäkelä
8a69232e26 Fix usage of partial packets when full packets are expected
The authentication phase expects full packets. If the packets aren't
complete a debug assertion would get hit. To detect this, the result of
the extracted buffer needs to be checked.
2017-10-11 09:19:40 +03:00
Markus Mäkelä
c3627c83be Fix hang on multi-statemet query
If multiple queries that only generate OK packets were executed, the
result returned by the server would consist of a chain of OK packets. This
special case needs to be handled by the modutil_count_signal_packets.

The current implementation is very ugly as it simulates a result with at
least one resultset in it. A better implementation would hide it behind a
simple boolean return value and an internal state object.
2017-10-11 09:19:40 +03:00
Markus Mäkelä
820e86ac7d Fix buffer length calculation in modutil_count_signal_packets
The optimization of the buffer iteration did not decrement the total
buffer length.
2017-10-11 09:19:40 +03:00
Johan Wikman
f5f39efcdc Update 2.2.0 release notes 2017-10-10 13:37:21 +03:00
Markus Mäkelä
42cb6bbff7 Fix multi-statement execution in readwritesplit
A multi-statements can return multiple resultsets in one response. To
accommodate for this, both the readwritesplit and modutil code must be
altered.

By ignoring complete resultsets in readwritesplit, the code can deduce
whether a result is complete or not.
2017-10-10 08:25:18 +03:00
Markus Mäkelä
d9922ac895 Fix debug assertion in modutil_count_signal_packets
The original offset needs to be separately tracked to assert that an OK
packet is not the first packet in the buffer. The functional offset into
the buffer is modified to reduce the need to iterate over buffers that
have already been processed.
2017-10-10 07:25:47 +03:00
Markus Mäkelä
cdf68ab86e Fix muti-result handling in modutil_count_signal_packets
The function assumed that the buffer would not contain a trailing OK
packet that completes a multi-result response.
2017-10-10 07:14:05 +03:00
Markus Mäkelä
139b974306 Add function for logging buffer contents as hex
The gwbuf_hexdump write the contents of the buffer into the info log. This
is quite helpful for debugging of protocol related problems.
2017-10-10 07:11:37 +03:00
Markus Mäkelä
30a99b2632 Fix unintentional fallthrough
When LEAST_BEHIND_MASTER routing criteria was used, the info level logging
function would fall through to the default case. In debug builds, this
would trigger a debug assertion.
2017-10-10 06:10:11 +03:00
Markus Mäkelä
08bdbb45db Add missing initialization of MySQLProtocol::collect_result
The variable was not initialized.
2017-10-09 19:52:35 +03:00
Markus Mäkelä
d64cd5cab8 Return results as sets of packets
Returning the results of a query as a set of packets is currently more
efficient. This is mainly due to the fact that each individual packet for
single packet routing is allocated from the heap which causes a
significant loss in performance.

Took the new capability into use in readwritesplit and modified the
reply_is_complete function to work with non-contiguous results.
2017-10-09 19:26:08 +03:00
Markus Mäkelä
3015e6c97d Add file names and line numbers to stacktraces
The GLIBC backtrace functionality doesn't generate file names and line
numbers in the generated stacktrace. This can to be done manually by
executing a set of system commands.

Conceptually doing non-signal-safe operations in a signal handler is very
wrong but as stacktraces are only printed when something has gone horribly
wrong, there is no real need to worry about making things worse.

As a safeguard for fatal errors while the stacktrace is being generated,
it is first dumped into the standard error output of the process. This
will function even if malloc is corrupted.
2017-10-09 16:14:36 +03:00
Markus Mäkelä
6b7ccea4e3 Fix large_insert_hang compilation failure
Added missing changes that weren't added to last commit.
2017-10-09 16:01:40 +03:00
Markus Mäkelä
ede52c8af9 Add OK packet processing test
Added a test case which exercises the OK packet handling in
readwritesplit.
2017-10-09 14:05:38 +03:00
Markus Mäkelä
2c2f86cebb Fix OK packet status extraction in readwritesplit
As the row count and last insert ID are length-encoded integers, they need
to be handled with the correct functions.
2017-10-09 13:38:12 +03:00
Markus Mäkelä
13265876a9 Add MaxCtrl test for start/stop maxscale
Added the missing test case for starting and stopping MaxScale.
2017-10-09 13:12:30 +03:00
Markus Mäkelä
80892c1657 Update MaxCtrl documentation
Fixed the usage help for each command.
2017-10-09 13:12:30 +03:00
MassimilianoPinto
9805df7af0 Update Avro router documentation
Update Avro router documentation
2017-10-09 11:00:02 +02:00
Markus Mäkelä
c8b9bf09b8 Fix typo in readwritesplit comments
The comment about the static variable being returned as a reference was
missing the `return` word.
2017-10-08 23:28:01 +03:00
Markus Mäkelä
75316712e7 Fix error messages in sync_slaves
Fixed missing newlines in the error output printf calls of
sync_slaves. Changed the order of commands pers_02 executes to a more
correct way.
2017-10-08 23:26:22 +03:00
Markus Mäkelä
c5ff130b33 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-08 23:15:18 +03:00
Markus Mäkelä
d97742bf66 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-08 22:06:43 +03:00
Markus Mäkelä
2ca050156f 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-08 08:52:53 +03:00
Johan Wikman
b8035a6047 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-07 10:01:48 +03:00
Markus Mäkelä
b80cf36f1f Fix compilation failure in readwritesplit
The debug assertion was missing a parameter.
2017-10-06 16:43:27 +03:00
Markus Mäkelä
9d6c2010b3 Check before clearing statements stored in the session
If the session has no stored statements, there's no need to clear them.
2017-10-06 16:00:10 +03:00
Johan Wikman
b00964dc54 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-06 15:29:58 +03:00
Markus Mäkelä
225837cf6e Inline get_backend_from_dcb
The function is used very often so inlining it should help.
2017-10-06 15:05:39 +03:00
Markus Mäkelä
27aa435080 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-06 15:05:39 +03:00
Markus Mäkelä
e14234cb1e 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-06 15:05:39 +03:00
Johan Wikman
83b26a986f Make mxs_mysql_get_command inline 2017-10-06 13:46:09 +03:00
Johan Wikman
8f076be142 Bail out earlier when walking parse tree
No point walking the parse tree, if no information will be
collected.
2017-10-06 12:59:31 +03:00
Markus Mäkelä
81f9425c9b 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-06 11:34:33 +03:00
Markus Mäkelä
5f13f1d358 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-06 03:11:27 +03:00
Markus Mäkelä
f26203cec4 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-06 01:11:18 +03:00