Skip to content

Commit

Permalink
scheduler: add source filter to transferLeaderIn
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Sep 12, 2024
1 parent d6751dd commit 154a6af
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/schedulers/balance_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,13 @@ func (l *balanceLeaderScheduler) transferLeaderIn(solver *solver, collector *pla
if leaderFilter := filter.NewPlacementLeaderSafeguard(l.GetName(), opts, solver.GetBasicCluster(), solver.GetRuleManager(), solver.region, solver.source, false /*allowMoveLeader*/); leaderFilter != nil {
finalFilters = append(l.filters, leaderFilter)
}
sources := filter.NewCandidates([]*core.StoreInfo{solver.source}).
FilterSource(opts, nil, l.filterCounter, finalFilters...).PickAll()
if len(sources) == 0 {
log.Debug("store cannot be used as source", zap.String("scheduler", l.GetName()), zap.Uint64("store-id", solver.source.GetID()))
schedulerCounter.WithLabelValues(l.GetName(), "store-source-filtered").Inc()
return nil
}
target := filter.NewCandidates([]*core.StoreInfo{solver.target}).
FilterTarget(opts, nil, l.filterCounter, finalFilters...).
PickFirst()
Expand Down

0 comments on commit 154a6af

Please sign in to comment.