Skip to content

Commit

Permalink
Merge branch 'master' into refactor-checker
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot[bot] authored Nov 10, 2023
2 parents a8fed1e + b5119ea commit 3634088
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion pkg/schedule/schedulers/evict_slow_trend.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ func (conf *evictSlowTrendSchedulerConfig) getKeyRangesByID(id uint64) []core.Ke
return []core.KeyRange{core.NewKeyRange("", "")}
}

func (conf *evictSlowTrendSchedulerConfig) hasEvictedStores() bool {
return len(conf.EvictedStores) > 0
}

func (conf *evictSlowTrendSchedulerConfig) evictedStore() uint64 {
if len(conf.EvictedStores) == 0 {
if !conf.hasEvictedStores() {
return 0
}
// If a candidate passes all checks and proved to be slow, it will be
Expand Down Expand Up @@ -237,6 +241,19 @@ type evictSlowTrendScheduler struct {
handler http.Handler
}

func (s *evictSlowTrendScheduler) GetNextInterval(interval time.Duration) time.Duration {
var growthType intervalGrowthType
// If it already found a slow node as candidate, the next interval should be shorter
// to make the next scheduling as soon as possible. This adjustment will decrease the
// response time, as heartbeats from other nodes will be received and updated more quickly.
if s.conf.hasEvictedStores() {
growthType = zeroGrowth
} else {
growthType = exponentialGrowth
}
return intervalGrow(s.GetMinInterval(), MaxScheduleInterval, growthType)
}

func (s *evictSlowTrendScheduler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.handler.ServeHTTP(w, r)
}
Expand Down

0 comments on commit 3634088

Please sign in to comment.