-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Interpolate MySQL query parameters by default #5428
Conversation
5729b12
to
0d86141
Compare
So this is more complex than we initially though. When @mattrobenolt do you have measurements that show the benefit of enabling In the meantime I'm going to put a separate PR up to prevent folks from enabling |
There are a number of reasons why this doesn't work right now so we're going to prevent it from happening while we discuss whether we should invest in fixing it. The current work to fix this is in #5428
|
0d86141
to
03a489a
Compare
72fa4c6
to
8d4428c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address @stephanos comments before merging.
There are a number of reasons why this doesn't work right now so we're going to prevent it from happening while we discuss whether we should invest in fixing it. The current work to fix this is in #5428
b9fa8cc
to
302d324
Compare
There are a number of reasons why this doesn't work right now so we're going to prevent it from happening while we discuss whether we should invest in fixing it. The current work to fix this is in #5428
302d324
to
768fd95
Compare
8d4428c
to
930c591
Compare
## What changed? Attempting to configure a MySQL 8 Visibility database with go-sql-driver/mysql's `interpolateParams` option will now fail. ## Why? There are a number of reasons why this doesn't work right now so we're going to prevent it from happening while we discuss how much we should invest in fixing it. The current work to fix this is in #5428 ## How did you test it? Added a new test ## Potential risks There should be none. Any user who has currently set up their database this way will already have encountered exciting errors like `Cannot create a JSON value from a string with CHARACTER SET 'binary'` and `Unable to parse ExecutionStatus value from DB`. ## Is hotfix candidate? That's up for discussion
You can't interpolate a []byte into a JSON field: go-sql-driver/mysql#819
It's useful to know which query failed when multiple are executed in a single operation
This cuts our queries down to 1 round-trip to the database per operation. When interpolateParams is false (the default) the mysql driver will call prepare before executing a query. Our MySQL 8 visibility code doesn't currently support this option however, so this is only configured for: - MySQL 5.7 Main dbs - MySQL 5.7 Visibility dbs - MySQL 8.0 Main dbs
930c591
to
3ea2045
Compare
…o#5441) ## What changed? Attempting to configure a MySQL 8 Visibility database with go-sql-driver/mysql's `interpolateParams` option will now fail. ## Why? There are a number of reasons why this doesn't work right now so we're going to prevent it from happening while we discuss how much we should invest in fixing it. The current work to fix this is in temporalio#5428 ## How did you test it? Added a new test ## Potential risks There should be none. Any user who has currently set up their database this way will already have encountered exciting errors like `Cannot create a JSON value from a string with CHARACTER SET 'binary'` and `Unable to parse ExecutionStatus value from DB`. ## Is hotfix candidate? That's up for discussion
What changed?
We now specify
interpolateParams
by default when using MySQL for our main.While we don't currently support specifying
interpolateParams
for MySQL visibility databases, I changed the type returned when serializingVisibilitySearchAttributes
as a first step towards doing so (MySQL 8 won't allow binary data within JSON columns, which makes sense).While we could also have explicitly prepared and reused our statements that requires far more work and it may not be the better approach anyways.
Why?
@mattrobenolt did a good job of explaining why in #5425 but I'll summarize it here anyways.
When
interpolateParams
is false (the default) the driver will prepare parameterized statements before executing them, meaning we need two round-trips to the database for each query. By settinginterpolateParams
to true the DB driver will handle interpolation and send the query just once to the database, halving the number of round trips necessary. This should improve the performance of all clusters using MySQL.How did you test it?
Existing tests.
Potential risks
No
Is hotfix candidate?
This is up for discussion