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

*: memory is not allocated first if the user does not use some information from the table. #50062

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

zimulala
Copy link
Contributor

@zimulala zimulala commented Jan 4, 2024

What problem does this PR solve?

Issue Number: close #50077

Problem Summary:
If a large number of tables (such as the 540k table, 2850k partitions in the scenario shown in issue) are used, the OOM situation may occur.

What changed and how does it work?

Reduce memory allocation

  • Do not create columns(PublicColumns, VisibleColumns, WritableColumns, FullHiddenColsAndVisibleColumns) for tables that are not used by users.
  • Do preallocate for EncodeInt in EncodeTableIndexPrefix.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    Prior to this PR, OOM appeared every 20-30 minutes. After this PR memory is relatively stable without OOM (test 4h+).
    See the memory usage chart, memory reduction of about 2G.

Before this PR:

eDtKc4brDk

截屏2024-01-04 16 22 02

After this PR:

7xfDRRUZda

截屏2024-01-04 16 20 46
  • 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

@zimulala zimulala added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 4, 2024
@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. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jan 4, 2024
Copy link

tiprow bot commented Jan 4, 2024

Hi @zimulala. 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/test-infra repository.

Copy link

codecov bot commented Jan 4, 2024

Codecov Report

Merging #50062 (d1e6f2f) into master (354c186) will increase coverage by 30.1949%.
Report is 41 commits behind head on master.
The diff coverage is 7.6923%.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #50062         +/-   ##
=================================================
+ Coverage   36.8806%   67.0756%   +30.1949%     
=================================================
  Files          2731       2553        -178     
  Lines        773730     845799      +72069     
=================================================
+ Hits         285357     567325     +281968     
+ Misses       463362     254616     -208746     
+ Partials      25011      23858       -1153     
Flag Coverage Δ
integration 37.0446% <7.6923%> (?)
system ?
true ?
unit 79.2368% <7.6923%> (+7.3250%) ⬆️

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

Components Coverage Δ
dumpling 73.6130% <ø> (+17.3001%) ⬆️
parser ∅ <ø> (∅)
br 71.8255% <ø> (+27.8064%) ⬆️

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. do-not-merge/needs-triage-completed 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. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked do-not-merge/needs-triage-completed labels Jan 4, 2024
@zimulala zimulala changed the title *: for a mem test *: memory is not allocated first if the user does not use some information from the table. Jan 4, 2024
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jan 5, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 5, 2024
Copy link

ti-chi-bot bot commented Jan 5, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-01-05 01:54:48.017266388 +0000 UTC m=+2394779.054493314: ☑️ agreed by Defined2014.
  • 2024-01-05 07:17:35.451543806 +0000 UTC m=+2414146.488770734: ☑️ agreed by tiancaiamao.

@zimulala
Copy link
Contributor Author

zimulala commented Jan 8, 2024

/test check-dev2

Copy link

tiprow bot commented Jan 8, 2024

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

In response to this:

/test check-dev2

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.

Copy link

ti-chi-bot bot commented Jan 8, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Defined2014, tangenta, tiancaiamao

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 the approved label Jan 8, 2024
@ti-chi-bot ti-chi-bot bot merged commit e56efc6 into pingcap:master Jan 8, 2024
20 checks passed
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 8, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
AilinKid pushed a commit to AilinKid/tidb that referenced this pull request Jan 17, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Jan 25, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Feb 1, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Feb 22, 2024
@zimulala zimulala deleted the zimuxia/partitions branch March 7, 2024 05:58
@ekexium ekexium mentioned this pull request May 28, 2024
13 tasks
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. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TiDB Server OOM when the table# and paration# is large
5 participants