Skip to content
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

sqlutil: remove QueryWithCols in favor of QueryRowExWithCols #60572

Merged
merged 1 commit into from
Feb 16, 2021

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Feb 14, 2021

This commit refactors all usages of
sqlutil.InternalExecutor.QueryWithCols method in favor of newly added
QueryRowExWithCols since in almost all places where the former was
used, we expected exactly one row. The only noticeable change is the
refactor of jobScheduler.executeSchedules where we now use the
iterator pattern. The difference there is that now it is possible to
execute some schedules before encountering an error on the iterator
(previously, we would buffer up all rows first), but this change is
acceptable because each schedule is executed under savepoint to guard
against errors in schedule planning/execution.

Addresses: #48595.

Release note: None

@yuzefovich yuzefovich requested review from miretskiy and a team February 14, 2021 19:55
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@miretskiy miretskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @yuzefovich)


pkg/jobs/job_scheduler.go, line 307 at r1 (raw file):

	// The loop below might encounter an error after some schedules have been
	// executed (i.e. previous iterations succeeded), and this is ok.
	// TODO(yuzefovich): confirm with Yevgeniy.

Yup. Should be fine. Each schedule executed under savepoint to guard against errors in schedule
planning/execution.

This commit refactors all usages of
`sqlutil.InternalExecutor.QueryWithCols` method in favor of newly added
`QueryRowExWithCols` since in almost all places where the former was
used, we expected exactly one row. The only noticeable change is the
refactor of `jobScheduler.executeSchedules` where we now use the
iterator pattern. The difference there is that now it is possible to
execute some schedules before encountering an error on the iterator
(previously, we would buffer up all rows first), but this change is
acceptable because each schedule is executed under savepoint to guard
against errors in schedule planning/execution.

Release note: None
Copy link
Member Author

@yuzefovich yuzefovich left a 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: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @miretskiy)


pkg/jobs/job_scheduler.go, line 307 at r1 (raw file):

Previously, miretskiy (Yevgeniy Miretskiy) wrote…

Yup. Should be fine. Each schedule executed under savepoint to guard against errors in schedule
planning/execution.

👍

@yuzefovich
Copy link
Member Author

bors r-

Forgot to update PR description.

@craig
Copy link
Contributor

craig bot commented Feb 16, 2021

Canceled.

@yuzefovich
Copy link
Member Author

bors r+

@craig
Copy link
Contributor

craig bot commented Feb 16, 2021

Build succeeded:

@craig craig bot merged commit fe919cc into cockroachdb:master Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants