@@ -113,17 +113,15 @@ func (g *TableRegionSizeGetterImpl) GetTableRegionSize(ctx context.Context, tabl
113113func (local * Backend ) SplitAndScatterRegionInBatches (
114114 ctx context.Context ,
115115 ranges []Range ,
116- tableInfo * checkpoints.TidbTableInfo ,
117116 needSplit bool ,
118- regionSplitSize int64 ,
119117 batchCnt int ,
120118) error {
121119 for i := 0 ; i < len (ranges ); i += batchCnt {
122120 batch := ranges [i :]
123121 if len (batch ) > batchCnt {
124122 batch = batch [:batchCnt ]
125123 }
126- if err := local .SplitAndScatterRegionByRanges (ctx , batch , tableInfo , needSplit , regionSplitSize ); err != nil {
124+ if err := local .SplitAndScatterRegionByRanges (ctx , batch , needSplit ); err != nil {
127125 return errors .Trace (err )
128126 }
129127 }
@@ -137,9 +135,7 @@ func (local *Backend) SplitAndScatterRegionInBatches(
137135func (local * Backend ) SplitAndScatterRegionByRanges (
138136 ctx context.Context ,
139137 ranges []Range ,
140- tableInfo * checkpoints.TidbTableInfo ,
141138 needSplit bool ,
142- regionSplitSize int64 ,
143139) (err error ) {
144140 if len (ranges ) == 0 {
145141 return nil
@@ -160,7 +156,6 @@ func (local *Backend) SplitAndScatterRegionByRanges(
160156 scatterRegions := make ([]* split.RegionInfo , 0 )
161157 var retryKeys [][]byte
162158 waitTime := splitRegionBaseBackOffTime
163- skippedKeys := 0
164159 for i := 0 ; i < splitRetryTimes ; i ++ {
165160 log .FromContext (ctx ).Info ("split and scatter region" ,
166161 logutil .Key ("minKey" , minKey ),
@@ -222,16 +217,6 @@ func (local *Backend) SplitAndScatterRegionByRanges(
222217 return nil
223218 }
224219
225- var tableRegionStats map [uint64 ]int64
226- if tableInfo != nil {
227- tableRegionStats , err = local .regionSizeGetter .GetTableRegionSize (ctx , tableInfo .ID )
228- if err != nil {
229- log .FromContext (ctx ).Warn ("fetch table region size statistics failed" ,
230- zap .String ("table" , tableInfo .Name ), zap .Error (err ))
231- tableRegionStats , err = make (map [uint64 ]int64 ), nil
232- }
233- }
234-
235220 regionMap := make (map [uint64 ]* split.RegionInfo )
236221 for _ , region := range regions {
237222 regionMap [region .Region .GetId ()] = region
@@ -342,15 +327,6 @@ func (local *Backend) SplitAndScatterRegionByRanges(
342327 }
343328 sendLoop:
344329 for regionID , keys := range splitKeyMap {
345- // if region not in tableRegionStats, that means this region is newly split, so
346- // we can skip split it again.
347- regionSize , ok := tableRegionStats [regionID ]
348- if ! ok {
349- log .FromContext (ctx ).Warn ("region stats not found" , zap .Uint64 ("region" , regionID ))
350- }
351- if len (keys ) == 1 && regionSize < regionSplitSize {
352- skippedKeys ++
353- }
354330 select {
355331 case ch <- & splitInfo {region : regionMap [regionID ], keys : keys }:
356332 case <- ctx .Done ():
@@ -386,11 +362,9 @@ func (local *Backend) SplitAndScatterRegionByRanges(
386362 scatterCount , err := local .waitForScatterRegions (ctx , scatterRegions )
387363 if scatterCount == len (scatterRegions ) {
388364 log .FromContext (ctx ).Info ("waiting for scattering regions done" ,
389- zap .Int ("skipped_keys" , skippedKeys ),
390365 zap .Int ("regions" , len (scatterRegions )), zap .Duration ("take" , time .Since (startTime )))
391366 } else {
392367 log .FromContext (ctx ).Info ("waiting for scattering regions timeout" ,
393- zap .Int ("skipped_keys" , skippedKeys ),
394368 zap .Int ("scatterCount" , scatterCount ),
395369 zap .Int ("regions" , len (scatterRegions )),
396370 zap .Duration ("take" , time .Since (startTime )),
0 commit comments