Skip to content

Process streams of partition tables one by one in MultiplexInputStream (#8507)#8522

Merged
ti-chi-bot[bot] merged 3 commits intopingcap:release-7.1from
ti-chi-bot:cherry-pick-8507-to-release-7.1
Dec 15, 2023
Merged

Process streams of partition tables one by one in MultiplexInputStream (#8507)#8522
ti-chi-bot[bot] merged 3 commits intopingcap:release-7.1from
ti-chi-bot:cherry-pick-8507-to-release-7.1

Conversation

@ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #8507

What problem does this PR solve?

Issue Number: close #8505

Problem Summary:
See #8505.

What is changed and how it works?

In the previous code, many streams of different partition tables may be processed concurrently. This PR simply fixes it by processing streams of partition tables one by one.

Check List

Tests

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

create a table with 36 partitions.
Test SQL select * from employees.

mysql> explain analyze select * from employees;
+-------------------------+--------------+-----------+--------------+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------+---------+------+
| id                      | estRows      | actRows   | task         | access object   | execution info                                                                                                                                                                                                                                                                                                                                                                                                    | operator info                             | memory  | disk |
+-------------------------+--------------+-----------+--------------+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------+---------+------+
| TableReader_11          | 436207616.00 | 603979776 | root         | partition:all   | time:13.4s, loops:590554, RU:0.000000, cop_task: {num: 10160, max: 0s, min: 0s, avg: 0s, p95: 0s, copr_cache_hit_ratio: 0.00}                                                                                                                                                                                                                                                                                     | MppVersion: 1, data:ExchangeSender_10     | 7.92 MB | N/A  |
| └─ExchangeSender_10     | 436207616.00 | 603979776 | mpp[tiflash] |                 | tiflash_task:{proc max:12.9s, min:12.6s, avg: 12.7s, p80:12.9s, p95:12.9s, iters:10283, tasks:2, threads:72}                                                                                                                                                                                                                                                                                                      | ExchangeType: PassThrough                 | N/A     | N/A  |
|   └─TableFullScan_9     | 436207616.00 | 603979776 | mpp[tiflash] | table:employees | tiflash_task:{proc max:137.4ms, min:121ms, avg: 129.2ms, p80:137.4ms, p95:137.4ms, iters:10283, tasks:2, threads:72}, tiflash_scan:{dtfile:{total_scanned_packs:94981, total_skipped_packs:15416, total_scanned_rows:774644749, total_skipped_rows:125859659, total_rs_index_load_time: 0ms, total_read_time: 35296ms}, total_create_snapshot_time: 3ms, total_local_region_num: 972, total_remote_region_num: 0} | keep order:false, PartitionTableScan:true | N/A     | N/A  |
+-------------------------+--------------+-----------+--------------+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------+---------+------+
3 rows in set (13.45 sec)
image

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

Fix potential OOM when scanning many partition tables with stream model.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-7.1 This PR is cherry-picked to release-7.1 from a source PR. labels Dec 14, 2023
@ti-chi-bot ti-chi-bot 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 Dec 14, 2023
Signed-off-by: gengliqi <gengliqiii@gmail.com>
@gengliqi gengliqi force-pushed the cherry-pick-8507-to-release-7.1 branch from 79b2755 to 691b188 Compare December 14, 2023 09:59
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 14, 2023
@ti-chi-bot ti-chi-bot bot added the lgtm label Dec 14, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gengliqi, SeaRise

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

The pull request process is described here

Details 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 removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 14, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 14, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-14 10:00:58.969660227 +0000 UTC m=+523150.006887153: ☑️ agreed by gengliqi.
  • 2023-12-14 10:01:26.619166685 +0000 UTC m=+523177.656393606: ☑️ agreed by SeaRise.

@ti-chi-bot ti-chi-bot added the cherry-pick-approved Cherry pick PR approved by release team. label Dec 15, 2023
@gengliqi
Copy link
Contributor

/run-all-tests

@ti-chi-bot ti-chi-bot bot merged commit e4a30bc into pingcap:release-7.1 Dec 15, 2023
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 Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-7.1 This PR is cherry-picked to release-7.1 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants