If the client sends another query before reading the previous result, it
was possible that another session finished the shard update and the
following query would reuse this result. This would cause the assertion in
the delayed call to fail as it assumes the shard would always be empty
when it was being called. To correctly handle this case, the delayed call
must be the one that moves the session into the normal routing state.
Putting the sessions that aren't doing the update on hold makes the new
mechanism work the same way the old one did with the exception that it
won't put any extra work on the database itself.
As there are no practical benefits to multiple sessions for the same user
mapping the databases at the same time, limiting them to one update per
user is sensible. This is especially true now that we know the
information_schema tables aren't the most efficient things in the world.
The current code implements this rate limiting by closing any extra
sessions that would start a second update. The final implementation should
suspend them for the duration of the update as it is far more
user-friendly.
The limits are currently global as the shard caches are also global. This
is a performance bottleneck and it could be solved by storing the shard
cache inside of a mxs::WorkerGlobal instead of having it as a global
cache.
If the schemarouter service used a filter, any queued queries would end up
being routed twice for them as well. This would break any filters that
would expect a result for each query and it could also cause a hang if the
filter did not forward it up to the router.
The correct thing to do is to call the routeQuery method of the router
directly.
As both `SET autocommit=1` and `SET autocommit=0` share the same canonical
query form but do not have the same types, they should not be stored in
the cache.
The code is now identical to the one in 2.5 and it still suffers from the
problem described in MXS-3885. This will be fixed in a separate commit.
This commit changes the persisted filename but since it was ignored, it
won't affect old installations.
Backported the fix for MXS-3617 to 2.4.
If a packet was read from the backend while the client DCB was being
throttled due to writeq_high_water being hit, the response would be
discarded as it did not qualify for routing. The check should not check
whether the client DCB is in epoll as it has no effect on writes.
Currently the state change explanations are only added to mariadbmon. They
are less relevant for Galera clusters as they themselves explain why they
change their states but should still be added to make them easier to
analyze.
The event that isn't explained and is most often encountered is the loss
of a Slave status. Most often the loss of a Slave status happens because
either the IO thread or the SQL thread has stopped. Printing the states of
the threads as well as the latest error should hint at what caused the
outage.
The information can be added to the REST API in 2.5 where the monitors can
add extra information to the server JSON.
Backporting to 2.4.
The listener search used the host and port for listeners that used sockets
and vice versa. This caused multiple listeners with sockets to fail to be
created.
When a transaction migration starts, the old master must be
unconditionally closed. This is the simplest way of resetting the
connection state and it also helps close unused connections.
The LOAD DATA LOCAL INFILE is handled in a way where it returns two
results that both are complete: the first one with the file being
requested and the second one with the final OK packet. Readwritesplit
called session_book_server_response for both statements which caused the
current query index to drop to -1 which in turn was unconditionally used
as the buffer offset.
The new check for the invalid index value will help prevent crashes in
production while still allowing it to be detected while testing.
The directory was created when the configuration was being processed and
it wasn't checked unless it was configured to a non-default value. With
the addition of the path validation, the directory must be created
earlier.
Responses generated by replayed session commands must not be treated as
actual responses to retained statements. In 2.5 this is not a problem as
it is done implicitly with the pre-assignment of the server that delivers
the session command response.
Doing the directory permission checks after all the values have been set
helps avoid problems with intermediate values that aren't valid. This
happens when --basedir generates invalid derived paths and the correct path
is provided as an argument right after it.
The path parameter is read from the configuration file only if it hasn't
been modified by a command line option. The case where an invalid command
line option is given but a valid configuration parameter would override it
is still treated as an error.
Also added a clarifying comment into set_dirs to make sure the handling
for the two path parameters is not moved inside set_runtime_dirs.
Fixed the testing scripts for the REST API and MaxCtrl now that the
directory permission checks are done correctly. Previously some paths seem
to have been ignored.
During switchover/failover, server events are altered. The ALTER
EVENT command automatically modifies the event charset and collation
to the values of the connetion running the query. This may cause
the event to become invalid.
Fixed this by changing connection charset and collation to the ones
in the event description just before altering it.
The current code assumes that the variable names are in lowercase. This
fixes the galera monitoring that was broken by commit
43068d20b43a34d5f3b4b4db0fcce701b3cd7cad. In addition, lowercase names
also helps when comparisons are done with std::string.