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

executor: reuse memory for parallelSortSpillHelper #53859

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

hawkingrei
Copy link
Member

@hawkingrei hawkingrei commented Jun 6, 2024

What problem does this PR solve?

Issue Number: close #53861

Problem Summary:

What changed and how does it work?

we get a profiler while we benchmark sync load. it takes too much time on the newParallelSortSpillHelper. it is unnecessary.

https://flamegraph.com/share/4dca9137-2419-11ef-ab1b-b6898751f631

image

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

after optimization

t takes less time on the newParallelSortSpillHelper

https://flamegraph.com/share/822c3df8-247d-11ef-ab1b-b6898751f631

image
  • 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.

None

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 6, 2024
Copy link

codecov bot commented Jun 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.7889%. Comparing base (a865c86) to head (20f9f9f).

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #53859         +/-   ##
=================================================
- Coverage   72.6167%   55.7889%   -16.8279%     
=================================================
  Files          1507       1627        +120     
  Lines        431669     602265     +170596     
=================================================
+ Hits         313464     335997      +22533     
- Misses        98888     243062     +144174     
- Partials      19317      23206       +3889     
Flag Coverage Δ
integration 37.1974% <100.0000%> (?)
unit 71.4557% <100.0000%> (-0.1491%) ⬇️

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

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

@hawkingrei
Copy link
Member Author

/retest

@hawkingrei
Copy link
Member Author

/retest

1 similar comment
@hawkingrei
Copy link
Member Author

/retest

Copy link
Contributor

@xzhangxian1008 xzhangxian1008 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jun 7, 2024
@hawkingrei hawkingrei requested a review from windtalker June 7, 2024 03:52
}
}

func (p *parallelSortSpillHelper) close() {
for _, inDisk := range p.sortedRowsInDisk {
inDisk.Close()
}
p.tmpSpillChunk.Destroy(spillChunkSize, p.fieldTypes)
Copy link
Contributor

Choose a reason for hiding this comment

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

put it in defer block?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is impossible to have a problem with the isDisk.Close and lead to panic here.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Jun 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: windtalker, xzhangxian1008

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:

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

@ti-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jun 7, 2024
Copy link

ti-chi-bot bot commented Jun 7, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-06-07 03:46:40.149545724 +0000 UTC m=+90754.202857649: ☑️ agreed by xzhangxian1008.
  • 2024-06-07 05:20:12.262323022 +0000 UTC m=+96366.315634946: ☑️ agreed by windtalker.

@ti-chi-bot ti-chi-bot bot merged commit b9b5ec6 into pingcap:master Jun 7, 2024
23 checks passed
@hawkingrei hawkingrei deleted the try_to_reuse_tmp_spill_chunk branch June 7, 2024 05:34
@hawkingrei
Copy link
Member Author

/cherrypick release-8.1

@ti-chi-bot
Copy link
Member

@hawkingrei: new pull request created to branch release-8.1: #53879.

In response to this:

/cherrypick release-8.1

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.

@hawkingrei
Copy link
Member Author

/cherrypick release-7.5

@ti-chi-bot
Copy link
Member

@hawkingrei: new pull request created to branch release-7.5: #53889.

In response to this:

/cherrypick release-7.5

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.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 8, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reuse memory for parallelSortSpillHelper‘s tmpSpillChunk
4 participants