Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lance6716 committed Jan 13, 2021
1 parent fa5f749 commit cb1f998
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dm/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ var (
func keyAdapterKeysLen(s KeyAdapter) int {
switch s {
case WorkerRegisterKeyAdapter, UpstreamConfigKeyAdapter, UpstreamBoundWorkerKeyAdapter,
WorkerKeepAliveKeyAdapter, StageRelayKeyAdapter, TaskConfigKeyAdapter:
WorkerKeepAliveKeyAdapter, StageRelayKeyAdapter, TaskConfigKeyAdapter,
UpstreamLastBoundWorkerKeyAdapter:
return 1
case UpstreamSubTaskKeyAdapter, StageSubTaskKeyAdapter,
ShardDDLPessimismInfoKeyAdapter, ShardDDLPessimismOperationKeyAdapter,
Expand Down
13 changes: 10 additions & 3 deletions dm/master/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1218,9 +1218,16 @@ func (s *Scheduler) tryBoundForSource(source string) (bool, error) {
// 1. try to find history workers, then random Free worker.
var worker *Worker
for workerName, bound := range s.lastBound {
if bound.Source == source && s.workers[workerName].Stage() == WorkerFree {
worker = s.workers[workerName]
break
if bound.Source == source {
w, ok := s.workers[workerName]
if !ok {
// a not found worker
continue
}
if w.Stage() == WorkerFree {
worker = w
break
}
}
}

Expand Down

0 comments on commit cb1f998

Please sign in to comment.