-
Notifications
You must be signed in to change notification settings - Fork 289
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
base: release-multi-source
Are you sure you want to change the base?
master/scheduler: support rebalancer #5078
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
ef6a114
to
4d242ec
Compare
/run-verify-ci |
/run-unit-test |
dm/dm/master/scheduler/balancer.go
Outdated
case hasLoadTaskByWorkerAndSource(w.BaseInfo().Name, source): | ||
score = hasLoadTaskWeight | ||
case hasRelay: | ||
score = 100 - float32(len(relayWorkers[source])) + rand.Float32() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you give some simple explanations as note about score
, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 232f2b2
dm/dm/master/scheduler/scheduler.go
Outdated
s.updateStatusToUnbound(bound.Source) | ||
unbounds = append(unbounds, bound.Source) | ||
// 4. unbound for the source. | ||
boundSourcesByWeight := s.balance.GetWorkerBoundsByWeight(w, s.relayWorkers, s.hasLoadTaskByWorkerAndSource) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this bounds
need to be sorted by score
? is it for rebound source in order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I want to try to rebound for high priority sources first.
dm/dm/master/scheduler/scheduler.go
Outdated
@@ -2219,8 +2230,6 @@ func (s *Scheduler) tryBoundForWorker(w *Worker) (bounded bool, err error) { | |||
// caller should update the s.unbounds. | |||
// caller should make sure this source has source config. | |||
func (s *Scheduler) tryBoundForSource(source string) (bool, error) { | |||
var worker *Worker | |||
|
|||
// TODO: change this to pick a worker which has the least load. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO: change this to pick a worker which has the least load. |
dm/dm/master/scheduler/scheduler.go
Outdated
@@ -2251,6 +2281,7 @@ func (s *Scheduler) tryBoundForSource(source string) (bool, error) { | |||
} | |||
} | |||
if worker == nil { | |||
boundSourcesNum := sourceNum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here seems that will pick a relayworker which len(w.Bounds())
is least, Maybe we can put the log outside the loop at here
dm/dm/master/scheduler/scheduler.go
Outdated
} | ||
|
||
if worker == nil { | ||
boundSourcesNum := sourceNum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## release-multi-source #5078 +/- ##
=========================================================
Coverage ? 56.4107%
=========================================================
Files ? 527
Lines ? 69813
Branches ? 0
=========================================================
Hits ? 39382
Misses ? 26692
Partials ? 3739 |
What problem does this PR solve?
Issue Number: close #5053
What is changed and how it works?
support rebalancer interface and tableNumberRebalancer in dm. This interface will periodically pick victim sources, sort them in orders and try to pick up workers for these sources.
Check List
Tests
Code changes
Side effects
Related changes
Release note