-
Notifications
You must be signed in to change notification settings - Fork 977
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
Consistent reads from db replicas using unit-of-work identifiers #2698
Consistent reads from db replicas using unit-of-work identifiers #2698
Conversation
Automated message: PR pending admin approval for build testing |
@renecannao is this something you might take a look? We've been working on this internally on this internally at Shopify and would appreciate your feedback on this patch. Thanks! |
add to whitelist |
ok to test |
Because the cleanup of Can you please make a new PR only related to the new feature? Something incorrect I noticed in this pull request is that it doesn't perform any change in |
This reverts commit b24f259.
This reverts commit d182637.
This provides a way of ensuring that a series of database requests will be forwarded to one server as long as a user-defined unit-of-work identifier (or a series of such identifiers) remains the same across the series of requests. This is done by using the identifier(s), received via query comment fields, to generate a numeric hash which is ultimately used to index into the list of configured servers within a hostgroup. Also, the delimiters between comment fields and within key-value pairs have been made configurable, with the standard ";" and "=" delimiters established as defaults.
@renecannao It looks as though to change |
Hi @saunderst , thank you for rebasing!
To instantiate the
Connections caching is enabled by default, and there is no way to disable it. In other words, the per-thread connections cache becomes useful only at very high concurrency and very fast requests: in this scenario it is likely that a backend connection freed is immediately used by another session, within the same iteration of the MySQL_Thread main loop. You can have a look at these 2 variables:
|
Hi @renecannao. When do you think you might have a chance to look at this? I'm especially interested to know whether the simple approach to skipping connection caching still seems to make sense, since I have not implemented it in our fork yet. |
This provides a way of ensuring that a series of database requests will be forwarded to one server as long as a user-defined unit-of-work identifier (or a series of such identifiers) remains the same across the series of requests. This is done by using the identifier(s), received via query comment fields, to generate a numeric hash which is ultimately used to index into the list of configured servers within a hostgroup.
The identifier names are defined by setting the
unit_of_work_identifiers
global variable to a comma-delimited string containing one or more identifier names, e.g."request_id,job_id"
. Any of these names can then be used to declare unique identifiers to consistently route requests to a single server without any need for the application to be aware of the available servers.Also, the delimiters between comment fields and within key-value pairs have been made configurable for all query comment fields using the global variables
query_parser_token_delimiters
andquery_parser_key_value_delimiters
. If not specified, these variables default to the standard;
and=
delimiters.@renecannao