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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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.

Copy link

ti-chi-bot bot commented Jan 16, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 16, 2025
Copy link

ti-chi-bot bot commented Jan 16, 2025

[LGTM Timeline notifier]

Timeline:

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

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 73.4749%. Comparing base (803f928) to head (656d4d5).
Report is 2 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58986        +/-   ##
================================================
+ Coverage   73.0083%   73.4749%   +0.4665%     
================================================
  Files          1682       1682                
  Lines        465589     465696       +107     
================================================
+ Hits         339919     342170      +2251     
+ Misses       104736     102630      -2106     
+ Partials      20934      20896        -38     
Flag Coverage Δ
integration 42.8252% <60.2150%> (?)
unit 72.2360% <84.9462%> (+0.0317%) ⬆️

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

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved needs-1-more-lgtm Indicates a PR needs 1 more 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
2 participants