Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
Signed-off-by: HunDunDM <[email protected]>
  • Loading branch information
HunDunDM committed Aug 3, 2021
1 parent 1304132 commit d226c5a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions server/schedulers/hot_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,14 +461,14 @@ func (bs *balanceSolver) filterSrcStores() map[uint64]*storeLoadDetail {
if bs.rwTy != write || bs.opTy != movePeer {
continue
}
srcToleranceRatio = 0
srcToleranceRatio += 0.1
}
if len(detail.HotPeers) == 0 {
continue
}

minLoad := detail.LoadPred.min()
if bs.checkSrcByDimPriorityAndTolerance(minLoad, &detail.LoadPred.Expect) {
if bs.checkSrcByDimPriorityAndTolerance(minLoad, &detail.LoadPred.Expect, srcToleranceRatio) {
ret[id] = detail
hotSchedulerResultCounter.WithLabelValues("src-store-succ", strconv.FormatUint(id, 10)).Inc()
} else {
Expand All @@ -478,11 +478,11 @@ func (bs *balanceSolver) filterSrcStores() map[uint64]*storeLoadDetail {
return ret
}

func (bs *balanceSolver) checkSrcByDimPriorityAndTolerance(minLoad, expectLoad *storeLoad) bool {
func (bs *balanceSolver) checkSrcByDimPriorityAndTolerance(minLoad, expectLoad *storeLoad, toleranceRatio float64) bool {
if bs.sche.conf.StrictPickingStore {
return slice.AllOf(minLoad.Loads, func(i int) bool {
if bs.isSelectedDim(i) {
return minLoad.Loads[i] > bs.sche.conf.GetSrcToleranceRatio()*expectLoad.Loads[i]
return minLoad.Loads[i] > toleranceRatio*expectLoad.Loads[i]
}
return true
})
Expand Down Expand Up @@ -669,11 +669,12 @@ func (bs *balanceSolver) pickDstStores(filters []filter.Filter, candidates []*st
if bs.rwTy != write || bs.opTy != movePeer {
continue
}
dstToleranceRatio = 0
dstToleranceRatio += 0.1
}
if filter.Target(bs.cluster.GetOpts(), store, filters) {
id := store.GetID()
maxLoad := detail.LoadPred.max()
if bs.checkDstByPriorityAndTolerance(maxLoad, &detail.LoadPred.Expect) {
if bs.checkDstByPriorityAndTolerance(maxLoad, &detail.LoadPred.Expect, dstToleranceRatio) {
ret[id] = detail
hotSchedulerResultCounter.WithLabelValues("src-store-succ", strconv.FormatUint(id, 10)).Inc()
} else {
Expand All @@ -684,17 +685,16 @@ func (bs *balanceSolver) pickDstStores(filters []filter.Filter, candidates []*st
return ret
}

func (bs *balanceSolver) checkDstByPriorityAndTolerance(maxLoad, expect *storeLoad) bool {
dstToleranceRatio := bs.sche.conf.GetDstToleranceRatio()
func (bs *balanceSolver) checkDstByPriorityAndTolerance(maxLoad, expect *storeLoad, toleranceRatio float64) bool {
if bs.sche.conf.StrictPickingStore {
return slice.AllOf(maxLoad.Loads, func(i int) bool {
if bs.isSelectedDim(i) {
return maxLoad.Loads[i]*dstToleranceRatio < expect.Loads[i]
return maxLoad.Loads[i]*toleranceRatio < expect.Loads[i]
}
return true
})
}
return maxLoad.Loads[bs.firstPriority]*dstToleranceRatio < expect.Loads[bs.firstPriority]
return maxLoad.Loads[bs.firstPriority]*toleranceRatio < expect.Loads[bs.firstPriority]
}

// calcProgressiveRank calculates `bs.cur.progressiveRank`.
Expand Down

0 comments on commit d226c5a

Please sign in to comment.