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

dxf: handle modifying task concurrency in scheduler #57673

Merged
merged 12 commits into from
Dec 2, 2024

Conversation

D3Hunter
Copy link
Contributor

@D3Hunter D3Hunter commented Nov 25, 2024

What problem does this PR solve?

Issue Number: ref #57497

Problem Summary:

What changed and how does it work?

handle modify task concurrency in scheduler

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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 25, 2024
Copy link

tiprow bot commented Nov 25, 2024

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

@D3Hunter D3Hunter changed the title dxf: handle modifying in scheduler part dxf: handle modifying in scheduler Nov 25, 2024
@D3Hunter D3Hunter changed the title dxf: handle modifying in scheduler dxf: handle modifying task concurrency in scheduler Nov 25, 2024
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 83.07692% with 11 lines in your changes missing coverage. Please review.

Project coverage is 73.2910%. Comparing base (d02d48a) to head (a644ea7).
Report is 51 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #57673        +/-   ##
================================================
+ Coverage   72.8318%   73.2910%   +0.4592%     
================================================
  Files          1677       1679         +2     
  Lines        463944     475826     +11882     
================================================
+ Hits         337899     348738     +10839     
- Misses       105169     106306      +1137     
+ Partials      20876      20782        -94     
Flag Coverage Δ
integration 44.5828% <1.7543%> (?)
unit 72.2249% <83.0769%> (+0.0011%) ⬆️

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

Components Coverage Δ
dumpling 52.7673% <ø> (ø)
parser ∅ <ø> (∅)
br 43.1377% <ø> (-2.3736%) ⬇️

Copy link
Contributor

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

will review unit test files later

pkg/disttask/framework/proto/modify.go Show resolved Hide resolved
PausedTask(ctx context.Context, taskID int64) error
// ResumedTask updated task state from resuming to running.
ResumedTask(ctx context.Context, taskID int64) error
// ModifiedTask tries to update task concurrency and meta, and update state
Copy link
Contributor

Choose a reason for hiding this comment

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

When reading it I'm not clear about

  1. Seems configurations other than concurrency, meta and state can't be modified? When we want to support more modification like Priority, we will update this comment?
  2. What's the prev_state? Now by checking the code I see it's a field of ModifyParam. I think it's better to mention how we can use fields of the parameter task *proto.Task to modify.
  3. What's the meaning of "update state back to prev-state" Back meaning there's a checking that prev-state must be a state that happened in history?

Copy link
Contributor Author

@D3Hunter D3Hunter Dec 2, 2024

Choose a reason for hiding this comment

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

  1. state is not a param, it's for changing state back to the state before modify, see this state machine https://github.com/pingcap/tidb/pull/57557/files#diff-9cbb4aa7310f95ed10a52e14e392efa29e0356b179e85efec38db8fde5dca9f3R57-R67. for priority, yes

for 2/3. see above link

// subtask might have different concurrency later, see TaskExecInfo, we
// need to handle it too, but ok for now.
_, err = sqlexec.ExecSQL(ctx, se.GetSQLExecutor(), `
update mysql.tidb_background_subtask
Copy link
Contributor

Choose a reason for hiding this comment

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

Just learning, how do we let subtask executor know the concurrency is changed?

})
})

t.Run("modify pending task concurrency, but other owner already done it", func(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The test purpose is "..but other owner already done it". Should we trigger ModifiedTask after WaitTaskDone and check the concurrency is not changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we trigger ModifiedTask after WaitTaskDone

the scenario is

  • task change to modifying state
  • owner A tried to do modify work, but before it start, another owner B finished the modify
  • owner A does nothing

check the concurrency is not changed?

on owner A, we check by AffectedRows() == 0

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

ti-chi-bot bot commented Dec 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

ti-chi-bot bot commented Dec 2, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-02 08:23:53.50750323 +0000 UTC m=+1056821.127157742: ☑️ agreed by lance6716.
  • 2024-12-02 13:17:22.86376479 +0000 UTC m=+1074430.483419307: ☑️ agreed by tangenta.

Copy link

tiprow bot commented Dec 2, 2024

@D3Hunter: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
fast_test_tiprow a644ea7 link true /test fast_test_tiprow

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@ti-chi-bot ti-chi-bot bot merged commit e631ba8 into pingcap:master Dec 2, 2024
21 of 24 checks passed
@D3Hunter D3Hunter deleted the dxf-scheduler branch December 3, 2024 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm 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.

3 participants