// Scatter relocates the region. If the group is defined, the regions' leader with the same group would be scattered
// in a group level instead of cluster level.
Scatter relocates the region. If the group is defined, the regions' leader with the same group would be scattered
in a group level instead of cluster level.
// Scatter relocates the region . If the group is defined the regions ' leader with the same group would be scattered // in a group level instead of cluster level .
func (r *RegionScatterer) Scatter(region *core.RegionInfo, group string) (*operator.Operator, error) {
	if !opt.IsRegionReplicated(r.cluster, region) {
		r.cluster.AddSuspectRegions(region.GetID())
		scatterCounter.WithLabelValues("skip", "not-replicated").Inc()
		log.Warn("region not replicated during scatter", zap.Uint64("region-id", region.GetID()))
		return nil, errors.Errorf("region %d is not fully replicated", region.GetID())
	}
	if region.GetLeader() == nil {
		scatterCounter.WithLabelValues("skip", "no-leader").Inc()
		log.Warn("region no leader during scatter", zap.Uint64("region-id", region.GetID()))
		return nil, errors.Errorf("region %d has no leader", region.GetID())
	}
	if r.cluster.IsRegionHot(region) {
		scatterCounter.WithLabelValues("skip", "hot").Inc()
		log.Warn("region too hot during scatter", zap.Uint64("region-id", region.GetID()))
		return nil, errors.Errorf("region %d is hot", region.GetID())
	}
	return r.scatterRegion(region, group), nil
}
func ( r * RegionScatterer ) Scatter ( region * core . RegionInfo , group string ) ( * operator . Operator , error ) { if ! opt . IsRegionReplicated ( r . cluster , region ) { r . cluster . AddSuspectRegions ( region . GetID ( ) ) scatterCounter . WithLabelValues ( " " , " " ) . Inc ( ) log . Warn ( " " , zap . Uint64 ( " " , region . GetID ( ) ) ) return nil , errors . Errorf ( " " , region . GetID ( ) ) } if region . GetLeader ( ) == nil { scatterCounter . WithLabelValues ( " " , " " ) . Inc ( ) log . Warn ( " " , zap . Uint64 ( " " , region . GetID ( ) ) ) return nil , errors . Errorf ( " " , region . GetID ( ) ) } if r . cluster . IsRegionHot ( region ) { scatterCounter . WithLabelValues ( " " , " " ) . Inc ( ) log . Warn ( " " , zap . Uint64 ( " " , region . GetID ( ) ) ) return nil , errors . Errorf ( " " , region . GetID ( ) ) } return r . scatterRegion ( region , group ) , nil }
Scatter relocates the region.
Scatter relocates the region .