-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
*: add a memdb memory tracker #35225
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
bd16bfd
to
2bda643
Compare
/run-build |
@@ -119,7 +119,7 @@ func TestBasicTxnState(t *testing.T) { | |||
require.Nil(t, info) | |||
} | |||
|
|||
func TestEntriesCountAndSize(t *testing.T) { | |||
func TestEntriesCount(t *testing.T) { |
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.
Why not check Size?
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.
Now size
is checked by the new test because it now reflects the actual memory footprint and thus is not a fixed number.
Signed-off-by: ekexium <ekexium@fastmail.com>
Signed-off-by: ekexium <ekexium@fastmail.com>
Signed-off-by: ekexium <ekexium@fastmail.com>
Signed-off-by: ekexium <ekexium@fastmail.com>
ekexium seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
0b661bd
to
30a86ff
Compare
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.
Rest LGTM
executor/infoschema_reader.go
Outdated
@@ -2607,7 +2607,12 @@ func (e *tidbTrxTableRetriever) retrieve(ctx context.Context, sctx sessionctx.Co | |||
row = append(row, types.NewDatum(nil)) | |||
} | |||
} else { | |||
row = append(row, e.txnInfo[i].ToDatum(c.Name.O)) | |||
if c.Name.O == txninfo.MemBufferBytesStr { |
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.
I think use switch-case-default is better..
func (s *session) SetMemoryFootprintChangeHook() { | ||
hook := func(mem uint64) { | ||
if s.sessionVars.MemDBFootprint == nil { | ||
tracker := memory.NewTracker(memory.LabelForMemDB, -1) |
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.
Is the total-txn-size-limit
actually deprecated after this commit?
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.
It's still used in memdb. But I think we could consider deprecating the config.
Signed-off-by: ekexium <eke@fastmail.com>
Signed-off-by: ekexium <eke@fastmail.com>
0e38f62
to
bde3c82
Compare
Signed-off-by: ekexium <eke@fastmail.com>
bde3c82
to
cb76015
Compare
There's a test failed for data race. Let's wait for tikv/client-go#621 |
c2e303b
to
33122d4
Compare
Signed-off-by: ekexium <eke@fastmail.com>
33122d4
to
f1b87fc
Compare
PTAL @XuHuaiyu |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: f1b87fc
|
@ekexium: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. 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. |
I changed the email address of my git config and caused the CLA check failure. I've made a new PR #39372 |
Signed-off-by: ekexium ekexium@fastmail.com
What problem does this PR solve?
Issue Number: ref #35203
Problem Summary:
What is changed and how it works?
EntriesSize
inTxnInfo
with a memory tracker of MemDB.total-txn-size-limit
for now.Relates to tikv/client-go#520
Check List
Tests
The statement aborts when the memdb memory footprint reaches the limit (1.02G).
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.