Commit Graph

2312 Commits

Author SHA1 Message Date
926d029373 MXS-1506: Remove explicit pointer use from diagnostics
As the diagnostics functions are a part of the RWSplit class, there's no
need to use the self pointer.
2018-04-10 15:31:12 +03:00
ff5b2c85d6 MXS-1506: Simplify logging in connection creation
The logging in the RWSplit::select_connect_backend_servers was quite
cumbersome and doing the logging when the connection is created makes for
a more information rich output (we know what servers were taken into use
and when).

Changed the log messages to use the names of the servers instead of the
address and port.
2018-04-10 15:31:12 +03:00
d6f98784f7 MXS-1506: Use session_delay_routing with retry_failed_reads
Using the same functionality with the failed read retrying mechanism
removes the need to have multiple versions of the target deduction logic.
2018-04-10 15:31:11 +03:00
34008082e5 Rename to has_session_commands
This way it is similar to other member functions.
2018-04-10 15:30:28 +03:00
951a55ef43 Format readwritesplit source code
Formatted all files with Astyle.
2018-04-10 15:30:27 +03:00
dc338ff3f2 Move causal read reply processing into sub-function
This makes the clientReply a lot easier to comprehend.
2018-04-10 15:29:31 +03:00
465a17d439 MXS-1503: Remove false debug assertion
It is possible that the routing fails even if master_reconnection is
enabled and a second master is available. This is the case when a
transaction is open or autocommit is disabled which is what the
mxs359_master_switch test tests.
2018-04-10 15:29:31 +03:00
e5e607908d MXS-1506: Add router to MXS_DOWNSTREAM helper function
The function makes it easier to deal with the delayed query routing as
well as removing redundancy in the code.
2018-04-10 15:29:30 +03:00
c70216390f MXS-1506: Combine housekeeper task types
The tasks themselves now control whether they are executed again. To
compare it to the old system, oneshot tasks now return `false` and
repeating tasks return `true`.

Letting the housekeeper remove the tasks makes the code simpler and
removes the possibility of the task being removed while it is being
executed. It does introduce a deadlock possibility if a housekeeper
function is called inside a housekeeper task.
2018-04-10 15:29:30 +03:00
96a0aae7fe MXS-1506: Move all functionality into Housekeeper
The class now does all of the work and the API wraps the calls to the
member methods. Using an STL container makes the list management a lot
more convenient.
2018-04-10 15:29:30 +03:00
b33f464eea MXS-1506: Make heartbeat reads atomic
The old hkheartbeat variable was changed to the mxs_clock() function that
simply wraps an atomic load of the variable. This allows it to be
correctly read by MaxScale as well as opening up the possibility of
converting the value load to a relaxed memory order read.

Renamed the header and associated macros. Removed inclusion of the
heartbeat header from the housekeeper header and added it to the files
that were missing it.
2018-04-10 15:29:29 +03:00
761fda2806 Add delayed query retry prototype
This is a proof-of-concept that validates the query retrying method. The
actual implementation of the query retrying mechanism needs more thought
as using the housekeeper is not very efficient.
2018-04-10 15:29:29 +03:00
d65af04d19 MXS-1625 Make as much private as possible in QueryClassifier
Some stuff that is manipulated from RWS must be left public
for the time being.
2018-04-10 14:14:55 +03:00
563a33ae56 MXS-1625 Move get_target_type() to QueryClassifier 2018-04-10 14:14:55 +03:00
42e72bfb81 MXS-1625 Move handle_multi_temp_and_load to QueryClasifier 2018-04-10 14:14:55 +03:00
369029b612 MXS-1625 Move check_for_multi_stmt to QueryClassifier 2018-04-10 14:14:55 +03:00
9a6d66f104 MXS-1625 Move functions to QueryClassifier 2018-04-10 14:14:55 +03:00
505d6b5889 MXS-1625 Move check_create_tmp_table() to QueryClassifier 2018-04-10 14:14:55 +03:00
c8673bc0b3 MXS-1625 Move determine_query_type() to QueryClassifier 2018-04-10 14:14:55 +03:00
18ca7018b1 MXS-1625 Move log_transaction_status() to QueryClassifier 2018-04-10 14:14:55 +03:00
5689613801 MXS-1625 Hint-handling moved to QueryClassifier 2018-04-10 14:14:55 +03:00
c8961a3d14 MXS-1625 Move QueryClassifier::Handler to RWSplitSession 2018-04-10 14:14:55 +03:00
a102ddf5de MXS-1625 Remove final traces of RWSplitSession
The code for figuring out the where to send a statement does no
longer depend upon RWSplitSession but only on QueryClassifier.
So now the functionality can be moved into QueryClassifier after
which further cleanup and streamlining can be done.
2018-04-10 14:14:55 +03:00
300de4ecc6 MXS-1625 Move internal/external id map to QueryClassifier 2018-04-10 14:14:55 +03:00
304499bd36 Merge branch '2.2' into develop 2018-04-10 14:05:39 +03:00
36bea39b63 MXS-1625 Remove need for RWS session from handle_multi_temp_and_load() 2018-04-05 15:05:04 +03:00
05a6aa2dea MXS-1625 Remove need for RWS session in helper functions 2018-04-05 14:04:30 +03:00
00ee271656 MXS-1625 Remove need for RWS session in log_transaction_status() 2018-04-05 13:54:37 +03:00
08987e3e85 MXS-1625 Remove need for RWS session in check_create_tmp_table 2018-04-05 13:42:39 +03:00
1133173a65 MXS-1625 Move tmp table management to QueryClassifier
Eventually only managed by QueryClassifier.
2018-04-05 13:38:55 +03:00
59d257579c MXS-1625 Move LOAD DATA sent statistics to QueryClassifier
Eventually the tracking will be internal to QueryClassifier.
2018-04-05 12:46:27 +03:00
340c132096 MXS-1625 Remove runtime checks for impossible errors
A readwritesplit session must have a client DCB and the DCB must
have data, otherwise the system is seriously broken. So no point
in checking for that and logging an error. Situations like that
might have been possible in the olden days when a session could
be manipulated by multiple threads at the same time.
2018-04-05 12:24:13 +03:00
8c0033ccb2 MXS-1625 Figure out multi statement state at startup
Whether or not multi statements are allowed is checked when
the QueryClassifier instance is created.
2018-04-05 10:16:23 +03:00
25386c4381 MXS-1625 Use PSManager of QueryClassifier 2018-04-05 10:16:23 +03:00
befc34dea7 Fix RWSplitSession::route_stored_query
A member variable and local variable had the same names which caused the
member variable to not be used. With the change in the member variable,
this went unnoticed.
2018-04-04 20:54:46 +03:00
a2fcecd98f MXS-1743: Fix usage of both master and slave types
The use of `router_options=master,slave` was not working as expected. This
was mostly caused by the master bit checks using a bitwise AND instead of
comparing equality. In addition to this, the master would not be
considered a valid candidate if both slaves and masters were available.
2018-04-04 19:43:46 +03:00
8596fea62a MXS-1625 Fix rebase breakage 2018-04-04 15:26:29 +03:00
c08120846c MXS-1625 large_query flag moved from RWS session to query classifier 2018-04-04 15:20:38 +03:00
bc22790e1b MXS-1625 Move tmp table state variable to mxs::QueryClassifier 2018-04-04 15:18:51 +03:00
8220c31664 MXS-1625 Move load data state to QueryClassifier
Still managed from the outside, but eventually will be managed
entirelly by QueryClassifier.
2018-04-04 15:16:46 +03:00
563fa2c840 MXS-1625 Add QueryClassifier instance to RWSplitSession
The readwritesplit session now has a mxs::QueryClassifier instance
as member.
2018-04-04 15:13:51 +03:00
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
5e64695492 Move RWSplitSession methods into rwsplitsession.cc
Moved the RWSplitSession method implementations into the correct files.
2018-04-04 14:51:49 +03:00
87de1dc468 Only add MASTER_GTID_WAIT if it fits into one packet
The MASTER_GTID_WAIT "prefix" should only be added if it fits into one
packet. This is not a complete solution as it prevents queries larger than
16MB from benefiting from the consistent reads.
2018-04-04 14:47:29 +03:00
5a846063c1 Fix assignment of varible to itself
Caused by refactoring.
2018-04-04 14:33:00 +03:00
a762b76cbf MXS-1506: Remove redundant variables
Keeping track of the closed state of the session inside the router session
itself is not needed as the MaxScale core should already do that.

The skygw_chk_t variables are rather meaningless and are obsoleted by
Valgrind/ASAN.
2018-04-04 08:51:26 +03:00
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
ce500d782a MXS-1502: Improve max_sescmd_history warning message
The message now suggests what the user should do.
2018-04-03 16:28:09 +03:00
7d7cef7dcd Use router template in readwritesplit
Take the router template into use in readwritesplit.
2018-04-03 16:27:19 +03:00
6a481ca21e MXS-1625 Use QueryClassifier in RouteInfo
Eventually the RWS session will contain a QueryClassifier
object as a member variable.
2018-04-03 16:02:18 +03:00