Commit Graph

10051 Commits

Author SHA1 Message Date
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
14e399dd68 Move RWSplitSession into rwsplitsession.cc
Moved the class method definitions into the correct file.
2018-04-03 13:30:55 +03:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
9f256f50eb Merge branch '2.2' into develop 2018-04-03 11:01:06 +03:00
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
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
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
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
b11fb53b95 Merge branch '2.2' of github.com:mariadb-corporation/MaxScale into 2.2 2018-03-29 15:51:52 +03:00
fa41ca28e2 remove trailing whitespaces from MDBCI scripts 2018-03-29 15:51:36 +03:00
3da5b535c8 Merge branch '2.2' into develop 2018-03-29 14:25:40 +03:00
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
7be55a77bb add several attempts to connect in upgrade test 2018-03-29 14:16:26 +03:00
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
0d9e013325 Merge branch '2.2' into develop 2018-03-29 13:02:16 +03:00
3d92042362 Merge branch '2.2.4' into 2.2 2018-03-29 13:01:58 +03:00
bd77de118f Add missing documentation link 2018-03-29 12:56:45 +03:00
fc9998f1b4 Merge branch '2.2' into develop 2018-03-28 16:50:45 +03:00
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
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
27fd0e78b5 Merge branch '2.2' into develop 2018-03-28 13:25:53 +03:00
f7ea12b8e4 Merge branch '2.2' into develop 2018-03-28 13:24:54 +03:00
6d4691617c Update 2.2.4 release date. 2018-03-28 13:17:55 +03:00
b51e6d4030 Update 2.2.4 release date. 2018-03-28 13:13:17 +03:00
93cd4e7de3 MXS-1625 Remove rwsplit_tmp_table_multi.cc
Contains no functionality anymore.
2018-03-28 12:43:07 +03:00
7209080236 MXS-1747 Improve error messages of rejoin operations
Now states which query caused the error.
2018-03-28 12:39:10 +03:00
6c32c7421b MXS-1746 Query global gtid_domain_id instead of session-specific value
The monitor queried the session-specific domain id, which does not follow the global
value while the session is alive. This caused the monitor to follow the wrong gtid
domain if the domain was changed after MaxScale was started. This patch modifies the
query to read the global value instead. Even this is not fool-proof, as existing
sessions can issue writes with the old domain, confusing the gtid-parsing.
2018-03-28 12:23:57 +03:00
6ec87ae9f2 Merge branch '2.2' into develop 2018-03-28 09:19:42 +03:00
3be2ee8b28 Merge branch '2.1' into 2.2 2018-03-28 09:19:22 +03:00
46ebf19223 Fix luafilter build failure
The pointer passed to was of the wrong type.
2018-03-27 21:49:35 +03:00
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