-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
LockCtx: add memTracker for InitCheckExistence in LockCtx #52739
base: master
Are you sure you want to change the base?
LockCtx: add memTracker for InitCheckExistence in LockCtx #52739
Conversation
Signed-off-by: RemHero <[email protected]>
|
Welcome @RemHero! |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @RemHero. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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 kubernetes/test-infra repository. |
Hi @RemHero. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. 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 kubernetes/test-infra repository. |
/ok-to-test |
@@ -1246,8 +1250,16 @@ func newLockCtx(sctx sessionctx.Context, lockWaitTime int64, numKeys int) (*tikv | |||
rec := deadlockhistory.ErrDeadlockToDeadlockRecord(deadlock) | |||
deadlockhistory.GlobalDeadlockHistory.Push(rec) | |||
} | |||
lockCtx.OnMemChange = func(capacity int) uint64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some test cases for it.
Signed-off-by: RemHero <[email protected]>
[FORMAT CHECKER NOTIFICATION] Notice: To remove the For example:
📖 For more info, you can check the "Contribute Code" section in the development guide. |
@RemHero: The following test failed, say
Full PR test history. Your PR dashboard. 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 kubernetes/test-infra repository. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of how to update client-go dependency, here's the common way:
- Prepare PRs for both TiDB and cilent-go.
- Replace the dependency of client-go in your TiDB PR, so that CI can run with your client-go patch (see https://github.com/tikv/client-go#test-with-tidb). Note that the bazel cache in CI could stop you. Seek @hawkingrei for help.
- Once TiDB PR passes CI and both PRs are approved, merge the client-go PR.
- Modify your TiDB PR, remove the replace part, update client-go dependency to the correct version.
- Get your TiDB PR merged.
if lockCtx.ForUpdateTS > 0 && seVars.AssertionLevel != variable.AssertionLevelOff { | ||
lockCtx.InitCheckExistence(numKeys) | ||
if lockCtx.OnMemChange != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OnMemChange is defined in this function and only used here. So it seems to me that it is redundant to have a OnMemChange field in LockCtx.
So you are only recording the initial usage of the struct. That leads to a question: should we dynamically track the structure, or is the initial usage is enough? Anyway it's a good start and better than tracking nothing.
PR needs rebase. 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 kubernetes/test-infra repository. |
@RemHero: The following tests failed, say
Full PR test history. Your PR dashboard. 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 kubernetes/test-infra repository. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: close #51217
Problem Summary:
The memory consumed in InitCheckExistence is not tracked by the memory tracker.
What changed and how does it work?
This PR and PR implement the
memTracker
to track memory usage inInitCheckExistence
. Specifically, theOnMemChange
method is declared inInitCheckExistence
to obtain the memory usage inInitCheckExistence
, and the exact memory usage is obtained by referring to the memory calculation method inmem_aware_map.go
.[NOTICE]
This PR needs to be merged after this PR is merged because new member variables are declared in
InitCheckExistence
. And it needs to be tested after PR merging.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.