-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: audit all usages of Query to use iterator pattern #59339
Conversation
c97aef6
to
d1a5870
Compare
b84a9a8
to
c6c79f5
Compare
ae5091e
to
472e94d
Compare
b28b143
to
6251b7b
Compare
2baee69
to
dafd8f0
Compare
@irfansharif @otan @rafiss github suggested you as reviewers. Could one of you take a look at this please? |
CCing @RichardJCai too as it may touch his idea in #60507 |
(Looking at the code areas, I'm definitely not familiar with any of it - so I'll defer elsewhere. Sorry!) |
Similarly to the previous commit, here we audit all usages of `Query` method of the internal executor to take advantage of the iterator API wherever possible (or switching to `Exec` or `QueryRow`). `QueryBuffered` has been added to the interface too. The only place where it would be beneficial to use the iterator pattern but it is not done currently is for `SHOW STATISTICS` statement - in there, we have a panic-catcher which works only on the assumption of not updating any of the shared state (which the iterator API contradicts). Refactoring that part is left as a TODO. Release justification: low-risk update to existing functionality. Release note: None
dafd8f0
to
10ede95
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.
Reviewed 22 of 22 files at r1.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @otan, @rafiss, @RichardJCai, and @yuzefovich)
pkg/ccl/backupccl/backup_planning.go, line 961 at r1 (raw file):
// Include all tenants. // TODO(tbg): make conditional on cluster setting. tenantRows, err = p.ExecCfg().InternalExecutor.QueryBuffered(
This could be problematic with many tenants, right?
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.
TFTR!
bors r+
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @adityamaru, @dt, @otan, @rafiss, and @RichardJCai)
pkg/ccl/backupccl/backup_planning.go, line 961 at r1 (raw file):
Previously, asubiotto (Alfonso Subiotto Marqués) wrote…
This could be problematic with many tenants, right?
Yeah, possibly, but it didn't seem trivial to refactor, so I'll leave it to Bulk IO friends. cc @dt @adityamaru
Build failed (retrying...): |
Build failed: |
bors r+ |
Build succeeded: |
Similarly to the previous commit (dbc8676), here we audit all usages of
Query
method of the internal executor to take advantage of the iterator API
wherever possible (or switching to
Exec
orQueryRow
).QueryBuffered
has been added to the interface too.The only place where it would be beneficial to use the iterator pattern
but it is not done currently is for
SHOW STATISTICS
statement - inthere, we have a panic-catcher which works only on the assumption of not
updating any of the shared state (which the iterator API contradicts).
Refactoring that part is left as a TODO.
Fixes: #48595.
Release justification: low-risk update to existing functionality.
Release note: None