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

disttask: init capacity and check concurrency using cpu count of managed node #49875

Merged
merged 9 commits into from
Jan 2, 2024

Conversation

D3Hunter
Copy link
Contributor

@D3Hunter D3Hunter commented Dec 28, 2023

What problem does this PR solve?

Issue Number: ref #49008

Problem Summary:

What changed and how does it work?

  • add cpu_count to mysql.dist_framework_meta(reusing existing ver 180)
  • use cpu-count of managed node as capacity when control resource and checking when submitting new task

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    create new and upgrade cluster, make sure new schema works
  • 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 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 Dec 28, 2023
Copy link

tiprow bot commented Dec 28, 2023

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/test-infra repository.

Comment on lines +135 to 140
for _, node := range newNodes {
nodeIDs = append(nodeIDs, node.ID)
if node.CPUCount > 0 {
cpuCount = node.CPUCount
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The cpuCount will be set equal to the last node, is it expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we assume them isomorphic, first/last makes no difference

Copy link
Member

Choose a reason for hiding this comment

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

can add a comment~

Comment on lines +175 to +179
taskMgr, err := storage.GetTaskManager()
if err != nil {
return err
}
return taskMgr.StartManagerSession(ctx, e.Ctx(), serverID, valStr)
Copy link
Contributor

Choose a reason for hiding this comment

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

If the sysvar is not set, the node won't be used for disttask.
Is it exepected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why? i just replace it from explicit sql to task_table api

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, I missunderstood the code

Copy link

codecov bot commented Dec 28, 2023

Codecov Report

Merging #49875 (60d81f3) into master (d6aeaf0) will decrease coverage by 0.9114%.
Report is 8 commits behind head on master.
The diff coverage is 64.9122%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #49875        +/-   ##
================================================
- Coverage   72.0575%   71.1462%   -0.9114%     
================================================
  Files          1437       1433         -4     
  Lines        345628     417141     +71513     
================================================
+ Hits         249051     296780     +47729     
- Misses        76506     101578     +25072     
+ Partials      20071      18783      -1288     
Flag Coverage Δ
integration 43.9051% <64.9122%> (?)
unit 70.9427% <ø> (-1.1148%) ⬇️

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

Components Coverage Δ
dumpling 53.9663% <ø> (-2.3466%) ⬇️
parser ∅ <ø> (∅)
br 46.8935% <ø> (-4.5056%) ⬇️

@@ -37,6 +39,16 @@ func TestMain(m *testing.M) {
goleak.VerifyTestMain(m, opts...)
}

func GetCPUCountOfManagedNodes(ctx context.Context, taskMgr *TaskManager) (int, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

move to util?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let's do it when it's needed

Comment on lines +175 to +179
taskMgr, err := storage.GetTaskManager()
if err != nil {
return err
}
return taskMgr.StartManagerSession(ctx, e.Ctx(), serverID, valStr)
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, I missunderstood the code

Copy link
Contributor

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

Comment on lines -50 to -52
// TODO: we assume that all nodes managed by dist framework are isomorphic,
// but dist owner might run on normal node where the capacity might not be
// able to run any task.
Copy link
Contributor

Choose a reason for hiding this comment

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

Add some comments of isomorphic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see comments in slotManager

pkg/disttask/framework/storage/task_table.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 28, 2023
rs, err := ExecSQL(ctx, se, `
select host, role, cpu_count
from mysql.dist_framework_meta
where role = 'background' or role = ''
Copy link
Member

Choose a reason for hiding this comment

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

how about removing this?

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 29, 2023
Copy link

ti-chi-bot bot commented Dec 29, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-28 06:55:20.50061185 +0000 UTC m=+1721611.537838779: ☑️ agreed by ywqzzy.
  • 2023-12-29 08:34:01.106464083 +0000 UTC m=+1813932.143691009: ☑️ agreed by okJiang.

@D3Hunter
Copy link
Contributor Author

/approve

@D3Hunter
Copy link
Contributor Author

/hold

ci fail

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 29, 2023
Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@D3Hunter
Copy link
Contributor Author

D3Hunter commented Jan 2, 2024

ci fail issue, will fix it later, #49950

@D3Hunter
Copy link
Contributor Author

D3Hunter commented Jan 2, 2024

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 2, 2024
@D3Hunter
Copy link
Contributor Author

D3Hunter commented Jan 2, 2024

/retest

Copy link

tiprow bot commented Jan 2, 2024

@D3Hunter: 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/test-infra repository.

Copy link

@yudongusa yudongusa left a comment

Choose a reason for hiding this comment

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

LGTM for now, but @Benjamin2037 please consider the version rollback design.

Copy link

ti-chi-bot bot commented Jan 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bb7133, D3Hunter, okJiang, yudongusa, ywqzzy

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 Jan 2, 2024
@ti-chi-bot ti-chi-bot bot merged commit 3d939d4 into pingcap:master Jan 2, 2024
17 checks passed
@D3Hunter D3Hunter deleted the add-server-info-fields branch January 2, 2024 05:44
@ti-chi-bot ti-chi-bot added the needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. label Feb 7, 2024
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Feb 7, 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-7.5: #51021.

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-7.5 Should cherry pick this PR to release-7.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.

6 participants