-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Rewrite Stream queries that query by schema_name #11090
Rewrite Stream queries that query by schema_name #11090
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
9d7d884
to
7c2d95b
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.
That looks good to me. I'll let someone else with more knowledge about the query engine (cc @harshit-gangal) review and merge this though.
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.
changes looks good.
Lets add and e2e test here go/test/endtoend/vtgate/gen4/system_schema_test.go
in TestDbNameOverride
you can set the workload first using the set command and then call the same information_query again.
use the helper method utils.Exec
Tabletserver Execute() replaces bindVars[BvSchemaName] with the tablet database name. In practice this means that queries like: SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'data'; are rewritten to queries like: SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'vt_data'; Tabletserver Stream() and StreamExecute() do not replicate this behavior, breaking queries like the one above when workload is OLAP. This PR applies the schema-name-replace logic to Stream() and StreamExecute(). Signed-off-by: Max Englander <max@planetscale.com>
8f422e7
to
05dd1bc
Compare
Signed-off-by: Max Englander <max@planetscale.com>
05dd1bc
to
ee74889
Compare
Thanks @harshit-gangal I've added that test |
Description
Tabletserver
Execute()
replacesbindVars[BvSchemaName]
with the tabletdatabase name. In practice this means that queries like:
are rewritten to queries like:
Tabletserver
Stream()
does not replicate thisbehavior, breaking queries like the one above when workload is OLAP.
This PR applies the schema-name-replace logic to
Stream()
calls.Related Issue(s)
Fixes #11081.
Checklist
Deployment Notes