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: fixes statement contention count metric #96458

Merged
merged 1 commit into from
Feb 3, 2023
Merged

sql: fixes statement contention count metric #96458

merged 1 commit into from
Feb 3, 2023

Conversation

j82w
Copy link
Contributor

@j82w j82w commented Feb 2, 2023

Fixes a bug introduced in #94750 where the metric
count was counting transaction that hit contention events instead of the statement count.

closes: #96429

Release note: none

@j82w j82w requested a review from a team February 2, 2023 20:00
@j82w j82w requested a review from a team as a code owner February 2, 2023 20:00
@j82w j82w requested a review from DrewKimball February 2, 2023 20:00
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@maryliag maryliag 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 3 of 3 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball)

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.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @j82w and @maryliag)


pkg/sql/executor_statement_metrics.go line 238 at r2 (raw file):

			}

			ex.planner.DistSQLPlanner().distSQLSrv.Metrics.ContendedQueriesCount.Inc(1)

Won't this count number of contention events instead of number of queries with contention?

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:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @j82w and @maryliag)


pkg/sql/distsql_running_test.go line 335 at r3 (raw file):

UPDATE test.test SET x = 100 WHERE x = 1;
COMMIT;
SET TRACING=off;

[nit] We're no longer setting the tracing to off afterward - is that intentional? Not sure if it matters...

Fixes a bug introduced in #94750 where the metric
count was counting transaction that hit contention
events instead of the statement count.

closes: #96429

Release note: none
@j82w
Copy link
Contributor Author

j82w commented Feb 3, 2023

pkg/sql/distsql_running_test.go line 335 at r3 (raw file):

Previously, DrewKimball (Drew Kimball) wrote…

[nit] We're no longer setting the tracing to off afterward - is that intentional? Not sure if it matters...

I don't think it should, but I'll add it back to be on the safe side.

@j82w
Copy link
Contributor Author

j82w commented Feb 3, 2023

bors r+

@craig
Copy link
Contributor

craig bot commented Feb 3, 2023

Build succeeded:

@craig craig bot merged commit 1708ea4 into cockroachdb:master Feb 3, 2023
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 contention metric is calculating the txn contention instead of stmt
4 participants