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

*: speed up create table and reduce memory usage when the number of tables is relatively large (#49371) #53545

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #49371

What problem does this PR solve?

Issue Number: close #49370

Problem Summary:
ListTables took a lot of time when the number of tables was relatively large

What changed and how does it work?

Because the unmarshal of the TableInfo structure takes a large proportion of time, we only needn't all structures of the TableInfo. So we use TableNameInfo instead of it.

Check List

Tests

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

Memory usage
Before this PR, when the 113k table is created, TiDB OOM (14G+) appears.
After this PR, the maximum memory of TiDB is nearly 6.9G when creating 113k tables, and the maximum memory usage is 11G when 400k tables are created

Time taken
Execute checkTableNotExistsFromStore function consumption of time.

Total Table Count Current DB Table Count Master Branch Take Time After this PR Table Time
437k 215k 23-26s 12-14s

Master branch info:
截屏2023-12-12 14 56 09

截屏2023-12-12 15 15 27

After this PR info(The middle area is particularly high because the owner of another service is transferred):
截屏2023-12-12 14 56 16

截屏2023-12-12 15 15 19
  • 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

@ti-chi-bot ti-chi-bot added 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. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR. labels May 24, 2024
@3AceShowHand 3AceShowHand requested review from tangenta, hawkingrei and zimulala and removed request for tangenta May 24, 2024 11:09
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label May 24, 2024
Copy link

codecov bot commented May 24, 2024

Codecov Report

Attention: Patch coverage is 60.86957% with 9 lines in your changes are missing coverage. Please review.

Please upload report for BASE (release-7.5@3841026). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-7.5     #53545   +/-   ##
================================================
  Coverage               ?   71.9860%           
================================================
  Files                  ?       1411           
  Lines                  ?     410299           
  Branches               ?          0           
================================================
  Hits                   ?     295358           
  Misses                 ?      95065           
  Partials               ?      19876           
Flag Coverage Δ
unit 71.9860% <60.8695%> (?)

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

Components Coverage Δ
dumpling 53.9913% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 53.4086% <0.0000%> (?)

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

ti-chi-bot bot commented May 24, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-24 11:13:00.972395144 +0000 UTC m=+2429334.729530715: ☑️ agreed by lance6716.
  • 2024-05-24 11:48:03.440783902 +0000 UTC m=+2431437.197919467: ☑️ agreed by tangenta.

@Benjamin2037 Benjamin2037 added affects-7.5 This bug affects the 7.5.x(LTS) versions. and removed affects-7.5 This bug affects the 7.5.x(LTS) versions. labels May 27, 2024
Copy link

ti-chi-bot bot commented May 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, lance6716, tangenta

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 added the cherry-pick-approved Cherry pick PR approved by release team. label May 27, 2024
@3AceShowHand
Copy link
Contributor

/test all

Copy link

tiprow bot commented May 27, 2024

@3AceShowHand: No presubmit jobs available for pingcap/[email protected]

In response to this:

/test all

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 merged commit a97e646 into pingcap:release-7.5 May 27, 2024
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. lgtm 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. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants