Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Jul 16, 2024
1 parent bd4ca79 commit ae0778f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
7 changes: 4 additions & 3 deletions pkg/schedule/checker/checker_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import (

const (
checkSuspectRangesInterval = 100 * time.Millisecond
// DefaultWaitingCacheSize is the default length of waiting list.
DefaultWaitingCacheSize = 100000
// DefaultPendingRegionCacheSize is the default length of waiting list.
DefaultPendingRegionCacheSize = 100000
// For 1,024,000 regions, patrolScanRegionLimit is 1000, which is max(patrolScanRegionMinLimit, 1,024,000/patrolRegionPartition)
// It takes about 10s to iterate 1,024,000 regions(with DefaultPatrolRegionInterval=10ms) where other steps are not considered.
patrolScanRegionMinLimit = 128
Expand Down Expand Up @@ -75,8 +75,9 @@ type Controller struct {

// NewController create a new Controller.
func NewController(ctx context.Context, cluster sche.CheckerCluster, conf config.CheckerConfigProvider, ruleManager *placement.RuleManager, labeler *labeler.RegionLabeler, opController *operator.Controller) *Controller {
pendingProcessedRegions := cache.NewDefaultCache(DefaultWaitingCacheSize)
pendingProcessedRegions := cache.NewDefaultCache(DefaultPendingRegionCacheSize)
return &Controller{
ctx: ctx,
cluster: cluster,
conf: conf,
opController: opController,
Expand Down
28 changes: 14 additions & 14 deletions pkg/schedule/checker/rule_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,23 @@ var (
// RuleChecker fix/improve region by placement rules.
type RuleChecker struct {
PauseController
cluster sche.CheckerCluster
ruleManager *placement.RuleManager
regionWaitingList cache.Cache
pendingList cache.Cache
switchWitnessCache *cache.TTLUint64
record *recorder
cluster sche.CheckerCluster
ruleManager *placement.RuleManager
pendingProcessedRegions cache.Cache
pendingList cache.Cache
switchWitnessCache *cache.TTLUint64
record *recorder
}

// NewRuleChecker creates a checker instance.
func NewRuleChecker(ctx context.Context, cluster sche.CheckerCluster, ruleManager *placement.RuleManager, regionWaitingList cache.Cache) *RuleChecker {
func NewRuleChecker(ctx context.Context, cluster sche.CheckerCluster, ruleManager *placement.RuleManager, pendingProcessedRegions cache.Cache) *RuleChecker {
return &RuleChecker{
cluster: cluster,
ruleManager: ruleManager,
regionWaitingList: regionWaitingList,
pendingList: cache.NewDefaultCache(maxPendingListLen),
switchWitnessCache: cache.NewIDTTL(ctx, time.Minute, cluster.GetCheckerConfig().GetSwitchWitnessInterval()),
record: newRecord(),
cluster: cluster,
ruleManager: ruleManager,
pendingProcessedRegions: pendingProcessedRegions,
pendingList: cache.NewDefaultCache(maxPendingListLen),
switchWitnessCache: cache.NewIDTTL(ctx, time.Minute, cluster.GetCheckerConfig().GetSwitchWitnessInterval()),
record: newRecord(),
}
}

Expand Down Expand Up @@ -637,7 +637,7 @@ func (c *RuleChecker) getRuleFitStores(rf *placement.RuleFit) []*core.StoreInfo

func (c *RuleChecker) handleFilterState(region *core.RegionInfo, filterByTempState bool) {
if filterByTempState {
c.regionWaitingList.Put(region.GetID(), nil)
c.pendingProcessedRegions.Put(region.GetID(), nil)
c.pendingList.Remove(region.GetID())
} else {
c.pendingList.Put(region.GetID(), nil)
Expand Down

0 comments on commit ae0778f

Please sign in to comment.