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: keep track of statement error code and error message in crdb_internal.execution_insights #95856

Closed
wants to merge 1 commit into from

Conversation

gtr
Copy link
Contributor

@gtr gtr commented Jan 25, 2023

Part of: #87785, #94381.

Previously, the insights subsystem did not keep track of error code and error messages for failed executions and only contained a FailedExecution value for the problem field. This commit adds the error_code and error_msg columns to the crdb_internal.cluster_execution_insights virtual table. The next PR will focus on displaying these values in the UI.

Example:
image

Release note (sql change): Added error_code and error_msg columns to the crdb_internal.cluster_execution_insights virtual table which contain the error code and error message for a failed statement execution, respectively.

@blathers-crl
Copy link

blathers-crl bot commented Jan 25, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@gtr gtr marked this pull request as ready for review January 30, 2023 20:12
@gtr gtr requested review from a team and removed request for a team January 30, 2023 20:12
Copy link
Member

@xinhaoz xinhaoz left a comment

Choose a reason for hiding this comment

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

Looking good! Can we add some tests? Also just a small question on naming - do we need the prefix Last here? I feel like it's appropriate here in just shortening them to error and errorCode.

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


pkg/sql/sqlstats/insights/registry.go line 129 at r1 (raw file):

			}
			insight.Transaction.Problems = addProblem(insight.Transaction.Problems, s.Problem)
			// TODO(gerardo): bubble up stmt failed execution error codes

Is this TODO going to be addressed in this PR? If not maybe we can file a ticket for it and remove this TODO, as there's no additions here you need to come back and change.

Copy link
Contributor Author

@gtr gtr left a comment

Choose a reason for hiding this comment

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

Thanks! Working on adding tests now. Also, good suggestion on simplifying the names.

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


pkg/sql/sqlstats/insights/registry.go line 129 at r1 (raw file):

Previously, xinhaoz (Xin Hao Zhang) wrote…

Is this TODO going to be addressed in this PR? If not maybe we can file a ticket for it and remove this TODO, as there's no additions here you need to come back and change.

I don't think it'll be addressed in this PR, so I'll go ahead and remove it and file a ticket.

crdb_internal.execution_insights

Part of: cockroachdb#87785, cockroachdb#94381.

Previously, the insights subsystem did not keep track of error code and
error messages for failed executions and only contained a
`FailedExecution` value for the `problem` field. This commit adds
the `last_error_code` and `last_error_msg` columns to the
`crdb_internal.cluster_execution_insights` virtual table. The next PR
will focus on displaying these values in the UI.

Release note (sql change): Added `last_error_code` and `last_error_msg`
columns to the `crdb_internal.cluster_execution_insights` virtual table
which contain the error code and error message for a failed statement
execution, respectively.
@maryliag
Copy link
Contributor

As discussed offline, focus one PR on adding the information to statement and transaction statistics, then another PR on adding the information to insights, then another focusing on capturing all failed executions. This way is more clear, easy for you to develop and easier to review.

@gtr
Copy link
Contributor Author

gtr commented Feb 2, 2023

As discussed offline, focus one PR on adding the information to statement and transaction statistics, then another PR on adding the information to insights, then another focusing on capturing all failed executions. This way is more clear, easy for you to develop and easier to review.

Added the information to the statement statistics table on this PR. Closing this one and saving these changes for later. Thanks!

@gtr gtr closed this Feb 2, 2023
@gtr gtr deleted the failed-insights branch February 12, 2023 21:42
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.

4 participants