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/sqlstats: record QuerySummary when merging stats #84170

Merged
merged 1 commit into from
Jul 11, 2022

Conversation

stevendanna
Copy link
Collaborator

During execution of a transaction, all statement statistics are
collected in an struct local to that transaction, and then flushed to
the main ApplicationStats container when the transaction finishes.

Previously, when flushing, we failed to copy the QuerySummary field,
leading to metadata->'querySummary' from being empty in most cases.

Prior to ce1b42b this only affected
statements in an explicit transaction. After that commit, it affected
all statements.

Release note (bug fix): Fix a bug that led to the querySummary field
in crdb_internal.statements_statistics's metadata column being empty.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@ericharmeling ericharmeling left a comment

Choose a reason for hiding this comment

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

Thanks for digging into this and finding a solution! I also appreciate the detailed explanation. LGTM modulo a linter nit.

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


pkg/sql/logictest/testdata/logic_test/statement_statistics line 405 at r1 (raw file):


statement ok
BEGIN; SELECT COUNT(1) AS wombat1; COMMIT

linter is complaining about casing

Suggestion:

count(1)

pkg/sql/logictest/testdata/logic_test/statement_statistics line 413 at r1 (raw file):


statement ok
SELECT COUNT(1) AS wombat2

same

Suggestion:

count(1)

During execution of a transaction, all statement statistics are
collected in an struct local to that transaction, and then flushed to
the main ApplicationStats container when the transaction finishes.

Previously, when flushing, we failed to copy the QuerySummary field,
leading to `metadata->'querySummary'` from being empty in most cases.

Prior to ce1b42b this only affected
statements in an explicit transaction. After that commit, it affected
all statements.

Release note (bug fix): Fix a bug that led to the querySummary field
in crdb_internal.statements_statistics's metadata column being empty.
@stevendanna stevendanna force-pushed the collect-query-summary branch from 141466d to f880548 Compare July 11, 2022 15:59
@stevendanna
Copy link
Collaborator Author

TFTR!

bors r=ericharmeling

@craig
Copy link
Contributor

craig bot commented Jul 11, 2022

Build succeeded:

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