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

executor: add metric to trace tikvTxn LockKeys time consume #14189

Merged
merged 3 commits into from
Dec 23, 2019

Conversation

cfzjywxk
Copy link
Contributor

@cfzjywxk cfzjywxk commented Dec 23, 2019

What problem does this PR solve?

Add metric to trace pessimistic lock LockKeys time consume

What is changed and how it works?

Check List

Tests

  • Unit test

Code changes

  • Has exported variable/fields change

Side effects

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to update the tidb-ansible repository

Release note

  • Write release note for bug-fix or new feature.

@coocood
Copy link
Member

coocood commented Dec 23, 2019

LGTM

Namespace: "tidb",
Subsystem: "tikvclient",
Name: "pessimistic_lock_keys_duration",
Buckets: prometheus.ExponentialBuckets(0.001, 2, 30), // 1ms ~ 1073741s
Copy link
Member

Choose a reason for hiding this comment

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

The buckets can fewer.

@cfzjywxk
Copy link
Contributor Author

@jackysp PTAL

Namespace: "tidb",
Subsystem: "tikvclient",
Name: "pessimistic_lock_keys_duration",
Buckets: prometheus.ExponentialBuckets(0.001, 2, 24), // 1ms ~ 16777s
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the max to 16777s?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The innodb_lock_wait_timeout session variable could be set to maximum 1073741824 seconds, so maybe it could be some big value

defer func() {
if err == nil {
if lockCtx.PessimisticLockWaited > 0 {
lockCtx.LockTimeWaited = time.Since(lockCtx.WaitStartTime)
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems the field LockTimeWaited is unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is used for slow query logging in the diff part2

Copy link
Contributor

@lonng lonng left a comment

Choose a reason for hiding this comment

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

Reset LGTM

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@jackysp jackysp added the status/can-merge Indicates a PR has been approved by a committer. label Dec 23, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Dec 23, 2019

/run-all-tests

@sre-bot sre-bot merged commit 03f9a95 into pingcap:master Dec 23, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Dec 23, 2019

cherry pick to release-3.0 failed

@coocood
Copy link
Member

coocood commented Dec 24, 2019

/run-cherry-picker

@sre-bot
Copy link
Contributor

sre-bot commented Dec 24, 2019

cherry pick to release-3.0 in PR #14204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants