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

sql: audit error creation during planning #135027

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Nov 12, 2024

This commit audits error creation during the execution planning phase (mostly for vectorized engine) to avoid retrieving the stack trace when creating errors on the hot path. We do so by only wrapping or creating fresh errors when "expensive log is enabled" (so that the detailed errors still show up in trace) and otherwise using the provided or a global error. In many places I also substituted miscellaneous calls to AssertionFailedf where I thought we'd be getting into an invalid state, to make it more clear.

Fixes: #134586.

Release note: None

This commit audits error creation during the execution planning state
(mostly for vectorized engine) to avoid retrieving the stack trace when
creating errors on the hot paths. We do so by only wrapping or creating
fresh errors when "expensive log is enabled" (so that the detailed
errors showed up in trace) and otherwise using the provided or a global
error. In many places I also substitued miscellaneous calls to
`AssertionFailedf` where I thought we'd be getting into an invalid
state, to make it more clear.

Release note: None
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich yuzefovich marked this pull request as ready for review November 13, 2024 02:16
@yuzefovich yuzefovich requested a review from a team as a code owner November 13, 2024 02:16
Copy link
Collaborator

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

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

:lgtm: Nice!

Reviewed 60 of 60 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @yuzefovich)

Copy link
Collaborator

@mgartner mgartner left a comment

Choose a reason for hiding this comment

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

:lgtm: Thanks for doing this!

Reviewed 60 of 60 files at r1, all commit messages.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @yuzefovich)

@yuzefovich
Copy link
Member Author

TFTRs!

bors r+

@craig craig bot merged commit 2c18247 into cockroachdb:master Nov 13, 2024
23 checks passed
@yuzefovich yuzefovich deleted the reduce-err-overhead branch November 13, 2024 18:24
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.

sql: reduce overhead of errors.Wrapf and errors.Errorf in the DistSQL planner (0.1% cpu)
4 participants