6082 Commits

Author SHA1 Message Date
Johan Wikman
d632c195ff 2.4.19 Update change date 2022-01-04 15:47:38 +02:00
Markus Mäkelä
3a05c22269
MXS-3892: Handle multiple pending queries
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.
2021-12-31 15:33:15 +02:00
Markus Mäkelä
56ea0db3e6
MXS-3892: Delay routing instead of canceling it
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.
2021-12-31 15:25:18 +02:00
Markus Mäkelä
41c2a6ee8e
MXS-3892: Limit concurrent mapping of databases
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.
2021-12-31 15:25:18 +02:00
Markus Mäkelä
d57de28199
Fix schemarouter query queue
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.
2021-12-31 15:25:18 +02:00
Markus Mäkelä
1b432c1bf3
MXS-3617: Fix lost packets during writeq throttling
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.
2021-11-10 07:27:37 +02:00
Johan Wikman
2a54224927 2.4.18 Update change date 2021-10-29 08:29:51 +03:00
Markus Mäkelä
0bf5641d80
MXS-3800: Explain lost_slave events
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.
2021-10-20 10:03:03 +03:00
Markus Mäkelä
b4edc74926
MXS-3609: Use 64-bit integers for statistics
This should be enough to avoid the problem of integer overflow in 2.4.
2021-08-31 08:15:02 +03:00
Niclas Antti
aa6a1a58eb MXS-3359 Change qla-filter append option to default to true
Append to log files after a restart rather than overwrite.
2021-08-20 13:03:13 +03:00
Markus Mäkelä
2d9ebbdbc4
Merge branch '2.3' into 2.4 2021-06-07 08:34:26 +03:00
Markus Mäkelä
946f2e57fa
MXS-3582: Backport fix to 2.3 and 2.4
2.3 and 2.4 seem to also be affected by it.
2021-06-04 14:06:25 +03:00
Markus Mäkelä
94b65f8242
MXS-3533: Advertise SESSION_TRACK capability
MaxScale already enables it explicitly in the flags in certain cases but
it didn't support it if the client asked for it.
2021-05-05 11:42:53 +03:00
Markus Mäkelä
38cdade698
MXS-3487: Close old master connection
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.
2021-04-09 08:49:40 +03:00
Johan Wikman
a8bfbbe254 2.4.17 Update change date 2021-03-08 09:03:02 +02:00
Markus Mäkelä
e3c9f1544a
Backport fix for MXS-3392 to 2.4
This solves problems with connectors that unconditionally send a
COM_STMT_PREPARE.
2021-03-04 11:14:44 +02:00
Markus Mäkelä
19066ae383
MXS-3425: Fix handling of LOAD DATA LOCAL INFILE
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.
2021-03-03 11:02:15 +02:00
Johan Wikman
0224f24077 2.4.16 Update Change Date 2021-02-16 14:59:00 +02:00
Markus Mäkelä
2657cc100e
MXS-3330: Book only expected responses
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.
2021-02-10 09:42:12 +02:00
Johan Wikman
c5bcf7a8b1 2.4.15 Update change date 2021-01-18 15:30:30 +02:00
Markus Mäkelä
26d2c2387f
Fix monitor connection error messages
The connection is closed by the ping_or_connect_to_db function which
causes the information about why the connection failed to be lost.
2021-01-18 12:02:40 +02:00
Esa Korhonen
0c904eae5e MXS-3158 Preserve character set and collation when altering events
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.
2020-12-14 14:06:43 +02:00
Markus Mäkelä
ce85a7292f
Merge branch '2.3' into 2.4 2020-12-14 12:08:52 +02:00
Markus Mäkelä
d869dd358e
MXS-3337: Select lowercase variable names
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.
2020-12-11 18:37:05 +02:00
Markus Mäkelä
27a43fdf9d
Merge branch '2.3' into 2.4 2020-12-11 16:38:43 +02:00
Markus Mäkelä
43068d20b4
MXS-3337: Fix galeramon query
The query now properly queries over both the status and the variables.
2020-12-10 11:56:07 +02:00
Johan Wikman
5906f59344 Merge branch '2.4' into 2.4.14 2020-11-19 13:54:55 +02:00
Johan Wikman
56575882d7 MXS-3301 Rename clustrix -> xpand everywhere 2020-11-19 13:44:06 +02:00
Johan Wikman
5fc73646a4 MXS-3301 Rename clustrix -> xpand everywhere 2020-11-18 10:02:02 +02:00
Johan Wikman
64ca695c84 Revert "MXS-3301 Look for "xpand" to find out whether server is Xpand"
This reverts commit 4728730510409fc15d2b3a55fa6e00008651794d.

The clustrix -> xpand name change causes too much trouble when merging
to 2.5.
2020-11-17 17:21:14 +02:00
Johan Wikman
4728730510 MXS-3301 Look for "xpand" to find out whether server is Xpand
We will continue to look for "clustrix" as well so that MaxScale
will continue to work with older releases. Clustrix was replaced with
xpand in all symbols.
2020-11-17 13:25:13 +02:00
Markus Mäkelä
10582a02fe
Merge branch '2.3' into 2.4 2020-11-17 10:54:58 +02:00
Markus Mäkelä
f577d09829
MXS-3297: Don't advertise unsupported capabilities
Only bulk execute is supported. Supporting progress reporting currently
breaks the protocol result processing code.
2020-11-17 10:45:03 +02:00
Johan Wikman
df36ef86d0 2.4.14 Update Change Date 2020-11-16 14:23:26 +02:00
Markus Mäkelä
968d43799f
MXS-3273: Ignore unexpected responses
Unlike readwritesplit, schemarouter will process all responses from
backends as if they are expected. There are cases where errors are
generated that aren't sent as a response to a query. These queries must be
ignored and not routed to the client. Copying the code as-is from
readwritesplit isn't the cleanest solution but it avoids refactoring code
in a patch release.

The custom error number (2003) used by the backend protocol code was not
an actual error number that the server would send. The error code in
question was for an error that only the C connector returns:
CR_CONN_HOST_ERROR. Using ER_CONNECTION_KILLED as the error number better
conveys the fact that the connection was killed due to a reason not
related to any ongoing query.

By using a known error number that is correctly handled, we also avoid
writing errors to the client in the middle of a resultset or as the
initial response to a result. This explains why the problem described in
MXS-3267 happened in the first place: an unrelated connection was lost in
the middle of a resultset and the error was interpreted as the end of a
resultset. As a result of there being more data to be read, the unexpected
result state messages were logged.
2020-11-04 16:44:46 +02:00
Markus Mäkelä
87f97a16c3
Log server name in error message
This makes it clear which server failed.
2020-10-29 15:33:48 +02:00
Markus Mäkelä
dad5e09e5e
Merge branch '2.3' into 2.4 2020-10-19 15:08:22 +03:00
Johan Wikman
9bc7887728 MXS-3239 Rename [c|C]clustrix names to [x|X]pand names 2020-10-19 13:56:36 +03:00
Johan Wikman
192ad2289f MXS-3239 Rename clustrix* to xpand*
Typenames still Clustrix.
2020-10-19 13:40:54 +03:00
Markus Mäkelä
48ef9754df
MXS-3241: Check buffer length
The `is_set` call assumes that at least three characters are present.
2020-10-16 12:22:06 +03:00
Johan Wikman
faaf7f483e 2.4.13 Update Change Date 2020-10-14 09:15:46 +03:00
Markus Mäkelä
933ce0c86a
MXS-3220: Fix crash on failed master history replay
This could happen if a session command triggers a master reconnection and
the connection fails while the history replay is ongoing. The code assumed
that history replay would only happen when a query was in the query queue.
2020-10-13 14:31:49 +03:00
Johan Wikman
ab4ac8e588 MXS-3200 Log mapping error as it will lead to session close 2020-10-12 08:31:36 +03:00
Johan Wikman
147ed8ef22 MXS-3200 Ensure that passed in p to buffer remains valid
The pointer to pointer to GWBUF must in all cases be updated.
Otherwise it will lead to
1) access to free data, and
2) a double delete.
2020-10-12 08:31:36 +03:00
Esa Korhonen
9304230212 MXS-3149 Properly remove master-status from server during demotion
Removing it from the pending status field has not effect as the
pending changes have all ready been written to real status.
2020-09-02 15:13:23 +03:00
Johan Wikman
babcda3eca 2.4.12 Update Change Date 2020-08-24 09:42:48 +03:00
Markus Mäkelä
c5b47389df
MXS-3106: Always write the final COM_QUIT
This seems to help with a regression that was introduced in 2.4.11.
2020-08-21 14:38:37 +03:00
Markus Mäkelä
b90d42b999
Merge branch '2.3' into 2.4 2020-08-21 10:27:43 +03:00
Markus Mäkelä
e105f06ea3
Log latest session command on unexpected result 2020-08-21 09:50:29 +03:00
Esa Korhonen
759c63c8bb Merge branch '2.3' into 2.4 2020-08-20 17:44:09 +03:00