Skip to content

Commit

Permalink
fix: unexpect scaling up when some targets is too big during shard al…
Browse files Browse the repository at this point in the history
…leviation
  • Loading branch information
RayHuangCN committed May 18, 2021
1 parent 035a49b commit db65182
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/coordinator/rebalance.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ func newShardInfo(sd *shard.Shard) *shardInfo {

func (s *shardInfo) totalTargetsSeries() int64 {
ret := int64(0)
for _, s := range s.scraping {
if s.TargetState != target.StateNormal || s.Health != scrape.HealthGood || s.ScrapeTimes < minWaitScrapeTimes {
for _, tar := range s.scraping {
if tar.TargetState != target.StateNormal || tar.Health != scrape.HealthGood || tar.ScrapeTimes < minWaitScrapeTimes {
continue
}

ret += s.Series
ret += tar.Series
}
return ret
}
Expand Down Expand Up @@ -238,6 +238,11 @@ func (c *Coordinator) alleviateShard(s *shardInfo, changeAbleShards []*shardInfo
continue
}

if tar.Series > c.maxSeries {
c.log.Warnf("too big series [%d] series is [%d], skip alleviate", hash, tar.Series)
return 0
}

// try transfer target to other shard
for _, os := range changeAbleShards {
if os == s {
Expand Down

0 comments on commit db65182

Please sign in to comment.