Skip to content

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

Merged
ti-chi-bot[bot] merged 3 commits intopingcap:release-6.5-20231215-v6.5.3from
ti-chi-bot:cherry-pick-8521-to-release-6.5-20231215-v6.5.3
Dec 15, 2023
Merged

Process streams of partition tables one by one in MultiplexInputStream (#8507) (#8521)#8527
ti-chi-bot[bot] merged 3 commits intopingcap:release-6.5-20231215-v6.5.3from
ti-chi-bot:cherry-pick-8521-to-release-6.5-20231215-v6.5.3

Conversation

@ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #8521

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.

@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/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. type/cherry-pick-for-release-6.5-20231215-v6.5.3 labels Dec 15, 2023
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 15, 2023
Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 15, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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:
  • OWNERS [gengliqi,windtalker]

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 Dec 15, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 15, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-15 03:12:04.730906265 +0000 UTC m=+585015.768133193: ☑️ agreed by gengliqi.
  • 2023-12-15 03:14:11.724519916 +0000 UTC m=+585142.761746828: ☑️ agreed by windtalker.

@gengliqi
Copy link
Contributor

/run-all-tests

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 15, 2023

@ti-chi-bot: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

trigger some heavy tests which will not run always when PR updated.

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Details

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 ti-community-infra/tichi repository.

@gengliqi
Copy link
Contributor

/run-integration-test tidb=release-6.5

@gengliqi
Copy link
Contributor

/run-unit-test tidb=release-6.5

1 similar comment
@gengliqi
Copy link
Contributor

/run-unit-test tidb=release-6.5

@gengliqi
Copy link
Contributor

/run-integration-test tidb=release-6.5

@gengliqi
Copy link
Contributor

/run-unit-test tidb=release-6.5

1 similar comment
@gengliqi
Copy link
Contributor

/run-unit-test tidb=release-6.5

@ti-chi-bot ti-chi-bot bot merged commit 913134e into pingcap:release-6.5-20231215-v6.5.3 Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved 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-6.5-20231215-v6.5.3 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.

3 participants