-
Notifications
You must be signed in to change notification settings - Fork 972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V2.x session track system variables v2 #4164
Open
javsanpar
wants to merge
22
commits into
v2.x
Choose a base branch
from
v2.x-session_track_system_variables_v2
base: v2.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+270
−4
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add hash map with system variables names and idx. Call handler_rc0_Process_Session_Track() everytime async_send_simple_command() finish. Use strncasecmp to avoid out-of-bounds reads.
Also, move the comparison logic to its own function.
…variables Add tracking for 2 new variables: session_track_state_change and session_track_system_variables. If a client tries to set these variables explicitly, the request from the client will be ignored. Also, add a new ProxySQL MySQL variable (mysql-enable_session_state_trackers) that, if enabled, the 2 MySQL variables will be automatically set into each MySQL client connection. ProxySQL will try to set these variables on backend connections and will track if the SET on backend failed or succeeded.
Move it from MySQL_Session::handler() to MySQL_Thread::create_new_session_and_client_data_stream(). This way, we ensure the code is always executed when a client connects to ProxySQL.
MySQL_Thread::create_new_session_and_client_data_stream() to MySQL_Session::get_pkts_from_client(). Otherwise, session track variables state is lost when changing user.
Create a helper function to set the variables an use it after the creation of the client connection and after the reset of the client connection.
When unable to parse a set statement, and if variables SQL_SESSION_TRACK_STATE_CHANGE and SQL_SESSION_TRACK_SYSTEM_VARIABLES are correctly set, ProxySQL will send the whole SET statement to the backend. If the backend will return a list of variables with only variables that ProxySQL parses, lock on hostgroup will not be enabled. Otherwise lock on hostgroup will be enabled
retest this please |
When a SET statement parse failure occurs, lock on hostgroup is enabled and try_to_unlock_with_session_tracking variable is set to true. Due to this, during processing of the backend response, if the session tracking data only contains changes in variables that ProxySQL tracks, we remove the lock on the hostgroup. Also add some minor improvements and fixes to session tracking.
Session tracking is disabled if a system variable that is not tracked by ProxySQL is changed. Also, if the hostgroup is not already locked, it is locked. If all system variable changes are tracked by ProxySQL, then we remove the lock on hostgroup.
retest this please |
This was referenced Apr 21, 2023
retest this please |
2 similar comments
retest this please |
retest this please |
Can one of the admins verify this patch? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related to #4141