Skip to content

Commit

Permalink
fix target
Browse files Browse the repository at this point in the history
Signed-off-by: Song Gao <[email protected]>
  • Loading branch information
Yisaer committed Mar 16, 2021
1 parent 92ddb62 commit 510712c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions server/schedulers/hot_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,6 @@ func (bs *balanceSolver) filterDstStores() map[uint64]*storeLoadDetail {
if srcStore == nil {
return nil
}

switch bs.opTy {
case movePeer:
filters = []filter.Filter{
Expand All @@ -742,7 +741,9 @@ func (bs *balanceSolver) filterDstStores() map[uint64]*storeLoadDetail {
filter.NewPlacementSafeguard(bs.sche.GetName(), bs.cluster, bs.cur.region, srcStore),
}

candidates = bs.cluster.GetStores()
for storeID := range bs.stLoadDetail {
candidates = append(candidates, bs.cluster.GetStore(storeID))
}

case transferLeader:
filters = []filter.Filter{
Expand All @@ -753,7 +754,15 @@ func (bs *balanceSolver) filterDstStores() map[uint64]*storeLoadDetail {
filters = append(filters, leaderFilter)
}

candidates = bs.cluster.GetFollowerStores(bs.cur.region)
regionStores := make(map[uint64]*core.StoreInfo, 0)
for _, store := range bs.cluster.GetFollowerStores(bs.cur.region) {
regionStores[store.GetID()] = store
}
for storeID := range bs.stLoadDetail {
if store, ok := regionStores[storeID]; ok {
candidates = append(candidates, store)
}
}

default:
return nil
Expand Down

0 comments on commit 510712c

Please sign in to comment.