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

schedule: fix panic during hot schedule #3483

Merged
merged 2 commits into from
Mar 17, 2021
Merged
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
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)
}
}
Yisaer marked this conversation as resolved.
Show resolved Hide resolved

default:
return nil
Expand Down