Skip to content

Conversation

tangenta
Copy link
Contributor

What problem does this PR solve?

Issue Number: ref #49008

Problem Summary:

We didn't consider disk space for each subtask when implementing DXF. In the following enhancement, we may utilize the local storage for global sort, it requires managing the disk usage resource.

What changed and how does it work?

  • Add disk space to NodeResource.
  • Move NodeResource from package taskexecutor to proto.

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 Feb 18, 2025
Copy link

tiprow bot commented Feb 18, 2025

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 Feb 18, 2025

Codecov Report

Attention: Patch coverage is 69.79167% with 29 lines in your changes missing coverage. Please review.

Project coverage is 74.6811%. Comparing base (575408d) to head (7df986f).
Report is 20 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #59607        +/-   ##
================================================
+ Coverage   73.0112%   74.6811%   +1.6698%     
================================================
  Files          1694       1742        +48     
  Lines        468361     479073     +10712     
================================================
+ Hits         341956     357777     +15821     
+ Misses       105382      98726      -6656     
- Partials      21023      22570      +1547     
Flag Coverage Δ
integration 48.8136% <40.6593%> (?)
unit 72.1693% <69.7916%> (-0.0559%) ⬇️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 60.7764% <ø> (+15.5877%) ⬆️

}

// GetTaskDiskResource gets available disk for a task.
func (nr *NodeResource) GetTaskDiskResource(concurrency int, quotaHint uint64) uint64 {
Copy link
Contributor

Choose a reason for hiding this comment

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

is quotaHint used to allocate less resource for some task? why do we need it if we cannot allow some task to alloc more resource?

and it should be part of StepResource, no need a special API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

StepResource is only used by the step executor. We need to know the resource in the scheduler before splitting subtasks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is quotaHint used to allocate less resource for some task?

Yes.

why do we need it if we cannot allow some task to alloc more resource?

Because other factors may affect the resource allocation, for example, @@tidb_ddl_disk_quota can change dynamically.

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 resource per slot for a subtask is always <= the mount of disk per slot = D, seems ok to just use D, no need to adjust

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 can't determine which one is larger, tidb_ddl_disk_quota or actual disk capacity. For example, a user has a 2TB node, but only wants to use 500GB for DXF, then the user can set tidb_ddl_disk_quota to 500GB

Copy link
Contributor

Choose a reason for hiding this comment

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

no need to consider tidb_ddl_disk_quota, we can always use the total_disk we got by inspecting disk stat.

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

Comment on lines 170 to 171
nodeRes := proto.NewNodeResource(16, 32*units.GiB)
exeMgr, err := taskexecutor.NewManager(c.Ctx, id, c.TaskMgr, nodeRes)
Copy link
Contributor

Choose a reason for hiding this comment

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

in TestDXFContext, the cpu count is a input param that's passed to github.com/pingcap/tidb/pkg/util/cpu/mockNumCpu",, the new node need also conform to this

see newTestDXFContext

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 20, 2025
Copy link
Member

@CbcWestwolf CbcWestwolf left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Feb 20, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CbcWestwolf, D3Hunter

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 Feb 20, 2025
Copy link

ti-chi-bot bot commented Feb 20, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-02-20 07:56:01.803131416 +0000 UTC m=+1120804.199353472: ☑️ agreed by D3Hunter.
  • 2025-02-20 08:37:23.919280922 +0000 UTC m=+1123286.315502980: ☑️ agreed by CbcWestwolf.

@ti-chi-bot ti-chi-bot bot merged commit 811be5a into pingcap:master Feb 20, 2025
26 of 27 checks passed
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