-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Set parsed comments in operator for subqueries #18369
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
Set parsed comments in operator for subqueries #18369
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
|
I'm not so sure this change is right. Vitess forwards the timeout information already, based on the remaining time, and the query gets terminated. See #16735. |
@GrahamCampbell I think you're mixing this up with The problem this pull request tries to partially address is that we started using There are a few issues with the way this is implemented. This currently copies all query comments, no matter whether they're applicable to the rewritten / split query or not, and as you mentioned, it does not keep track of the query timeout so queries that "execute later" will still have the same max execution time as the first query executed, which can lead to the query execution time not being honoured correctly. I think a change we definitely should do is to only copy down the And then eventually, Vitess should correctly handle |
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.
my thinking here is that we should push down all the comments, not just the MAX_EXECUTION_TIME one
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.
let's add a test for a plan that is not merged into a single route. we want the comment to be there for the subquery if it's sent separately. this test is not showing how we handle comments on the subquery
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.
@systay Thanks for the review! I added another test for a plan with a "complex" expression.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #18369 +/- ##
==========================================
+ Coverage 67.48% 67.52% +0.03%
==========================================
Files 1603 1607 +4
Lines 262391 262687 +296
==========================================
+ Hits 177067 177367 +300
+ Misses 85324 85320 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
For the query test, you need to not compare select /* comment */ user.col from user where foo IN (select id from user where id > 1 and id < 10)notice that I'm doing |
|
I forgot to start everything with - Hi @davidpiegza! Thank you for your contribution! |
|
@systay Could I get another review? Not sure about the failing test, it also fails on |
Signed-off-by: David Piegza <[email protected]>
Signed-off-by: David Piegza <[email protected]>
Signed-off-by: David Piegza <[email protected]>
This reverts commit 1d146f17fd60159073e681fd48ba04908284a451. Signed-off-by: David Piegza <[email protected]>
Signed-off-by: David Piegza <[email protected]>
Signed-off-by: David Piegza <[email protected]>
Signed-off-by: David Piegza <[email protected]>
7e3bb41 to
729549c
Compare
I agree to this. Vitess should just handle |
…tests * origin/master: (32 commits) test: Fix race condition in TestStreamRowsHeartbeat (vitessio#18414) VReplication: Improve permission check logic on external tablets on SwitchTraffic (vitessio#18348) Perform post copy actions in atomic copy (vitessio#18411) Update `operator.yaml` (vitessio#18364) Feature(onlineddl): Add shard-specific completion to online ddl (vitessio#18331) Set parsed comments in operator for subqueries (vitessio#18369) `vtorc`: move shard primary timestamp to time type (vitessio#18401) `vtorc`: rename `isClusterWideRecovery` -> `isShardWideRecovery` (vitessio#18351) `vtorc`: remove dupe keyspace/shard in replication analysis (vitessio#18395) Topo: Add NamedLock test for zk2 and consul and get them passing (vitessio#18407) Handle MySQL 9.x as New Flavor in getFlavor() (vitessio#18399) Add support for sending grpc server backend metrics via ORCA (vitessio#18282) asthelpergen: add design documentation (vitessio#18403) `vtorc`: add keyspace/shard labels to recoveries stats (vitessio#18304) `vtorc`: cleanup `database_instance` location fields (vitessio#18339) avoid derived tables for UNION when possible (vitessio#18393) [Bugfix] Broken Heartbeat system in Row Streamer (vitessio#18390) Update MAINTAINERS.md (vitessio#18394) move vmg to emeritus (vitessio#18388) Make sure to check if the server is closed in etcd2topo (vitessio#18352) ...
Signed-off-by: David Piegza <[email protected]>
…thub Set parsed comments in operator for subqueries (vitessio#18369)
Signed-off-by: David Piegza <[email protected]>
Signed-off-by: David Piegza <[email protected]>
Signed-off-by: David Piegza <[email protected]>
* Set parsed comments in operator for subqueries (vitessio#18369) Signed-off-by: David Piegza <[email protected]> * rerun ci Signed-off-by: Mohamed Hamza <[email protected]> * remove skip_e2e Signed-off-by: Mohamed Hamza <[email protected]> * fix test cases --------- Signed-off-by: David Piegza <[email protected]> Signed-off-by: Mohamed Hamza <[email protected]> Co-authored-by: David Piegza <[email protected]>
Description
When using
MAX_EXECUTION_TIMEin aselectquery which includes a subquery, the optimizer hint gets lost when Vitess splits the query.Example query:
vexplain output:
Queryis missing the optimizer hint.This PR sets the parsed comments in
tryMergeSubqueryWithOuterin the operator so that the optimizer hint is not lost.Please note: This is an initial attempt to address the issue described for the example query mentioned above. There may be additional cases where parsed comments are not properly set.
See also the added test case that demonstrates this issue.
Open questions
MAX_EXECUTION_TIMEcomment?Related Issue(s)
MAX_EXECUTION_TIMEfor query timeout #12518Checklist
Deployment Notes