Skip to content

Commit

Permalink
use high priority for the hot region related operators (#1492)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx authored Apr 8, 2019
1 parent 2d3d7fb commit cffb759
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 8 additions & 2 deletions server/schedulers/hot_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
}
Expand All @@ -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}
}
Expand All @@ -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}
}
}
}
Expand Down

0 comments on commit cffb759

Please sign in to comment.