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: dynamically adjusting the concurrency and batch size of reorganization job #57468

Merged
merged 24 commits into from
Nov 21, 2024

Conversation

fzzf678
Copy link
Contributor

@fzzf678 fzzf678 commented Nov 18, 2024

What problem does this PR solve?

Issue Number: ref #57229 #57526

Problem Summary:

What changed and how does it work?

Dynamically adjust the worker count and batch size for the reorganization DDL job. A background goroutine checks and updates the worker count every 2 seconds. The batch size is evaluated and adjusted as needed before processing each chunk of data.

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.

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 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 Nov 18, 2024
Copy link

tiprow bot commented Nov 18, 2024

Hi @fzzf678. 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 Nov 18, 2024

Codecov Report

Attention: Patch coverage is 62.04380% with 52 lines in your changes missing coverage. Please review.

Project coverage is 74.8176%. Comparing base (5e6b818) to head (ff941ec).
Report is 8 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #57468        +/-   ##
================================================
+ Coverage   72.7875%   74.8176%   +2.0300%     
================================================
  Files          1676       1721        +45     
  Lines        463667     472204      +8537     
================================================
+ Hits         337492     353292     +15800     
+ Misses       105328      96775      -8553     
- Partials      20847      22137      +1290     
Flag Coverage Δ
integration 49.2934% <18.2481%> (?)
unit 72.3249% <62.0438%> (+0.1378%) ⬆️

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

Components Coverage Δ
dumpling 52.7673% <ø> (ø)
parser ∅ <ø> (∅)
br 61.0221% <ø> (+15.5897%) ⬆️
---- 🚨 Try these New Features:

@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 19, 2024
@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Nov 20, 2024
pkg/ddl/backfilling.go Outdated Show resolved Hide resolved
pkg/ddl/backfilling.go Outdated Show resolved Hide resolved
fzzf678 and others added 2 commits November 21, 2024 11:17
Co-authored-by: tangenta <tangenta@126.com>
Co-authored-by: tangenta <tangenta@126.com>
pkg/meta/model/reorg.go Outdated Show resolved Hide resolved
pkg/meta/model/reorg.go Outdated Show resolved Hide resolved
pkg/meta/model/reorg.go Outdated Show resolved Hide resolved
// These two variables are used to control the concurrency and batch size of the reorganization process.
// They can be adjusted dynamically through `admin alter ddl jobs` command.
// Note: Don't get or set these two variables directly, use the functions instead.
Concurrency int64 `json:"concurrency"`
Copy link
Member

Choose a reason for hiding this comment

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

Can we make these two fields private?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course these fields should be private, maybe later we can refactor this part and turn it private.

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

ti-chi-bot bot commented Nov 21, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CbcWestwolf, 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 approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 21, 2024
Copy link

ti-chi-bot bot commented Nov 21, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-21 06:59:48.423419512 +0000 UTC m=+101376.043074025: ☑️ agreed by CbcWestwolf.
  • 2024-11-21 07:46:06.038634619 +0000 UTC m=+104153.658289136: ☑️ agreed by tangenta.

@ti-chi-bot ti-chi-bot bot merged commit 2f8d1f6 into pingcap:master Nov 21, 2024
25 checks passed
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 21, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #57607.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants