Skip to content

ddl: introduce a new system variable to control the store-write-bwlimit when ingesting (#57145)#57374

Merged
ti-chi-bot[bot] merged 1 commit intopingcap:release-6.5from
ti-chi-bot:cherry-pick-57145-to-release-6.5
Feb 5, 2025
Merged

ddl: introduce a new system variable to control the store-write-bwlimit when ingesting (#57145)#57374
ti-chi-bot[bot] merged 1 commit intopingcap:release-6.5from
ti-chi-bot:cherry-pick-57145-to-release-6.5

Conversation

@ti-chi-bot
Copy link
Member

@ti-chi-bot ti-chi-bot commented Nov 14, 2024

This is an automated cherry-pick of #57145

What problem does this PR solve?

Issue Number: close #57156

Problem Summary:

See the issue description

What changed and how does it work?

Introduce a new system variable to control the store-write-bwlimit when ingesting

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Manual test:

  1. bootstrap a cluster
  2. prepare 1M rows data
  3. Turn on tidb_ddl_enable_fast_reorg, do the following test:
    1. set the tidb_ddl_reorg_max_write_speed to 0
    2. add an index for a table, the speed is fast
    3. after setting the tidb_ddl_reorg_max_write_speed to a lower value, the speed of adding index decreases
TiDB root@127.0.0.1:test> select @@global.tidb_ddl_enable_fast_reorg
+-------------------------------------+
| @@global.tidb_ddl_enable_fast_reorg |
+-------------------------------------+
| 1                                   |
+-------------------------------------+
1 row in set
Time: 0.007s
TiDB root@127.0.0.1:test> select @@global.tidb_ddl_reorg_max_write_speed
+-----------------------------------------+
| @@global.tidb_ddl_reorg_max_write_speed |
+-----------------------------------------+
| 0                                       |
+-----------------------------------------+
1 row in set
Time: 0.008s
TiDB root@127.0.0.1:test> CREATE INDEX idx_data ON test.t1 (data)
Query OK, 0 rows affected
Time: 8.763s
TiDB root@127.0.0.1:test> set @@global.tidb_ddl_reorg_max_write_speed = '64mb';
Query OK, 0 rows affected
Time: 0.026s
TiDB root@127.0.0.1:test> alter table t1 drop index idx_data;
Query OK, 0 rows affected
Time: 0.284s
TiDB root@127.0.0.1:test> CREATE INDEX idx_data ON test.t1 (data)
Query OK, 0 rows affected
Time: 13.417s
TiDB root@127.0.0.1:test> set @@global.tidb_ddl_reorg_max_write_speed = '32mb';
Query OK, 0 rows affected
Time: 0.010s
TiDB root@127.0.0.1:test> alter table t1 drop index idx_data;
Query OK, 0 rows affected
Time: 0.276s
TiDB root@127.0.0.1:test> CREATE INDEX idx_data ON test.t1 (data)
Query OK, 0 rows affected
Time: 21.856s
TiDB root@127.0.0.1:test> set @@global.tidb_ddl_reorg_max_write_speed = '16mb';
Query OK, 0 rows affected
Time: 0.022s
TiDB root@127.0.0.1:test> alter table t1 drop index idx_data;
Query OK, 0 rows affected
Time: 0.297s
TiDB root@127.0.0.1:test> CREATE INDEX idx_data ON test.t1 (data)
Query OK, 0 rows affected
Time: 38.944s
TiDB root@127.0.0.1:test> set @@global.tidb_ddl_reorg_max_write_speed = '8mb';
Query OK, 0 rows affected
Time: 0.011s
TiDB root@127.0.0.1:test> alter table t1 drop index idx_data;
^[[AQuery OK, 0 rows affected
Time: 0.312s
TiDB root@127.0.0.1:test> CREATE INDEX idx_data ON test.t1 (data)
Query OK, 0 rows affected
Time: 73.773s
TiDB root@127.0.0.1:test> set @@global.tidb_ddl_reorg_max_write_speed = '4mb';
Query OK, 0 rows affected
Time: 0.014s
TiDB root@127.0.0.1:test> alter table t1 drop index idx_data;
Query OK, 0 rows affected
Time: 0.273s
TiDB root@127.0.0.1:test> CREATE INDEX idx_data ON test.t1 (data)
Query OK, 0 rows affected
Time: 143.147s
TiDB root@127.0.0.1:test> set @@global.tidb_ddl_reorg_max_write_speed = '2mb';
Query OK, 0 rows affected
Time: 0.017s
TiDB root@127.0.0.1:test> alter table t1 drop index idx_data;
^[[AQuery OK, 0 rows affected
Time: 0.288s
TiDB root@127.0.0.1:test> CREATE INDEX idx_data ON test.t1 (data)
Query OK, 0 rows affected
Time: 281.794s
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

Please refer to Release Notes Language Style Guide to write a quality release note.

Add a system variable tidb_ddl_reorg_max_write_speed to limit the speed of ingesting when adding index
增加系统变量 tidb_ddl_reorg_max_write_speed 来限制加索引时 ingesting 的速度上限

@ti-chi-bot ti-chi-bot requested a review from a team as a code owner November 14, 2024 05:53
@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. labels Nov 14, 2024
@ti-chi-bot ti-chi-bot bot added do-not-merge/cherry-pick-not-approved cherry-pick-approved Cherry pick PR approved by release team. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed do-not-merge/cherry-pick-not-approved size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 14, 2024
@CbcWestwolf CbcWestwolf force-pushed the cherry-pick-57145-to-release-6.5 branch from 60c8871 to e74d060 Compare November 14, 2024 09:05
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 14, 2024
@CbcWestwolf
Copy link
Member

/retest

@codecov
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 64.70588% with 6 lines in your changes missing coverage. Please review.

Please upload report for BASE (release-6.5@ae4703a). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-6.5     #57374   +/-   ##
================================================
  Coverage               ?   74.1515%           
================================================
  Files                  ?       1097           
  Lines                  ?     356806           
  Branches               ?          0           
================================================
  Hits                   ?     264577           
  Misses                 ?      75672           
  Partials               ?      16557           

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 10, 2024
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 24, 2025

@yudongusa: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

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 the lgtm label Feb 5, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 5, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CbcWestwolf, jackysp, yudongusa

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 [CbcWestwolf,jackysp]

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 Feb 5, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 5, 2025

[LGTM Timeline notifier]

Timeline:

  • 2024-12-10 08:45:07.834492073 +0000 UTC m=+341697.923294614: ☑️ agreed by CbcWestwolf.
  • 2025-02-05 02:25:40.917586723 +0000 UTC m=+238612.449998736: ☑️ agreed by jackysp.

@ti-chi-bot ti-chi-bot bot merged commit 0bb7df5 into pingcap:release-6.5 Feb 5, 2025
8 checks passed
@CbcWestwolf CbcWestwolf deleted the cherry-pick-57145-to-release-6.5 branch February 5, 2025 03:13
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-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.

4 participants