10058 Commits

Author SHA1 Message Date
Markus Mäkelä
07821970ff
MXS-1503: Remove false debug assertion
It is possible, and perfectly OK, for the new master to be in use at the
same time the old master is. This is the case if one of the slaves is
promoted as the master.
2018-04-03 13:32:10 +03:00
Markus Mäkelä
caa5fe89bb
MXS-1503: Make sure backend is in use before using it
The get_backend_from_dcb function needs to check that the backend is in
use before comparing the pointer. This prevents stale pointers from being
used and is logically more sound than relying on raw DCB matches.
2018-04-03 13:32:10 +03:00
Markus Mäkelä
be0ab82283
MXS-1503: Fix master failure logging logic
The code that logs the master failure error was not working correctly
after the changes done for MXS-359 and MXS-1503. Updated the logic and
converted impossible cases into debug assertions.
2018-04-03 13:32:10 +03:00
Markus Mäkelä
34346f4de9
MXS-1503: Update tests with new expected results
The master reconnection change makes the second test faulty in
mxs359_error_on_write. After unblocking the master, the session will
reconnect to the master and the query will succeed.
2018-04-03 13:32:10 +03:00
Markus Mäkelä
319122e621
MXS-1502: Add have_session_commands helper function
The function conveys the meaning of the call better than using
session_command_count to check whether there are session commands to be
executed.
2018-04-03 13:32:10 +03:00
Markus Mäkelä
7d4f37d25b
MXS-1503: Fix read-only mode regression
The master_failure_mode=error_on_write mode was broken due to a faulty
assumption that all successfully routed queries would produce a
target. This is not the case when a write in error_on_write mode is
received.
2018-04-03 13:32:09 +03:00
Markus Mäkelä
a15d36b2f0
MXS-1503: Take EqualPointees<T> into use
Take the template into use in readwritesplit.
2018-04-03 13:31:53 +03:00
Markus Mäkelä
98fb2cf5ed
MXS-1503: Add EqualPointees<T> template
The templated provides an unary predicate for (shared) pointers that
allows containers containing pointers to objects to be searched, not by
pointer comparisons but by comparisons of the values that they point
to. This allows std::find_if to be used with shared pointers in a similar
manner that std::find is used with non-pointer objects.
2018-04-03 13:31:40 +03:00
Markus Mäkelä
14e399dd68
Move RWSplitSession into rwsplitsession.cc
Moved the class method definitions into the correct file.
2018-04-03 13:30:55 +03:00
Markus Mäkelä
d5643bc14d
Create RWBackends from servers
Added a helper function that creates a list of servers to use. This should
remove some of the duplicate code in the routers.
2018-04-03 13:30:55 +03:00
Markus Mäkelä
6ef9e1fd9a
Move RWBackend into a separate file
Moved the RWBackend class implementation into its own file. Made some of
the command type functions a part of the <maxscale/protocol/mysql.h>
header to make it reusable.
2018-04-03 13:30:55 +03:00
Markus Mäkelä
8206e1f46d
Move RWBackend::reply_is_complete into rwsplitsession.cc
The function is now defined in the correct file. Removed the debug output
as it can be logged inside RWBackend::set_reply_state.
2018-04-03 13:30:54 +03:00
Markus Mäkelä
8222bdbc20
Move reply_is_complete into RWBackend
Moved the reply state checking inside the RWBackend class to make it
possibly reusable in other parts of MaxScale. Also removed a redundant
function.
2018-04-03 13:30:54 +03:00
Markus Mäkelä
3857912c61
MXS-1503: Abort connection when inside transaction
Before the transaction migration is implemented, the connection must be
closed if a transaction is open and the connection to the master is
lost. Doing this retains the same transactionality as a direct connection
to the server would.
2018-04-03 13:30:54 +03:00
Markus Mäkelä
ff496979f6
MXS-1503: Add test case
Added test case that checks that session commands are properly executed.
2018-04-03 13:30:54 +03:00
Markus Mäkelä
7f0745e552
MXS-1503: Queue command if executing a session command
When a non-connected target is chosed as the target server and the session
command history is not empty, the query needs to be placed into the query
queue and routed only after the session commands have been executed.
2018-04-03 13:30:53 +03:00
Markus Mäkelä
e57ac4b0a3
MXS-1502: Prune session commands
The session command history is now compacted to contain only the first and
last execution of a session command. This should still allow most of the
more eccentric use-cases of user variables while keeping the session
command history smaller.

Added some convenience functions into the SessionCommand class to make the
pruning process easier.
2018-04-03 13:30:53 +03:00
Markus Mäkelä
ce853d3f7f
MXS-1503: Enable limited session command history
Enabling the session command history but limiting it to a history of 50
commands allows reconnections for sessions that don't change the state too
often.

As pooled connections will exceed this limit quite fast, they are not able
to reconnect to servers once connections are lost. To solve this problem,
the session command history needs a compaction process that removes
redundant history.
2018-04-03 13:30:53 +03:00
Markus Mäkelä
dd59e7181c
Remove references to router_options
As they are deprecated, they should not be mentioned in the examples. Also
moved the router_options documentation under a Legacy Configuration
heading.
2018-04-03 13:30:53 +03:00
Markus Mäkelä
7e4665b03b
MXS-1503: Respect max_slave_connections
The slave selection now again respects max_slave_connections. This means
that the amount of slave connections each session has will never grow
beyond the configured value.
2018-04-03 13:30:52 +03:00
Markus Mäkelä
4cf9bec10b
MXS-1503: Restore slave reconnection
The slave connections can now be recovered after a failure as long as the
session command history is enabled. In comparison to the old
functionality, the server now replaces the connection when a query is
received instead of reconnecting when the slave fails.

As a negative side effect of this change, the max_slave_connections is no
longer enforced after the connection is created. To fix this broken
functionality, the connected slaves need to be preferred over unconnected
ones. This will be added in a follow-up commit.
2018-04-03 13:30:52 +03:00
Markus Mäkelä
3d63d18bdd
MXS-1503: Split get_target_backend into smaller pieces
Split the code into separate functions. This should make it easier to
comprehend.
2018-04-03 13:30:52 +03:00
Markus Mäkelä
9c7578272c
MXS-1503: Refactor slave selection
Refactored and cleaned up the slave selection in preparation of
reconnection code unification.
2018-04-03 13:30:52 +03:00
Markus Mäkelä
876187b340
MXS-1503: Enable master reconnection
The `master_reconnection` parameter now controls both the reconnection of
the master server as well as the migration of the master server to another
server. Although these two cases appear to be different, the end result
from readwritesplit's point of view is the same and are thus controlled
with the same parameter.

The RWBackend class now resets its internal state when it is closed. This
allows readwritesplit to handle the case when a result was expected from
the master but the master died before the result was returned. The same
code should also handle slave connection failures mid-result, allowing
Backend reuse.

Added a test case that verifies the new functionality when combined with
`master_failure_mode=error_on_write`.
2018-04-03 13:30:51 +03:00
Markus Mäkelä
481db8acbc
MXS-359: Rename parameter to master_reconnection
Changing the parameter name to `master_reconnection` allows similar
reconnection functionality to be combined under one parameter.
2018-04-03 13:30:51 +03:00
Markus Mäkelä
3f803ab3e8
MXS-1503: Don't use empty smart pointers
The check for the existence of a valid pointer is now done in the correct
place.
2018-04-03 13:30:51 +03:00
Markus Mäkelä
be2186c8f1
MXS-1503: Remove redundant code
Moved session command execution into the Backend class itself as the
session commands are defined as a related part of it. This allows all
connections to execute session commands if some are available.

Removed explicit SERVER_REF usage in the readwritesplit connection
creation code and replaced it with SRWBackend. This allows the removal of
the get_root_master_backend function which duplicated the functionality in
get_root_master.
2018-04-03 13:30:51 +03:00
Markus Mäkelä
a1b5fcd4ff
MXS-1503: Clean up connection creation function
The select_connect_backend_servers function is the main connection
creation function. Cleaned it up and split it into smaller, reusable
parts.
2018-04-03 13:30:51 +03:00
Markus Mäkelä
a0a37bf793
MXS-1503: Disable reconnection in clientReply
Disabled the reconnection in clientReply prior to moving the connection
creation code into routeQuery. This allows new connections to be made when
they are needed.
2018-04-03 13:30:50 +03:00
Markus Mäkelä
9f256f50eb
Merge branch '2.2' into develop 2018-04-03 11:01:06 +03:00
Markus Mäkelä
9291815bcd
Wait for monitor to start in mxs1719
The test starts MaxScale and immediately connects to it. As the monitoring
is asynchronous, we need to give it a few seconds to stabilize.
2018-04-03 10:59:55 +03:00
Markus Mäkelä
f743e99795
Set internal DCB to NULL on close
The Backend::dcb() method gives the raw pointer to the internal DCB. This
pointer is used by at least readwritesplit to map raw DCB pointers to
backends. To prevent stale pointers from being returned, m_dcb needs to be
set to NULL after it has been closed.
2018-04-03 10:59:55 +03:00
Markus Mäkelä
177e3251ad
Clarify retain_last_statements documentation
Added an explicit note about usage of the retain_last_statements parameter
and that it requires dump_last_statements to work.
2018-04-03 10:59:52 +03:00
Markus Mäkelä
4167e88719
MXS-1751: Fix crash with available_when_donor=true
The `MYSQL_ROW row` variable was being overwritten by the extra query done
by the SST method detection code. Moving it into its own function prevents
this and makes the code significantly easier to comprehend.

Added a test case that reproduced the problem (MaxScale crashed) and
verifies that the patch fixes the problem.
2018-03-31 20:21:07 +03:00
Timofey Turenko
b11fb53b95 Merge branch '2.2' of github.com:mariadb-corporation/MaxScale into 2.2 2018-03-29 15:51:52 +03:00
Timofey Turenko
fa41ca28e2 remove trailing whitespaces from MDBCI scripts 2018-03-29 15:51:36 +03:00
Markus Mäkelä
3da5b535c8
Merge branch '2.2' into develop 2018-03-29 14:25:40 +03:00
Markus Mäkelä
01b04094a6
Only check for cores at root level
The previous core check would pick up any file in /tmp/ that would start
with the `core` prefix. This included some npm generated files which are
created if MaxCtrl is built on the MaxScale machine.
2018-03-29 14:25:19 +03:00
Timofey Turenko
7be55a77bb add several attempts to connect in upgrade test 2018-03-29 14:16:26 +03:00
Johan Wikman
1ddcb15547 MXS-1625 Move RWS specific data out from function
In order to be able to move routing decision into the
query classifier, no RWS specific data can be present.
2018-03-29 13:02:38 +03:00
Johan Wikman
0d9e013325 Merge branch '2.2' into develop 2018-03-29 13:02:16 +03:00
Johan Wikman
3d92042362 Merge branch '2.2.4' into 2.2 2018-03-29 13:01:58 +03:00
Johan Wikman
bd77de118f Add missing documentation link 2018-03-29 12:56:45 +03:00
Markus Mäkelä
fc9998f1b4
Merge branch '2.2' into develop 2018-03-28 16:50:45 +03:00
Markus Mäkelä
eca77fb4c9
Improve core dump detection
The core dump detection now properly distinguishes core dumps and ssh
failures.
2018-03-28 16:50:27 +03:00
Esa Korhonen
923de851f9 MXS-1703 Move more functions to MariaDBServer
Also, the QueryResult integer reading method now only reads non-negative integers
since the server rarely returns negative values. This frees negative values for
indicating parsing error(s).

Gtid-class was moved back to utility.hh/.cc because the QueryResult-class requires it.
2018-03-28 13:47:07 +03:00
Johan Wikman
27fd0e78b5 Merge branch '2.2' into develop 2018-03-28 13:25:53 +03:00
Esa Korhonen
f7ea12b8e4 Merge branch '2.2' into develop 2018-03-28 13:24:54 +03:00
Johan Wikman
6d4691617c Update 2.2.4 release date. 2018-03-28 13:17:55 +03:00
Johan Wikman
b51e6d4030 Update 2.2.4 release date. 2018-03-28 13:13:17 +03:00