Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fix_tikv_11463
Browse files Browse the repository at this point in the history
Signed-off-by: p4tr1ck <patricknicholas@foxmail.com>
  • Loading branch information
w41ter committed Dec 13, 2021
2 parents e9f4179 + 5211ada commit d6c55d2
Show file tree
Hide file tree
Showing 8 changed files with 362 additions and 327 deletions.
2 changes: 1 addition & 1 deletion server/cluster/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ func (c *coordinator) stop() {
// TODO: remove it.
type hasHotStatus interface {
GetHotStatus(statistics.RWType) *statistics.StoreHotPeersInfos
GetPendingInfluence() map[uint64]*schedulers.Influence
GetPendingInfluence() map[uint64]*statistics.Influence
}

func (c *coordinator) getHotWriteRegions() *statistics.StoreHotPeersInfos {
Expand Down
12 changes: 6 additions & 6 deletions server/schedulers/grant_hot_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ type grantHotRegionScheduler struct {
conf *grantHotRegionSchedulerConfig
handler http.Handler
types []statistics.RWType
stLoadInfos [resourceTypeLen]map[uint64]*storeLoadDetail
stLoadInfos [resourceTypeLen]map[uint64]*statistics.StoreLoadDetail
}

// newGrantHotRegionScheduler creates an admin scheduler that transfers hot region peer to fixed store and hot region leader to one store.
Expand All @@ -174,7 +174,7 @@ func newGrantHotRegionScheduler(opController *schedule.OperatorController, conf
types: []statistics.RWType{statistics.Read, statistics.Write},
}
for ty := resourceType(0); ty < resourceTypeLen; ty++ {
ret.stLoadInfos[ty] = map[uint64]*storeLoadDetail{}
ret.stLoadInfos[ty] = map[uint64]*statistics.StoreLoadDetail{}
}
return ret
}
Expand Down Expand Up @@ -274,11 +274,11 @@ func (s *grantHotRegionScheduler) Schedule(cluster opt.Cluster) []*operator.Oper
}

func (s *grantHotRegionScheduler) dispatch(typ statistics.RWType, cluster opt.Cluster) []*operator.Operator {
storeInfos := summaryStoreInfos(cluster)
storeInfos := statistics.SummaryStoreInfos(cluster)
storesLoads := cluster.GetStoresLoads()
isTraceRegionFlow := cluster.GetOpts().IsTraceRegionFlow()

var stLoadInfos map[uint64]*storeLoadDetail
var stLoadInfos map[uint64]*statistics.StoreLoadDetail
switch typ {
case statistics.Read:
stLoadInfos = summaryStoresLoad(
Expand All @@ -295,7 +295,7 @@ func (s *grantHotRegionScheduler) dispatch(typ statistics.RWType, cluster opt.Cl
isTraceRegionFlow,
statistics.Write, core.RegionKind)
}
infos := make([]*storeLoadDetail, len(stLoadInfos))
infos := make([]*statistics.StoreLoadDetail, len(stLoadInfos))
index := 0
for _, info := range stLoadInfos {
infos[index] = info
Expand All @@ -307,7 +307,7 @@ func (s *grantHotRegionScheduler) dispatch(typ statistics.RWType, cluster opt.Cl
return s.randomSchedule(cluster, infos)
}

func (s *grantHotRegionScheduler) randomSchedule(cluster opt.Cluster, infos []*storeLoadDetail) (ops []*operator.Operator) {
func (s *grantHotRegionScheduler) randomSchedule(cluster opt.Cluster, infos []*statistics.StoreLoadDetail) (ops []*operator.Operator) {
isleader := s.r.Int()%2 == 1
for _, detail := range infos {
srcStoreID := detail.Info.Store.GetID()
Expand Down
Loading

0 comments on commit d6c55d2

Please sign in to comment.