From 4d1b357dd287d8b3fb2721bd91e8ee2cb2803862 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Wed, 3 Apr 2019 15:33:10 +0800 Subject: [PATCH] use high priority for the hot region related operators Signed-off-by: Ryan Leung --- server/config.go | 4 ++-- server/schedulers/hot_region.go | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/server/config.go b/server/config.go index d478476fc69..a4858a6d197 100644 --- a/server/config.go +++ b/server/config.go @@ -564,7 +564,7 @@ const ( defaultHighSpaceRatio = 0.6 // defaultHotRegionCacheHitsThreshold is the low hit number threshold of the // hot region. - defautHotRegionCacheHitsThreshold = 3 + defaultHotRegionCacheHitsThreshold = 3 ) func (c *ScheduleConfig) adjust(meta *configMetaData) error { @@ -599,7 +599,7 @@ func (c *ScheduleConfig) adjust(meta *configMetaData) error { adjustUint64(&c.HotRegionScheduleLimit, defaultHotRegionScheduleLimit) } if !meta.IsDefined("hot-region-cache-hits-threshold") { - adjustUint64(&c.HotRegionCacheHitsThreshold, defautHotRegionCacheHitsThreshold) + adjustUint64(&c.HotRegionCacheHitsThreshold, defaultHotRegionCacheHitsThreshold) } if !meta.IsDefined("tolerant-size-ratio") { adjustFloat64(&c.TolerantSizeRatio, defaultTolerantSizeRatio) diff --git a/server/schedulers/hot_region.go b/server/schedulers/hot_region.go index b044edc41ff..de4bf0b554d 100644 --- a/server/schedulers/hot_region.go +++ b/server/schedulers/hot_region.go @@ -166,7 +166,9 @@ func (h *balanceHotRegionsScheduler) balanceHotReadRegions(cluster schedule.Clus if srcRegion != nil { schedulerCounter.WithLabelValues(h.GetName(), "move_leader").Inc() step := schedule.TransferLeader{FromStore: srcRegion.GetLeader().GetStoreId(), ToStore: newLeader.GetStoreId()} - return []*schedule.Operator{schedule.NewOperator("transferHotReadLeader", srcRegion.GetID(), srcRegion.GetRegionEpoch(), schedule.OpHotRegion|schedule.OpLeader, step)} + op := schedule.NewOperator("transferHotReadLeader", srcRegion.GetID(), srcRegion.GetRegionEpoch(), schedule.OpHotRegion|schedule.OpLeader, step) + op.SetPriorityLevel(core.HighPriority) + return []*schedule.Operator{op} } // balance by peer @@ -177,6 +179,7 @@ func (h *balanceHotRegionsScheduler) balanceHotReadRegions(cluster schedule.Clus schedulerCounter.WithLabelValues(h.GetName(), "create_operator_fail").Inc() return nil } + op.SetPriorityLevel(core.HighPriority) schedulerCounter.WithLabelValues(h.GetName(), "move_peer").Inc() return []*schedule.Operator{op} } @@ -199,6 +202,7 @@ func (h *balanceHotRegionsScheduler) balanceHotWriteRegions(cluster schedule.Clu schedulerCounter.WithLabelValues(h.GetName(), "create_operator_fail").Inc() return nil } + op.SetPriorityLevel(core.HighPriority) schedulerCounter.WithLabelValues(h.GetName(), "move_peer").Inc() return []*schedule.Operator{op} } @@ -208,7 +212,9 @@ func (h *balanceHotRegionsScheduler) balanceHotWriteRegions(cluster schedule.Clu if srcRegion != nil { schedulerCounter.WithLabelValues(h.GetName(), "move_leader").Inc() step := schedule.TransferLeader{FromStore: srcRegion.GetLeader().GetStoreId(), ToStore: newLeader.GetStoreId()} - return []*schedule.Operator{schedule.NewOperator("transferHotWriteLeader", srcRegion.GetID(), srcRegion.GetRegionEpoch(), schedule.OpHotRegion|schedule.OpLeader, step)} + op := schedule.NewOperator("transferHotWriteLeader", srcRegion.GetID(), srcRegion.GetRegionEpoch(), schedule.OpHotRegion|schedule.OpLeader, step) + op.SetPriorityLevel(core.HighPriority) + return []*schedule.Operator{op} } } }