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

*: add memory tracker for mppIterator (#40901) #40991

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #40901

What problem does this PR solve?

Issue Number: close #40900
Problem Summary:

What is changed and how it works?

Track the memory usage of mppIterator

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
mysql> set tidb_mem_quota_query = 1 <<30;
mysql> desc analyze  select * from `sli-gauge-metric`  order by cluster_id;
+----------------------------+------------+---------+--------------+------------------------+----------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------+-------------
---------------------+----------+---------+
| id                         | estRows    | actRows | task         | access object          | execution info                                                       
                                                                                                                                                                   
                                                                                                                                                     | operator inf
o                    | memory   | disk    |
+----------------------------+------------+---------+--------------+------------------------+----------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------+-------------
---------------------+----------+---------+
| Sort_4                     | 1151072.00 | 1031072 | root         |                        | time:1m47.8s, loops:1008                                             
                                                                                                                                                                   
                                                                                                                                                     | test.sli-gau
ge-metric.cluster_id | 1.12 GB  | 7.39 GB |
| └─TableReader_14       | 1151072.00 | 1031072 | root         |                        | time:42.5s, loops:1018, cop_task: {num: 28, max: 0s, min: 0s, avg: 0s, p9
5: 0s, copr_cache_hit_ratio: 0.00}                                                                                                                                 
                                                                                                                                                 | data:ExchangeSen
der_13           | 485.7 MB | N/A     |
|   └─ExchangeSender_13  | 1151072.00 | 1031072 | mpp[tiflash] |                        | tiflash_task:{proc max:5.71s, min:2.24s, avg: 3.97s, p80:5.71s, p95:5.71s
, iters:26, tasks:2, threads:21}                                                                                                                                   
                                                                                                                                                 | ExchangeType: Pa
ssThrough        | N/A      | N/A     |
|     └─TableFullScan_12 | 1151072.00 | 1031072 | mpp[tiflash] | table:sli-gauge-metric | tiflash_task:{proc max:1.84s, min:660.7ms, avg: 1.25s, p80:1.84s, p95:1.$4s, iters:26, tasks:2, threads:21}, tiflash_scan:{dtfile:{total_scanned_packs:147, total_skipped_packs:46, total_scanned_rows:1035088, total_skipped_rows:373766, $otal_rs_index_load_time: 0ms, total_read_time: 24748ms}, total_create_snapshot_time: 0ms, total_local_region_num: 0, total_remote_region_num: 0} | keep order:fals$                 | N/A      | N/A     |
+----------------------------+------------+---------+--------------+------------------------+---------------------------------------------------------------------$------------------------------------------------------------------------------------------------------------------------------------------------------------------$-----------------------------------------------------------------------------------------------------------------------------------------------------+------------$---------------------+----------+---------+
4 rows in set (1 min 49.58 sec)

mysql> set tidb_mem_quota_query = 500 << 20;
mysql> desc analyze  select * from `sli-gauge-metric`  order by cluster_id;
ERROR 1105 (HY000): Out Of Memory Quota![conn_id=7037804604603498899]

mysql> set tidb_mem_quota_query = 1 << 40;
mysql> desc analyze  select * from `sli-gauge-metric`  order by cluster_id;
+----------------------------+------------+---------+--------------+------------------------+----------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------+----------------
------------------+----------+---------+
| id                         | estRows    | actRows | task         | access object          | execution info                                                       
                                                                                                                                                                   
                                                                                                                                                  | operator info  
                  | memory   | disk    |
+----------------------------+------------+---------+--------------+------------------------+----------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------+----------------
------------------+----------+---------+
| Sort_4                     | 1151072.00 | 1031072 | root         |                        | time:1m3.6s, loops:1008                                              
                                                                                                                                                                   
                                                                                                                                                  | test.sli-gauge-
metric.cluster_id | 7.47 GB  | 0 Bytes |
| └─TableReader_14       | 1151072.00 | 1031072 | root         |                        | time:59.3s, loops:1016, cop_task: {num: 23, max: 0s, min: 0s, avg: 0s, p9
5: 0s, copr_cache_hit_ratio: 0.00}                                                                                                                                 
                                                                                                                                              | data:ExchangeSender
_13           | 488.6 MB | N/A     |
|   └─ExchangeSender_13  | 1151072.00 | 1031072 | mpp[tiflash] |                        | tiflash_task:{proc max:7.25s, min:2.23s, avg: 4.74s, p80:7.25s, p95:7.25s
, iters:21, tasks:2, threads:16}                                                                                                                                   
                                                                                                                                              | ExchangeType: PassT
hrough        | N/A      | N/A     |
|     └─TableFullScan_12 | 1151072.00 | 1031072 | mpp[tiflash] | table:sli-gauge-metric | tiflash_task:{proc max:1.61s, min:656.1ms, avg: 1.13s, p80:1.61s, p95:1.6
1s, iters:21, tasks:2, threads:16}, tiflash_scan:{dtfile:{total_scanned_packs:147, total_skipped_packs:1, total_scanned_rows:1035088, total_skipped_rows:7681, tota
l_rs_index_load_time: 0ms, total_read_time: 22349ms}, total_create_snapshot_time: 0ms, total_local_region_num: 0, total_remote_region_num: 0} | keep order:false   
              | N/A      | N/A     |
+----------------------------+------------+---------+--------------+------------------------+----------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------+----------------
------------------+----------+---------+
4 rows in set (1 min 3.57 sec)
  • No code

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
Copy link
Member Author

ti-chi-bot commented Feb 2, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • XuHuaiyu
  • guo-shaoge

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/cherry-pick-not-approved size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-6.5 This PR is cherry-picked to release-6.5 from a source PR. labels Feb 2, 2023
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 2, 2023
@VelocityLight VelocityLight added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Feb 2, 2023
@wshwsh12 wshwsh12 force-pushed the cherry-pick-40901-to-release-6.5 branch from de86e8b to 3d2b00d Compare February 2, 2023 16:00
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 2, 2023
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 13, 2023
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 13, 2023
@wshwsh12
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member Author

This pull request has been accepted and is ready to merge.

Commit hash: 3d2b00d

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 13, 2023
@wshwsh12
Copy link
Contributor

/retest

@ti-chi-bot ti-chi-bot merged commit 5f9f3c9 into pingcap:release-6.5 Feb 15, 2023
@VelocityLight VelocityLight added do-not-merge/cherry-pick-not-approved and removed cherry-pick-approved Cherry pick PR approved by release team. labels Mar 13, 2023
@VelocityLight VelocityLight added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. 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. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/cherry-pick-for-release-6.5 This PR is cherry-picked to release-6.5 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants