Skip to content

Commit

Permalink
bugfix: dup transfer target (#101)
Browse files Browse the repository at this point in the history
* bugfix: dup transfer target
  • Loading branch information
RayHuangCN authored Jul 5, 2022
1 parent d9ecc75 commit a4e638f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/coordinator/rebalance.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
)

const (
minWaitScrapeTimes = 2
minWaitScrapeTimes = 0
)

type shardInfo struct {
Expand Down Expand Up @@ -330,7 +330,7 @@ func (c *Coordinator) alleviateShardHeadSeries(s *shardInfo, changeAbleShards []
}

if os.runtime.HeadSeries+tar.Series < c.option.MaxHeadSeries {
c.log.Infof("transfer target from %s to %s series = (%d) ", s.shard.ID, os.shard.ID, tar.Series)
c.log.Infof("need transfer target %d, from %s to %s series = (%d) ", hash, s.shard.ID, os.shard.ID, tar.Series)
transferTarget(s, os, hash)
total -= tar.Series
break
Expand Down Expand Up @@ -376,9 +376,10 @@ func (c *Coordinator) alleviateShardProcessSeries(s *shardInfo, changeAbleShards

if (c.option.MaxHeadSeries == 0 || os.runtime.HeadSeries+tar.Series < c.option.MaxHeadSeries) &&
(os.runtime.ProcessSeries+tar.TotalSeries < c.option.MaxProcessSeries) {
c.log.Infof("transfer target from %s to %s series = (%d) ", s.shard.ID, os.shard.ID, tar.Series)
c.log.Infof("need transfer %d target from %s to %s series = (%d) ", hash, s.shard.ID, os.shard.ID, tar.Series)
transferTarget(s, os, hash)
total -= tar.TotalSeries
break
}
}
}
Expand Down

0 comments on commit a4e638f

Please sign in to comment.