Esempio n. 1
0
// shouldRebalance returns whether the specified store is overweight
// according to the cluster mean and should rebalance a range.
func (a allocator) shouldRebalance(s *proto.StoreDescriptor) bool {
	sl := a.storePool.getStoreList(*s.CombinedAttrs(), a.deterministic)

	if sl.used.mean < minFractionUsedThreshold {
		return s.Capacity.RangeCount > int32(math.Ceil(sl.count.mean))
	}
	return s.Capacity.FractionUsed() > sl.used.mean
}
Esempio n. 2
0
// ShouldRebalance returns whether the specified store is overweight
// according to the cluster mean and should rebalance a range.
func (a *allocator) ShouldRebalance(s *proto.StoreDescriptor) bool {
	a.Lock()
	defer a.Unlock()
	sl := a.getStoreList(*s.CombinedAttrs())

	if sl.used.mean < minFractionUsedThreshold {
		return s.Capacity.RangeCount > int32(math.Ceil(sl.count.mean))
	}
	return s.Capacity.FractionUsed() > sl.used.mean
}