Skip to content

dxf: start scheduler without reserve resource in nextgen (#63205)#63214

Merged
ti-chi-bot[bot] merged 2 commits into
pingcap:release-nextgen-20250815from
ti-chi-bot:cherry-pick-63205-to-release-nextgen-20250815
Aug 27, 2025
Merged

dxf: start scheduler without reserve resource in nextgen (#63205)#63214
ti-chi-bot[bot] merged 2 commits into
pingcap:release-nextgen-20250815from
ti-chi-bot:cherry-pick-63205-to-release-nextgen-20250815

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #63205

What problem does this PR solve?

Issue Number: ref #61702

Problem Summary:

What changed and how does it work?

in nextgen kernel, node resource will be scaled automatically by cluster controller which will use the schedule status API to make sure the required resource is available

also fix the integration tests in disttask pkg when run in nextgen

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

apply below diff

code diff
diff --git a/pkg/disttask/importinto/task_executor.go b/pkg/disttask/importinto/task_executor.go
index b774fe62df..f3923d5846 100644
--- a/pkg/disttask/importinto/task_executor.go
+++ b/pkg/disttask/importinto/task_executor.go
@@ -172,6 +172,7 @@ func (s *importStepExecutor) Add(bytes, rowCnt int64) {
 }
 
 func (s *importStepExecutor) RunSubtask(ctx context.Context, subtask *proto.Subtask) (err error) {
+	time.Sleep(time.Minute)
 	logger := s.logger.With(zap.Int64("subtask-id", subtask.ID))
 	task := log.BeginTask(logger, "run subtask")
 	defer func() {
diff --git a/pkg/executor/importer/import.go b/pkg/executor/importer/import.go
index 68b2dfa6c2..5ec5f13442 100644
--- a/pkg/executor/importer/import.go
+++ b/pkg/executor/importer/import.go
@@ -615,7 +615,7 @@ func (e *LoadDataController) checkFieldParams() error {
 func (p *Plan) initDefaultOptions(ctx context.Context, targetNodeCPUCnt int, store tidbkv.Storage) {
 	var threadCnt int
 	if kerneltype.IsNextGen() {
-		threadCnt = scheduler.CalcConcurrencyByDataSize(p.TotalFileSize, targetNodeCPUCnt)
+		threadCnt = 7
 	} else {
 		threadCnt = int(math.Max(1, float64(targetNodeCPUCnt)*0.5))
 		if p.DataSourceType == DataSourceTypeQuery {

run below script

create table t(id int); create table t1(id int);
import into t from 's3://mybucket/a.csv?access-key=minioadmin&secret-access-key=minioadmin&endpoint=http%3a%2f%2f0.0.0.0%3a9000' with detached;
select sleep(1);
select id,state,step,type,concurrency,max_node_count from mysql.tidb_global_task;
import into t1 from 's3://mybucket/a.csv?access-key=minioadmin&secret-access-key=minioadmin&endpoint=http%3a%2f%2f0.0.0.0%3a9000' with detached;
select sleep(1);
select id,state,step,type,concurrency,max_node_count from mysql.tidb_global_task;

before this PR, in the 2 queries of mysql.tidb_global_task;, we can see the second task is not scheduled

+----+---------+------+------------+-------------+----------------+
| id | state   | step | type       | concurrency | max_node_count |
+----+---------+------+------------+-------------+----------------+
|  1 | running |    1 | ImportInto |           7 |              1 |
+----+---------+------+------------+-------------+----------------+
...
+----+---------+------+------------+-------------+----------------+
| id | state   | step | type       | concurrency | max_node_count |
+----+---------+------+------------+-------------+----------------+
|  1 | running |    1 | ImportInto |           7 |              1 |
|  2 | pending |   -1 | ImportInto |           7 |              1 |
+----+---------+------+------------+-------------+----------------+

and the result of schedule status, we can see required_count is 1

➜  tikv-worker-test curl localhost:20080/dxf/schedule/status
{
 "version": 1,
 "task_queue": {
  "scheduled_count": 1
 },
 "tidb_worker": {
  "cpu_count": 10,
  "required_count": 1,
  "current_count": 1,
  "busy_nodes": [
   {
    "id": "192.168.206.85:5000",
    "is_owner": true
   }
  ]
 },
 "tikv_worker": {
  "required_count": 1
 }
}%

after this PR, in the 2 queries of mysql.tidb_global_task;, we can see both tasks are scheduled

+----+---------+------+------------+-------------+----------------+
| id | state   | step | type       | concurrency | max_node_count |
+----+---------+------+------------+-------------+----------------+
|  1 | running |    1 | ImportInto |           7 |              1 |
+----+---------+------+------------+-------------+----------------+
1 row in set (0.01 sec)

....

+----+---------+------+------------+-------------+----------------+
| id | state   | step | type       | concurrency | max_node_count |
+----+---------+------+------------+-------------+----------------+
|  1 | running |    1 | ImportInto |           7 |              1 |
|  2 | running |    1 | ImportInto |           7 |              1 |
+----+---------+------+------------+-------------+----------------+
2 rows in set (0.01 sec)

and the result of schedule status, we can see required_count is 2

➜  tikv-worker-test curl localhost:20080/dxf/schedule/status
{
 "version": 1,
 "task_queue": {
  "scheduled_count": 2
 },
 "tidb_worker": {
  "cpu_count": 10,
  "required_count": 2,
  "current_count": 1,
  "busy_nodes": [
   {
    "id": "192.168.206.85:5000",
    "is_owner": true
   }
  ]
 },
 "tikv_worker": {
  "required_count": 2
 }
}%
  • 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

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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. type/cherry-pick-for-release-nextgen-20250815 labels Aug 26, 2025
@ti-chi-bot

Copy link
Copy Markdown
Member Author

@D3Hunter This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot

ti-chi-bot Bot commented Aug 26, 2025

Copy link
Copy Markdown

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

Details

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot Bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 26, 2025
@D3Hunter

Copy link
Copy Markdown
Contributor

/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 Aug 26, 2025
@D3Hunter

Copy link
Copy Markdown
Contributor

/retest

@ti-chi-bot

ti-chi-bot Bot commented Aug 27, 2025

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

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

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 Aug 27, 2025
@ti-chi-bot

ti-chi-bot Bot commented Aug 27, 2025

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2025-08-26 13:57:30.153448475 +0000 UTC m=+275742.031279429: ☑️ agreed by D3Hunter.
  • 2025-08-27 01:48:52.661453234 +0000 UTC m=+318424.539284188: ☑️ agreed by joechenrh.

@ti-chi-bot ti-chi-bot Bot merged commit 67938bd into pingcap:release-nextgen-20250815 Aug 27, 2025
5 checks passed
@ti-chi-bot ti-chi-bot Bot deleted the cherry-pick-63205-to-release-nextgen-20250815 branch August 27, 2025 01:52
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. type/cherry-pick-for-release-nextgen-20250815

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants