Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Oct 23, 2024
1 parent 7a9e69d commit e88938e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/schedule/schedulers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,14 @@ func (p *solver) shouldBalance(scheduleName string) bool {
}

func (p *solver) isPotentialReverse() bool {
return p.sourceScore+float64(p.sourceDelta) < p.targetScore+float64(p.targetDelta)
// p.sourceScore is considered as the source store's score after the region is moved out.
// p.targetScore is considered as the target store's score after the region is moved in.
// So original source store's score is p.sourceScore+p.sourceDelta, original target store's score is p.targetScore-p.targetDelta.
// If p.sourceScore+float64(p.sourceDelta) < p.targetScore-float64(p.targetDelta),
// it means although the source store's score is larger than the target store's score,
// after the region is moved out, the source store's score will be less than the target store's score.
// In another word, there will be a reverse after the region is moved.
return p.sourceScore+float64(p.sourceDelta) < p.targetScore-float64(p.targetDelta)
}

func (p *solver) getTolerantResource() int64 {
Expand Down

0 comments on commit e88938e

Please sign in to comment.