// ScatterRegionsByRange directly scatter regions by ScatterRegions
ScatterRegionsByRange directly scatter regions by ScatterRegions
// ScatterRegionsByRange directly scatter regions by ScatterRegions
func (r *RegionScatterer) ScatterRegionsByRange(startKey, endKey []byte, group string, retryLimit int) ([]*operator.Operator, map[uint64]error, error) {
	regions := r.cluster.ScanRegions(startKey, endKey, -1)
	if len(regions) < 1 {
		scatterCounter.WithLabelValues("skip", "empty-region").Inc()
		return nil, nil, errors.New("empty region")
	}
	failures := make(map[uint64]error, len(regions))
	regionMap := make(map[uint64]*core.RegionInfo, len(regions))
	for _, region := range regions {
		regionMap[region.GetID()] = region
	}
	ops, err := r.ScatterRegions(regionMap, failures, group, retryLimit)
	if err != nil {
		return nil, nil, err
	}
	return ops, failures, nil
}
func ( r * RegionScatterer ) ScatterRegionsByRange ( startKey , endKey [ ] byte , group string , retryLimit int ) ( [ ] * operator . Operator , map [ uint64 ] error , error ) { regions := r . cluster . ScanRegions ( startKey , endKey , - 1 ) if len ( regions ) < 1 { scatterCounter . WithLabelValues ( " " , " " ) . Inc ( ) return nil , nil , errors . New ( " " ) } failures := make ( map [ uint64 ] error , len ( regions ) ) regionMap := make ( map [ uint64 ] * core . RegionInfo , len ( regions ) ) for _ , region := range regions { regionMap [ region . GetID ( ) ] = region } ops , err := r . ScatterRegions ( regionMap , failures , group , retryLimit ) if err != nil { return nil , nil , err } return ops , failures , nil }
ScatterRegionsByRange directly scatter regions by ScatterRegions
ScatterRegionsByRange directly scatter regions by ScatterRegions
// If there existed any region failed to relocated after retry, add it into unProcessedRegions