@@ -113,17 +113,15 @@ func (g *TableRegionSizeGetterImpl) GetTableRegionSize(ctx context.Context, tabl
113
113
func (local * Backend ) SplitAndScatterRegionInBatches (
114
114
ctx context.Context ,
115
115
ranges []Range ,
116
- tableInfo * checkpoints.TidbTableInfo ,
117
116
needSplit bool ,
118
- regionSplitSize int64 ,
119
117
batchCnt int ,
120
118
) error {
121
119
for i := 0 ; i < len (ranges ); i += batchCnt {
122
120
batch := ranges [i :]
123
121
if len (batch ) > batchCnt {
124
122
batch = batch [:batchCnt ]
125
123
}
126
- if err := local .SplitAndScatterRegionByRanges (ctx , batch , tableInfo , needSplit , regionSplitSize ); err != nil {
124
+ if err := local .SplitAndScatterRegionByRanges (ctx , batch , needSplit ); err != nil {
127
125
return errors .Trace (err )
128
126
}
129
127
}
@@ -137,9 +135,7 @@ func (local *Backend) SplitAndScatterRegionInBatches(
137
135
func (local * Backend ) SplitAndScatterRegionByRanges (
138
136
ctx context.Context ,
139
137
ranges []Range ,
140
- tableInfo * checkpoints.TidbTableInfo ,
141
138
needSplit bool ,
142
- regionSplitSize int64 ,
143
139
) (err error ) {
144
140
if len (ranges ) == 0 {
145
141
return nil
@@ -160,7 +156,6 @@ func (local *Backend) SplitAndScatterRegionByRanges(
160
156
scatterRegions := make ([]* split.RegionInfo , 0 )
161
157
var retryKeys [][]byte
162
158
waitTime := splitRegionBaseBackOffTime
163
- skippedKeys := 0
164
159
for i := 0 ; i < splitRetryTimes ; i ++ {
165
160
log .FromContext (ctx ).Info ("split and scatter region" ,
166
161
logutil .Key ("minKey" , minKey ),
@@ -222,16 +217,6 @@ func (local *Backend) SplitAndScatterRegionByRanges(
222
217
return nil
223
218
}
224
219
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
-
235
220
regionMap := make (map [uint64 ]* split.RegionInfo )
236
221
for _ , region := range regions {
237
222
regionMap [region .Region .GetId ()] = region
@@ -342,15 +327,6 @@ func (local *Backend) SplitAndScatterRegionByRanges(
342
327
}
343
328
sendLoop:
344
329
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
- }
354
330
select {
355
331
case ch <- & splitInfo {region : regionMap [regionID ], keys : keys }:
356
332
case <- ctx .Done ():
@@ -386,11 +362,9 @@ func (local *Backend) SplitAndScatterRegionByRanges(
386
362
scatterCount , err := local .waitForScatterRegions (ctx , scatterRegions )
387
363
if scatterCount == len (scatterRegions ) {
388
364
log .FromContext (ctx ).Info ("waiting for scattering regions done" ,
389
- zap .Int ("skipped_keys" , skippedKeys ),
390
365
zap .Int ("regions" , len (scatterRegions )), zap .Duration ("take" , time .Since (startTime )))
391
366
} else {
392
367
log .FromContext (ctx ).Info ("waiting for scattering regions timeout" ,
393
- zap .Int ("skipped_keys" , skippedKeys ),
394
368
zap .Int ("scatterCount" , scatterCount ),
395
369
zap .Int ("regions" , len (scatterRegions )),
396
370
zap .Duration ("take" , time .Since (startTime )),
0 commit comments