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: rename dispatcher to scheduler #49182

Merged
merged 12 commits into from
Dec 13, 2023

Conversation

okJiang
Copy link
Member

@okJiang okJiang commented Dec 5, 2023

What problem does this PR solve?

Issue Number: close #49125

Problem Summary:

What changed and how does it work?

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 do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 5, 2023
@okJiang
Copy link
Member Author

okJiang commented Dec 5, 2023

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Dec 5, 2023
@@ -153,7 +153,7 @@ func TestBackfillingDispatcherGlobalSortMode(t *testing.T) {
ctx = util.WithInternalSourceType(ctx, "handle")
mgr := storage.NewTaskManager(pool)
storage.SetTaskManager(mgr)
dspManager, err := dispatcher.NewManager(util.WithInternalSourceType(ctx, "dispatcher"), mgr, "host:port")
dspManager, err := scheduler.NewManager(util.WithInternalSourceType(ctx, "scheduler"), mgr, "host:port")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
dspManager, err := scheduler.NewManager(util.WithInternalSourceType(ctx, "scheduler"), mgr, "host:port")
scheManager, err := scheduler.NewManager(util.WithInternalSourceType(ctx, "scheduler"), mgr, "host:port")

pkg/disttask/framework/scheduler/rebalance_test.go Outdated Show resolved Hide resolved
@@ -51,11 +51,11 @@ func (dm *Manager) getRunningTaskCnt() int {
return len(dm.runningTasks.taskIDs)
}

func (dm *Manager) setRunningTask(task *proto.Task, dispatcher Dispatcher) {
func (dm *Manager) setRunningTask(task *proto.Task, scheduler Scheduler) {
dm.runningTasks.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

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

sm

}

// refreshTask fetch task state from tidb_global_task table.
func (d *BaseDispatcher) refreshTask() error {
func (d *BaseScheduler) refreshTask() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func (d *BaseScheduler) refreshTask() error {
func (s *BaseScheduler) refreshTask() error {

@@ -975,7 +975,7 @@ func (stm *TaskManager) TransferTasks2History(ctx context.Context, tasks []*prot
return stm.WithNewTxn(ctx, func(se sessionctx.Context) error {
insertSQL := new(strings.Builder)
if err := sqlescape.FormatSQL(insertSQL, "replace into mysql.tidb_global_task_history"+
"(id, task_key, type, dispatcher_id, state, priority, start_time, state_update_time,"+
"(id, task_key, type, scheduler_id, state, priority, start_time, state_update_time,"+
Copy link
Contributor

Choose a reason for hiding this comment

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

won't pass the test

@@ -61,7 +61,7 @@ func (s *importIntoSuite) TestDispatcherGetEligibleInstances() {
}
mockedAllServerInfos := makeFailpointRes(serverInfoMap)

dsp := ImportDispatcherExt{}
dsp := ImportSchedulerExt{}
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Merging #49182 (3d6ce4c) into master (9322568) will increase coverage by 0.6815%.
The diff coverage is 13.8702%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #49182        +/-   ##
================================================
+ Coverage   71.0517%   71.7332%   +0.6815%     
================================================
  Files          1368       1414        +46     
  Lines        401578     414951     +13373     
================================================
+ Hits         285328     297658     +12330     
- Misses        96418      98491      +2073     
+ Partials      19832      18802      -1030     
Flag Coverage Δ
integration 43.7506% <13.8702%> (?)
unit 71.0561% <ø> (+0.0044%) ⬆️

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

Components Coverage Δ
dumpling 53.9663% <ø> (ø)
parser ∅ <ø> (∅)
br 47.9117% <ø> (-4.9818%) ⬇️

@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 11, 2023
Copy link

ti-chi-bot bot commented Dec 11, 2023

PR needs rebase.

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.

@okJiang okJiang closed this Dec 12, 2023
@ti-chi-bot ti-chi-bot bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 12, 2023
@okJiang okJiang reopened this Dec 12, 2023
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 12, 2023
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 12, 2023
@@ -573,7 +573,7 @@ const (
id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
task_key VARCHAR(256) NOT NULL,
type VARCHAR(256) NOT NULL,
dispatcher_id VARCHAR(256),
scheduler_id VARCHAR(256),
Copy link
Member Author

Choose a reason for hiding this comment

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

the table field will update later, better not in this pr

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 12, 2023
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

@@ -25,9 +25,9 @@ ERROR 1062 (23000): Duplicate entry '?' for key '?'

And its corresponding log is:
```
[2020/10/20 11:45:37.796 +08:00] [INFO] [conn.go:800] ["command dispatched failed"] [conn=5] [connInfo="id:5, addr:127.0.0.1:57222 status:10, collation:utf8_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="insert into t values (1),(1)"] [txn_mode=OPTIMISTIC] [err="[kv:1062]Duplicate entry '1' for key 'a'"]
[2020/10/20 11:45:37.796 +08:00] [INFO] [conn.go:800] ["command scheduled failed"] [conn=5] [connInfo="id:5, addr:127.0.0.1:57222 status:10, collation:utf8_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="insert into t values (1),(1)"] [txn_mode=OPTIMISTIC] [err="[kv:1062]Duplicate entry '1' for key 'a'"]
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not part of disttask

@@ -50,13 +50,13 @@ import (

var (
addingDDLJobConcurrent = "/tidb/ddl/add_ddl_job_general"
dispatchLoopWaitingDuration = 1 * time.Second
Copy link
Contributor

Choose a reason for hiding this comment

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

seems this is not part of framework

Copy link

ti-chi-bot bot commented Dec 13, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

ti-chi-bot bot commented Dec 13, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-12 08:45:42.292789551 +0000 UTC m=+345833.330016463: ☑️ agreed by ywqzzy.
  • 2023-12-13 02:45:52.649976827 +0000 UTC m=+410643.687203754: ☑️ agreed by D3Hunter.

@ti-chi-bot ti-chi-bot bot merged commit 64430c3 into pingcap:master Dec 13, 2023
16 checks passed
@okJiang okJiang deleted the rename-dispatcher branch December 13, 2023 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rename old dispatcher to scheduler
4 participants