-
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
Move to native sqlite3 queries #17124
Move to native sqlite3 queries #17124
Conversation
We don't have to support anything but sqlite3 here, so let's use the proper sqlite syntax. This allows removing the find / replace logic and regexp matching which reduces vtorc CPU usage significantly. Signed-off-by: Dirkjan Bussink <[email protected]>
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
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17124 +/- ##
==========================================
- Coverage 67.43% 67.42% -0.01%
==========================================
Files 1571 1569 -2
Lines 252249 252132 -117
==========================================
- Hits 170098 169999 -99
+ Misses 82151 82133 -18 ☔ View full report in Codecov by Sentry. |
@dbussink yeah, in hindsight a wholesale change in SQL dialect should have been 1 PR 😆. Looking forward to some cleanup iterations on this code |
@dbussink pre-backporting this to our v19 branch to validate this (with the |
Signed-off-by: Dirkjan Bussink <[email protected]>
Co-authored-by: Tim Vaillancourt <[email protected]> Signed-off-by: Dirkjan Bussink <[email protected]>
@@ -82,25 +77,12 @@ func deployStatements(db *sql.DB, queries []string) error { | |||
tx, err := db.Begin() | |||
if err != nil { | |||
log.Fatal(err.Error()) | |||
return err |
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.
@dbussink looked at this more - this line will never be reached due to the log.Fatal(...)
before it
There is also another log.Fatal(...)
in this func; it might be cleaner for registerVTOrcDeployment
to only return err
s (no log.Fatal
s) and initVTOrcDB
can do a single log.Fatal(...)
if registerVTOrcDeployment
errors - then all the fatal-ing code is in the init function
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.
Ah yeah, this seems pretty inconsistent style wise at the moment, so I think that's more something for a separate PR to make consistent.
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.
Makes sense 👍
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 beautiful regexp-based SQL manipulation! 😭 😆
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.
Looks good to me!
Signed-off-by: Dirkjan Bussink <[email protected]> Co-authored-by: Tim Vaillancourt <[email protected]>
* Move to native sqlite3 queries (vitessio#17124) Signed-off-by: Dirkjan Bussink <[email protected]> Co-authored-by: Tim Vaillancourt <[email protected]> * missing updates Signed-off-by: Tim Vaillancourt <[email protected]> * fix % Signed-off-by: Tim Vaillancourt <[email protected]> * missing comma Signed-off-by: Tim Vaillancourt <[email protected]> * Improve efficiency of `vtorc` topo calls (vitessio#17071) Signed-off-by: Tim Vaillancourt <[email protected]> Co-authored-by: Matt Lord <[email protected]> --------- Signed-off-by: Dirkjan Bussink <[email protected]> Signed-off-by: Tim Vaillancourt <[email protected]> Co-authored-by: Dirkjan Bussink <[email protected]> Co-authored-by: Matt Lord <[email protected]>
We don't have to support anything but sqlite3 here, so let's use the proper sqlite syntax. This allows removing the find / replace logic and regexp matching which reduces vtorc CPU usage significantly.
@timvaillancourt I was also tempted I guess to remove a bunch of code, but we can go for your PR in #17120. Opened this still to see what CI does on these changes.
Related Issue(s)
Fixes #17114
Checklist