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

master/scheduler: support rebalancer #5078

Open
wants to merge 6 commits into
base: release-multi-source
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix lint
  • Loading branch information
lichunzhu committed May 30, 2022
commit 12502ef3208feb8fa9d3d90c5518a7bbf0659791
7 changes: 5 additions & 2 deletions dm/dm/master/scheduler/balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ import (
"github.com/pingcap/tiflow/dm/pkg/utils"
)

const sourceIDPrefix = "mysql-replica-"

func genSourceID(i int) string {
return fmt.Sprintf("mysql-replica-%d", i)
return sourceIDPrefix + strconv.Itoa(i)
}

func genSourceCfg(t *testing.T, i int) *config.SourceConfig {
Expand Down Expand Up @@ -93,7 +95,8 @@ func (t *testBalancerSuite) TearDownTest() {

func getSourceNumFromID(t *testing.T, sourceID string) int {
t.Helper()
sourceNumStr := strings.TrimLeft(sourceID, "mysql-replica-")
//nolint:staticcheck
sourceNumStr := strings.TrimLeft(sourceID, sourceIDPrefix)
sourceNum, err := strconv.Atoi(sourceNumStr)
require.NoError(t, err)
return sourceNum
Expand Down
2 changes: 1 addition & 1 deletion dm/dm/master/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func NewScheduler(pLogger *log.Logger, securityCfg config.Security) *Scheduler {
loadTasks: make(map[string]map[string]string),
securityCfg: securityCfg,
balance: newTableNumberBalancer(pLogger),
triggerRebalance: make(chan struct{}, 0),
triggerRebalance: make(chan struct{}),
}
}

Expand Down