The current command needs to be updated before the queries are actually
routed. This allows the KILL command detection and processing to correctly
work.
The GCC 4.4.7 implementation of std::to_string only has overloads for long
long int, long long unsigned int and long double. It's better to use
std::stringstream with this version of GCC to avoid having to write custom
code.
When the connection pool is inspected, both the client username and IP
must match. This causes the pool to be partitioned by username and IP,
prevening unintentional sharing of connections between different users.
MASTER_GTID_WAIT uses gtid_slave_pos when comparing to the target gtid. This creates
problems with multi-domain gtids. It's simpler to just query the server for its
gtids repeatedly. Also, the method is now in MariaDBServer.
Renamed the two gtid-classes to better match MariaDB documentation. One
domain-server-sequence-combination is now a "Gtid", as these identify
a transaction. A "GtidList" contains a list of Gtid:s for handling multi-domain
server variables composed of multiple comma separated Gtid:s.
Removed unused methods and renamed some existing ones. Moved the Gtid-code
to its own file.
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.
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.
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.
The operations between Gtid:s are now more complicated so the class implements
them instead of the monitor. The Old Gtid-container has been renamed
GtidTriplet, and only stores the values for one triplet.
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.
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.
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.
This is the first step in providing a QueryClassifier class
that is capable of performing context dependent query classification,
where the context is essentially the session state.
The warning that tells the user that the session command history has been
exceeded is now only logged once. This is to prevent the message from
being repeatedly logged when the default value is not large enough.
Also fixed the session_limits test to use distinct session commands. This
way the session command history compaction is not in effect and the test
again tests the correct thing.
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.
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.
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.
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.