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: make retriever memory tracker fine grained #58986

Merged
merged 3 commits into from
Jan 24, 2025

Conversation

tangenta
Copy link
Contributor

@tangenta tangenta commented Jan 16, 2025

What problem does this PR solve?

Issue Number: close #58985

Problem Summary: See #58985 (comment)

What changed and how does it work?

Move memory tracker consumption calling into each info schema table. On the other hand, I batch the records to avoid calling the memory tracker too frequently, which may affect the performance.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
mysql> desc analyze select * from INFORMATION_SCHEMA.tables;
+----------------+----------+---------+------+---------------+----------------------------------------------------------+---------------+---------+------+
| id             | estRows  | actRows | task | access object | execution info                                           | operator info | memory  | disk |
+----------------+----------+---------+------+---------------+----------------------------------------------------------+---------------+---------+------+
| MemTableScan_4 | 10000.00 | 50823   | root | table:TABLES  | time:948.6ms, open:370ns, close:483ns, loops:51, RU:0.00 |               | 91.1 MB | N/A  |
+----------------+----------+---------+------+---------------+----------------------------------------------------------+---------------+---------+------+
1 row in set (0.95 sec)

mysql> set tidb_mem_quota_query = 80 << 20;
Query OK, 0 rows affected (0.00 sec)

mysql> desc analyze select * from INFORMATION_SCHEMA.tables;
ERROR 8175 (HY000): Your query has been cancelled due to exceeding the allowed memory limit for a single SQL query. Please try narrowing your query scope or increase the tidb_mem_quota_query limit and try again.[conn=3923771498]
  • 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 bot added do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 16, 2025
Copy link

tiprow bot commented Jan 16, 2025

Hi @tangenta. 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 approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 16, 2025
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

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

Project coverage is 74.8706%. Comparing base (f5dc850) to head (9a5503d).
Report is 3 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58986        +/-   ##
================================================
+ Coverage   73.0514%   74.8706%   +1.8191%     
================================================
  Files          1689       1735        +46     
  Lines        466805     475365      +8560     
================================================
+ Hits         341008     355909     +14901     
+ Misses       104815      96996      -7819     
- Partials      20982      22460      +1478     
Flag Coverage Δ
integration 48.9026% <60.2150%> (?)
unit 72.2745% <84.9462%> (+0.0294%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 60.6872% <ø> (+15.3583%) ⬆️

@tangenta
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Jan 16, 2025

@tangenta: 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.

Copy link
Contributor

@GMHDBJD GMHDBJD 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 Jan 23, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: GMHDBJD, 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:

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 23, 2025
Copy link

ti-chi-bot bot commented Jan 23, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-01-16 08:56:50.582884789 +0000 UTC m=+195282.037930960: ☑️ agreed by wshwsh12.
  • 2025-01-23 08:52:39.433843786 +0000 UTC m=+343686.764763187: ☑️ agreed by GMHDBJD.

@ti-chi-bot ti-chi-bot bot merged commit 9f07f52 into pingcap:master Jan 24, 2025
21 of 22 checks passed
hawkingrei pushed a commit to hawkingrei/tidb that referenced this pull request Jan 26, 2025
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query infoschema tables in a large cluster may encounter OOM issue
3 participants