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

statistic: solve write write conflicts of mysql.stats_histograms #23831

Closed
wants to merge 1 commit into from

Conversation

jianzhiyao
Copy link
Contributor

@jianzhiyao jianzhiyao commented Apr 2, 2021

What problem does this PR solve?

Issue Number: close #21787

Problem Summary:
the internal SQL in the slow log should not be check write conflict

What is changed and how it works?

How it Works:
run query in pessimistic transaction.

Check List

Tests

  • No code

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM

Release note

  • statistic: solve write write conflicts of mysql.stats_histograms

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@jianzhiyao jianzhiyao requested a review from a team as a code owner April 2, 2021 07:26
@jianzhiyao jianzhiyao requested review from eurekaka and removed request for a team April 2, 2021 07:26
@ti-chi-bot ti-chi-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 2, 2021
@jianzhiyao jianzhiyao force-pushed the frt/write_conflict branch from 54bb1cd to 3163746 Compare April 2, 2021 07:30
@jianzhiyao
Copy link
Contributor Author

PTAL @djshow832

Copy link
Contributor

@eurekaka eurekaka left a comment

Choose a reason for hiding this comment

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

I don't understand the purpose of this PR, or the intention of the issue. It is reasonable that conflicts happen since there may be several tidb servers dumping their stats delta simultaneously, and when conflicts happen, the stats delta is not cleared, so it can be retried for the next time. I don't believe this is a problem that we should fix.

@@ -688,7 +688,7 @@ func (h *Handle) FlushStats() {
}
}
if err := h.DumpStatsDeltaToKV(DumpAll); err != nil {
logutil.BgLogger().Error("[stats] dump stats delta fail", zap.Error(err))
logutil.BgLogger().Error("[stats] dump stats all fail", zap.Error(err))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why?

There call h.DumpStatsDeltaToKV(DumpAll) but log message is delta

@eurekaka eurekaka requested review from winoros and qw4990 April 2, 2021 08:55
@jianzhiyao
Copy link
Contributor Author

I don't understand the purpose of this PR, or the intention of the issue. It is reasonable that conflicts happen since there may be several tidb servers dumping their stats delta simultaneously, and when conflicts happen, the stats delta is not cleared, so it can be retried for the next time. I don't believe this is a problem that we should fix.

Maybe that issue want to reduce write-write conflicts when updating stats delta? So I use pessimistic transaction in here.

@jianzhiyao jianzhiyao closed this Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

the information of txnlock about internal SQL should not appear in the slow log
3 participants