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

store/tikv: add and fix some metrics for the new retry logic #25123

Merged
merged 28 commits into from
Jun 7, 2021

Conversation

sticnarf
Copy link
Contributor

@sticnarf sticnarf commented Jun 4, 2021

What is changed and how it works?

The exit cause of the replica selector is recorded in the metrics. The retry time of a request is recorded in a histogram.

The commit backoff time is improved. Because prewrite is mostly parallel, we only record the max total sleep of all backoffs in prerwite. (But this is not the real time spent on prewrite because of the concurrency limit.)

The backoff time of the commit phase is not counted in the batch executor. commitTxn adds the time to the final commit backoff time.

Check List

Tests

  • No code

Release note

  • No release note

Signed-off-by: Yilin Chen <sticnarf@gmail.com>
@sticnarf sticnarf added the sig/transaction SIG:Transaction label Jun 4, 2021
@sticnarf sticnarf requested a review from youjiali1995 June 4, 2021 02:07
@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 4, 2021
@sticnarf sticnarf requested a review from a team as a code owner June 4, 2021 02:14
@sticnarf sticnarf requested review from lzmhhh123 and removed request for a team June 4, 2021 02:14
@sticnarf sticnarf force-pushed the new-retry-metrics branch from 6318331 to ce21836 Compare June 4, 2021 02:17
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 4, 2021
@sticnarf sticnarf force-pushed the new-retry-metrics branch from ce21836 to 17cffa6 Compare June 4, 2021 02:22
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
@sticnarf sticnarf force-pushed the new-retry-metrics branch from 17cffa6 to 81eb9d6 Compare June 4, 2021 03:13
store/tikv/2pc.go Outdated Show resolved Hide resolved
@github-actions github-actions bot added the sig/execution SIG execution label Jun 4, 2021
@youjiali1995 youjiali1995 requested a review from lysu June 4, 2021 05:58
store/tikv/2pc.go Outdated Show resolved Hide resolved
store/tikv/2pc.go Show resolved Hide resolved
Copy link
Contributor

@youjiali1995 youjiali1995 left a comment

Choose a reason for hiding this comment

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

How about adding metrics for commitDetail? i.e., backoff time and count of a single transaction commit.

store/tikv/2pc.go Show resolved Hide resolved
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
boSleep := int64(singleBatchBackoffer.GetTotalSleep()) * int64(time.Millisecond)
if boSleep > commitDetail.Mu.CommitBackoffTime {
commitDetail.Mu.CommitBackoffTime = boSleep
commitDetail.Mu.BackoffTypes = singleBatchBackoffer.GetTypes()
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

commitDetail.Mu.BackoffTypes = append(batchExe.backoffer.GetTypes(), singleBatchBackoffer.GetTypes()...)

clone seems not inherit parent's backoff types

Copy link
Contributor Author

@sticnarf sticnarf Jun 4, 2021

Choose a reason for hiding this comment

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

Ah, I thought the backoff types are inherited... It looks difficult to handle the backoff types T_T

sticnarf added 5 commits June 4, 2021 17:10
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 4, 2021
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lysu
  • youjiali1995

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@youjiali1995
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 5774f5f

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 7, 2021
@sticnarf
Copy link
Contributor Author

sticnarf commented Jun 7, 2021

/run-monitor-test

@sre-bot
Copy link
Contributor

sre-bot commented Jun 7, 2021

Visit the grafana server at: http://172.16.5.5:30721, it will last for 5 hours

sticnarf added 2 commits June 7, 2021 16:05
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Jun 7, 2021
@sticnarf
Copy link
Contributor Author

sticnarf commented Jun 7, 2021

/run-monitor-test

@sticnarf sticnarf closed this Jun 7, 2021
@sticnarf sticnarf reopened this Jun 7, 2021
@sre-bot
Copy link
Contributor

sre-bot commented Jun 7, 2021

Visit the grafana server at: http://172.16.5.5:32362, it will last for 5 hours

@sticnarf
Copy link
Contributor Author

sticnarf commented Jun 7, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 2c65e23

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 7, 2021
@ti-chi-bot ti-chi-bot merged commit 840494d into pingcap:master Jun 7, 2021
@sticnarf
Copy link
Contributor Author

sticnarf commented Jun 7, 2021

/run-cherry-picker

@ti-srebot
Copy link
Contributor

cherry pick to release-5.1 in PR #25212

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.1 sig/execution SIG execution sig/transaction SIG:Transaction size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants