Skip to content

Commit

Permalink
address the comment
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Sep 17, 2019
1 parent c67d3c5 commit 5312c6f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions server/checker/replica_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,20 @@ type ReplicaChecker struct {
}

// NewReplicaChecker creates a replica checker.
func NewReplicaChecker(cluster schedule.Cluster, classifier namespace.Classifier) *ReplicaChecker {
func NewReplicaChecker(cluster schedule.Cluster, classifier namespace.Classifier, n ...string) *ReplicaChecker {
name := replicaCheckerName
if len(n) != 0 {
name = n[0]
}
filters := []filter.Filter{
filter.NewOverloadFilter(replicaCheckerName),
filter.NewHealthFilter(replicaCheckerName),
filter.NewSnapshotCountFilter(replicaCheckerName),
filter.NewPendingPeerCountFilter(replicaCheckerName),
filter.NewOverloadFilter(name),
filter.NewHealthFilter(name),
filter.NewSnapshotCountFilter(name),
filter.NewPendingPeerCountFilter(name),
}

return &ReplicaChecker{
name: replicaCheckerName,
name: name,
cluster: cluster,
classifier: classifier,
filters: filters,
Expand Down
2 changes: 1 addition & 1 deletion server/schedulers/balance_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (s *balanceRegionScheduler) transferPeer(cluster schedule.Cluster, region *
}
scoreGuard := filter.NewDistinctScoreFilter(s.GetName(), cluster.GetLocationLabels(), stores, source)
hitsFilter := s.hitsCounter.buildTargetFilter(s.GetName(), cluster, source)
checker := checker.NewReplicaChecker(cluster, nil)
checker := checker.NewReplicaChecker(cluster, nil, s.GetName())
storeID, _ := checker.SelectBestReplacementStore(region, oldPeer, scoreGuard, hitsFilter)
if storeID == 0 {
schedulerCounter.WithLabelValues(s.GetName(), "no_replacement").Inc()
Expand Down

0 comments on commit 5312c6f

Please sign in to comment.