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

*: Log SQL statement when coprocessor encounteres lock #27735

Merged
merged 12 commits into from
Sep 8, 2021

Conversation

MyonKeminta
Copy link
Contributor

@MyonKeminta MyonKeminta commented Sep 1, 2021

What problem does this PR solve?

Issue Number: close #27718

Problem Summary: The debug log on coprocessor encounters lock doesn't print out the statement, which makes it difficult to know what statement was affected by the lock. This PR tries to add the log.

What is changed and how it works?

What's Changed: Added a callback parameter to the Send method of kv.Client that accepts a new TransactionEvent object. This avoids to pass the SQL statement deep down to the coprocessor client part. And I think this callback and events can also be reused by Lock View.

How it Works:

Check List

Tests

  • Manual test (add detailed scripts or steps below) (TODO)

Side effects

  • Performance regression: Consumes more CPU

Documentation

  • None

Release note

None.

@MyonKeminta MyonKeminta added the sig/transaction SIG:Transaction label Sep 1, 2021
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Sep 1, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • cfzjywxk
  • sticnarf

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.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 1, 2021
@MyonKeminta MyonKeminta marked this pull request as ready for review September 6, 2021 09:37
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 6, 2021
@ti-chi-bot ti-chi-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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 Sep 7, 2021
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 7, 2021
// TransactionEvent represents a transaction event that may belong to any of the possible types.
type TransactionEvent struct {
eventType EventType
ptr unsafe.Pointer
Copy link
Contributor

@longfangsong longfangsong Sep 8, 2021

Choose a reason for hiding this comment

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

Why we have to use unsafe.Pointer here? (I don't know which one is better, unsafe.Pointer or interface{})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems either can be used, but interface{} looks better. I thought about avoiding the RTTI (though I'm not sure if there is) but I think perhaps that's a bad idea. I'll change it to interface{} then, please wait a minute

Copy link
Contributor

@longfangsong longfangsong left a comment

Choose a reason for hiding this comment

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

Just a small question. Rest LGTM

@ti-chi-bot
Copy link
Member

@longfangsong: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

Just a small question. Rest LGTM

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@longfangsong
Copy link
Contributor

@longfangsong: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

PTAL pingcap/community#544

@MyonKeminta
Copy link
Contributor Author

@sticnarf @cfzjywxk Also PTAL, thanks

@MyonKeminta
Copy link
Contributor Author

/merge

@MyonKeminta
Copy link
Contributor Author

/run-check_dev_2

1 similar comment
@MyonKeminta
Copy link
Contributor Author

/run-check_dev_2

@ti-srebot
Copy link
Contributor

cherry pick to release-5.2 in PR #27924

@ti-srebot
Copy link
Contributor

cherry pick to release-5.1 in PR #27925

@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #27926

@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #27927

MyonKeminta added a commit to ti-srebot/tidb that referenced this pull request Sep 15, 2021
MyonKeminta added a commit to ti-srebot/tidb that referenced this pull request Sep 23, 2021
MyonKeminta added a commit to ti-srebot/tidb that referenced this pull request Sep 23, 2021
MyonKeminta added a commit to ti-srebot/tidb that referenced this pull request Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.0 needs-cherry-pick-release-5.1 needs-cherry-pick-release-5.2 release-note-none Denotes a PR that doesn't merit a release note. sig/transaction SIG:Transaction size/L Denotes a PR that changes 100-499 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.

Show information about SQL statement in the debug log about coprocessor encountering lock
6 participants