Skip to content

Commit

Permalink
add some comments
Browse files Browse the repository at this point in the history
Signed-off-by: shirly <[email protected]>
  • Loading branch information
AndreMouche committed Jul 6, 2022
1 parent be56bfa commit f093308
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/schedule/placement/fit.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ func fitRegion(stores []*core.StoreInfo, region *core.RegionInfo, rules []*Rule)
}

type fitWorker struct {
stores []*core.StoreInfo
bestFit RegionFit // update during execution
peers []*fitPeer // p.selected is updated during execution.
rules []*Rule
Expand Down Expand Up @@ -193,7 +192,6 @@ func newFitWorker(stores []*core.StoreInfo, region *core.RegionInfo, rules []*Ru
}

return &fitWorker{
stores: stores,
bestFit: RegionFit{RuleFits: make([]*RuleFit, len(rules))},
peers: peers,
rulesMatchCache: matchRules,
Expand Down Expand Up @@ -225,7 +223,12 @@ func (w *fitWorker) fitRule(index int) bool {

var candidates []*fitPeer
if matchPeers, exist := w.rulesMatchCache[index]; exist {
// Only consider stores:
// 1. Match label constraints
// 2. Role match, or can match after transformed.
// 3. Not selected by other rules.
for idx, p := range w.peers {
// Not selected by other rules.
if p.selected {
continue
}
Expand Down

0 comments on commit f093308

Please sign in to comment.