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

*: support memTracker.detach for HashJoin, Apply and IndexLookUp in Close func #54095

Merged
merged 9 commits into from
Jun 26, 2024

Conversation

XuHuaiyu
Copy link
Contributor

@XuHuaiyu XuHuaiyu commented Jun 18, 2024

What problem does this PR solve?

Issue Number: close #54005

Problem Summary:

What changed and how does it work?

Before:
截屏2024-06-19 10 18 55

After:
截屏2024-06-19 10 06 18

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Fixed the issue of abnormally high memory usage caused by memTracker not being detached in HashJoin and IndexLookUp operators when used as the inner side of the Apply operator.

@XuHuaiyu XuHuaiyu added type/bugfix This PR fixes a bug. sig/execution SIG execution labels Jun 18, 2024
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-triage-completed do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 18, 2024
Copy link

tiprow bot commented Jun 18, 2024

Hi @XuHuaiyu. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

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-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. labels Jun 19, 2024
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jun 19, 2024
@XuHuaiyu
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Jun 25, 2024

@XuHuaiyu: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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-sigs/prow repository.

@@ -859,6 +859,7 @@ func (e *IndexLookUpExecutor) Close() error {
e.tblWorkerWg.Wait()
e.finished = nil
e.workerStarted = false
e.memTracker.Detach()
Copy link
Collaborator

@guo-shaoge guo-shaoge Jun 25, 2024

Choose a reason for hiding this comment

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

move before workerFinished

Copy link

codecov bot commented Jun 25, 2024

Codecov Report

Attention: Patch coverage is 91.30435% with 4 lines in your changes missing coverage. Please review.

Project coverage is 56.1402%. Comparing base (854a4e3) to head (4798e96).
Report is 6 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54095         +/-   ##
=================================================
- Coverage   72.8288%   56.1402%   -16.6887%     
=================================================
  Files          1523       1643        +120     
  Lines        435300     607958     +172658     
=================================================
+ Hits         317024     341309      +24285     
- Misses        98685     243295     +144610     
- Partials      19591      23354       +3763     
Flag Coverage Δ
integration 37.4195% <91.3043%> (?)
unit 71.8654% <84.7826%> (+0.0333%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9656% <ø> (ø)
parser ∅ <ø> (∅)
br 52.7523% <ø> (+6.6207%) ⬆️

@@ -45,6 +45,18 @@ type RowPtr struct {
RowIdx uint32
}

// NewListWithMemTracker creates a new List with field types, init chunk size, max chunk size and memory tracker.
func NewListWithMemTracker(fieldTypes []*types.FieldType, initChunkSize, maxChunkSize int, tracker *memory.Tracker) *List {
l := &List{
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe call NewList() then put trackers into it.

@guo-shaoge
Copy link
Collaborator

other lgtm

Copy link

ti-chi-bot bot commented Jun 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guo-shaoge, wshwsh12

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [guo-shaoge,wshwsh12]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@XuHuaiyu XuHuaiyu added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. labels Jun 27, 2024
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 27, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #54260.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #54261.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 27, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 27, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.1: #54262.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 27, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #54263.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 27, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #54264.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.2: #54305.

ti-chi-bot bot pushed a commit that referenced this pull request Jun 28, 2024
XuHuaiyu added a commit to XuHuaiyu/tidb that referenced this pull request Jul 1, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Jul 1, 2024
@ti-chi-bot ti-chi-bot removed the needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. label Jul 11, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Jul 11, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Jul 18, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Jul 19, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.2 ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/execution SIG execution size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unexpected memory usage of memory tracker
4 participants