Enforce CLIENT_DEPRECATE_EOF
capability match for conn-pool
#4806
+1,468
−29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR enforces the matching of capabilities between backend and frontend connections. This matching extends to other capabilities which matching should also be enforced (and already is), when performing a connection selection from the connection pool. This is now enforced/check after a created connection has been returned to the session.
A new config variable has been introduced for this
mysql-connpool_match_client_deprecate_eof
, with default valuetrue
. This enforced matching on capabilities is always required forfast_forward
connections, and it's also enforced when a session switches from a regular session tofast_forward
.Using the default settings, since the matching is enabled by default, the transition from a regular session to
fast_forward
is guaranteed to be smooth, otherwise the backend connection would fail to be created in the first instance. If the config allows a mismatch, the session would be terminated when transitioning tofast_forward
if the backend connection doesn't match the required capabilities.Other changes
This PR also enables
deprecate_eof
support forSQLite3
sessions. This allows to perform the testing of all the possible combinations of the new matching using a singleProxySQL
instance. See the new testtest_match_eof_conn_cap.cpp
.TODO
The same change should be performed for the
Admin
interface, but the work has been postponed. When implemented it would be a nice opportunity to perform a rework of how intercepted statements to improve maintainability. Also, this change should be paired with a test similar to the new testtest_sqlite3_special_queries.cpp
included in this PR.