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: fix statement diagnostics for EXECUTE #66074

Merged
merged 1 commit into from
Jun 4, 2021

Conversation

RaduBerinde
Copy link
Member

Previously, prepared statements ran through the EXECUTE statements
could not trigger collection of statement diagnostics. This is because
we consider the fingerprint of the EXECUTE statement instead of the
one from the prepared statement.

The fix is to move up the special handling code in the executor, and
replace the AST and fingerprint before setting up the instrumentation
helper.

Release note (bug fix): queries ran through the EXECUTE statement can
now generate statement diagnostic bundles as expected.

Fixes #66048.

Previously, prepared statements ran through the EXECUTE statements
could not trigger collection of statement diagnostics. This is because
we consider the fingerprint of the EXECUTE statement instead of the
one from the prepared statement.

The fix is to move up the special handling code in the executor, and
replace the AST and fingerprint before setting up the instrumentation
helper.

Release note (bug fix): queries ran through the EXECUTE statement can
now generate statement diagnostic bundles as expected.

Fixes cockroachdb#66048.
@RaduBerinde RaduBerinde requested a review from yuzefovich June 4, 2021 04:40
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@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.

:lgtm:

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde)


pkg/sql/conn_executor_exec.go, line 400 at r1 (raw file):

	// Special top-level handling for EXECUTE. This must happen after the handling
	// for EXPLAIN ANALYZE (in order to support EXPLAIN ANALYZE EXECUTE) but

nit: do we have a test for this? Should we add it if not?

Copy link
Member Author

@RaduBerinde RaduBerinde 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! 1 of 0 LGTMs obtained (waiting on @yuzefovich)


pkg/sql/conn_executor_exec.go, line 400 at r1 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: do we have a test for this? Should we add it if not?

Yes, I did it wrong the first time and I hit it (it's an execbuilder test).

@craig
Copy link
Contributor

craig bot commented Jun 4, 2021

Build succeeded:

@craig craig bot merged commit 02830c2 into cockroachdb:master Jun 4, 2021
@RaduBerinde RaduBerinde deleted the execute-stmt-diag-fix branch June 4, 2021 19:11
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: statement diagnostics never finish for (SQL-level) prepared statements
3 participants