MCPcopy
hub / github.com/pingcap/tidb / TestClusterIndexSplitTable

Function TestClusterIndexSplitTable

pkg/executor/split_test.go:393–485  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

391}
392
393func TestClusterIndexSplitTable(t *testing.T) {
394 tbInfo := &model.TableInfo{
395 Name: pmodel.NewCIStr("t"),
396 ID: 1,
397 IsCommonHandle: true,
398 CommonHandleVersion: 1,
399 Indices: []*model.IndexInfo{
400 {
401 ID: 1,
402 Primary: true,
403 State: model.StatePublic,
404 Columns: []*model.IndexColumn{
405 {Offset: 1},
406 {Offset: 2},
407 },
408 },
409 },
410 Columns: []*model.ColumnInfo{
411 {
412 Name: pmodel.NewCIStr("c0"),
413 ID: 1,
414 Offset: 0,
415 State: model.StatePublic,
416 FieldType: *types.NewFieldType(mysql.TypeDouble),
417 },
418 {
419 Name: pmodel.NewCIStr("c1"),
420 ID: 2,
421 Offset: 1,
422 State: model.StatePublic,
423 FieldType: *types.NewFieldType(mysql.TypeLonglong),
424 },
425 {
426 Name: pmodel.NewCIStr("c2"),
427 ID: 3,
428 Offset: 2,
429 State: model.StatePublic,
430 FieldType: *types.NewFieldType(mysql.TypeLonglong),
431 },
432 },
433 }
434 defer func(originValue int64) {
435 minRegionStepValue = originValue
436 }(minRegionStepValue)
437 minRegionStepValue = 3
438 ctx := mock.NewContext()
439 e := &SplitTableRegionExec{
440 BaseExecutor: exec.NewBaseExecutor(ctx, nil, 0),
441 tableInfo: tbInfo,
442 handleCols: buildHandleColsForSplit(tbInfo),
443 lower: types.MakeDatums(1, 0),
444 upper: types.MakeDatums(1, 100),
445 num: 10,
446 }
447 valueList, err := e.getSplitTableKeys()
448 require.NoError(t, err)
449 require.Len(t, valueList, e.num-1)
450

Callers

nothing calls this directly

Calls 13

getSplitTableKeysMethod · 0.95
NewFieldTypeFunction · 0.92
NewContextFunction · 0.92
NewBaseExecutorFunction · 0.92
MakeDatumsFunction · 0.92
GenTableRecordPrefixFunction · 0.92
NewStmtCtxWithTimeZoneFunction · 0.92
EncodeRecordKeyFunction · 0.92
buildHandleColsForSplitFunction · 0.85
searchLessEqualIdxFunction · 0.85
LenMethod · 0.65
BuildHandleByDatumsMethod · 0.65

Tested by

no test coverage detected