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

ddl: support session level tidb_ddl_reorg_worker_cnt and batch_size #55334

Merged
merged 10 commits into from
Aug 13, 2024

Conversation

tangenta
Copy link
Contributor

@tangenta tangenta commented Aug 9, 2024

What problem does this PR solve?

Issue Number: close #55335

Problem Summary: see #55335

What changed and how does it work?

  • Add session scope support for system variables tidb_ddl_reorg_worker_cnt and tidb_ddl_reorg_batch_size.
  • For session scope variables, the value cannot be changed during DDL job execution.
  • For global scope variables, the they only provide the default values of session variables.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    Execute following SQLs on root user:
    create user 'aa'@'%' identified by '';
    create database aa;
    grant create, alter, insert on aa.* to 'aa'@'%';
    
    Switch to user 'aa'@'%':
    mysql> use aa;
    Database changed
    mysql> show tables;
    Empty set (0.00 sec)
    
    mysql> create table t (a int, b int);
    Query OK, 0 rows affected (0.07 sec)
    
    mysql> insert into t values (1, 1);
    Query OK, 1 row affected (0.03 sec)
    
    mysql> select @@global.tidb_ddl_reorg_worker_cnt;
    +------------------------------------+
    | @@global.tidb_ddl_reorg_worker_cnt |
    +------------------------------------+
    |                                  4 |
    +------------------------------------+
    1 row in set (0.00 sec)
    
    mysql> set  @@global.tidb_ddl_reorg_worker_cnt = 8;
    ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation
    mysql> set @@tidb_ddl_reorg_worker_cnt = 8;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> alter table t add index idx(a);
    Query OK, 0 rows affected (2.20 sec)
    
    Check TiDB log:
    [INFO] [executor.go:4780] ["initialize reorg meta"] [category=ddl] [jobSchema=aa] [jobTable=t] [jobType="add index"] [enableDistTask=true] [enableFastReorg=true] [targetScope=] [concurrency=8] [batchSize=256]
    
  • 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-linked-issue do-not-merge/needs-tests-checked 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 Aug 9, 2024
Copy link

tiprow bot commented Aug 9, 2024

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

codecov bot commented Aug 9, 2024

Codecov Report

Attention: Patch coverage is 95.40230% with 4 lines in your changes missing coverage. Please review.

Project coverage is 75.2401%. Comparing base (cf2c703) to head (d02c6ac).
Report is 35 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #55334        +/-   ##
================================================
+ Coverage   72.9400%   75.2401%   +2.3001%     
================================================
  Files          1570       1580        +10     
  Lines        439546     455968     +16422     
================================================
+ Hits         320605     343071     +22466     
+ Misses        99276      92037      -7239     
- Partials      19665      20860      +1195     
Flag Coverage Δ
integration 50.9464% <94.1176%> (?)
unit 71.8481% <91.8604%> (-0.1319%) ⬇️

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

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 63.1731% <ø> (+17.2976%) ⬆️

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 12, 2024
Copy link
Contributor

@D3Hunter D3Hunter left a comment

Choose a reason for hiding this comment

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

rest lgtm

pkg/ddl/backfilling_scheduler.go Outdated Show resolved Hide resolved
pkg/parser/model/reorg.go Outdated Show resolved Hide resolved
@tangenta tangenta force-pushed the add-index-sess-cnt branch from 2ea8a58 to 9e95940 Compare August 12, 2024 04:22
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 12, 2024
Copy link

ti-chi-bot bot commented Aug 12, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-12 02:25:10.73600946 +0000 UTC m=+148395.439479104: ☑️ agreed by lance6716.
  • 2024-08-12 04:27:12.06393595 +0000 UTC m=+155716.767405608: ☑️ agreed by D3Hunter.

@tangenta
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Aug 12, 2024

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

@tangenta
Copy link
Contributor Author

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Aug 12, 2024
@easonn7
Copy link

easonn7 commented Aug 13, 2024

/approve

1 similar comment
@tangenta
Copy link
Contributor Author

/approve

Copy link

ti-chi-bot bot commented Aug 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter, easonn7, lance6716, tangenta

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 the approved label Aug 13, 2024
@tangenta
Copy link
Contributor Author

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. 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.

Support session level tidb_ddl_reorg_worker_cnt and tidb_ddl_reorg_batch_size
4 participants