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

Method buildCleanupIndex

pkg/executor/builder.go:661–701  ·  view source on GitHub ↗
(v *plannercore.CleanupIndex)

Source from the content-addressed store, hash-verified

659}
660
661func (b *executorBuilder) buildCleanupIndex(v *plannercore.CleanupIndex) exec.Executor {
662 tblInfo := v.Table.TableInfo
663 t, err := b.is.TableByName(context.Background(), v.Table.Schema, tblInfo.Name)
664 if err != nil {
665 b.err = err
666 return nil
667 }
668 idxName := strings.ToLower(v.IndexName)
669 var index table.Index
670 for _, idx := range t.Indices() {
671 if idx.Meta().State != model.StatePublic {
672 continue
673 }
674 if idxName == idx.Meta().Name.L {
675 index = idx
676 break
677 }
678 }
679
680 if index == nil {
681 b.err = errors.Errorf("secondary index `%v` is not found in table `%v`", v.IndexName, v.Table.Name.O)
682 return nil
683 }
684 if index.Meta().VectorInfo != nil {
685 b.err = errors.Errorf("vector index `%v` is not supported for cleanup index", v.IndexName)
686 return nil
687 }
688 e := &CleanupIndexExec{
689 BaseExecutor: exec.NewBaseExecutor(b.ctx, v.Schema(), v.ID()),
690 columns: buildIdxColsConcatHandleCols(tblInfo, index.Meta(), false),
691 index: index,
692 table: t,
693 physicalID: t.Meta().ID,
694 batchSize: 20000,
695 }
696 e.handleCols = buildHandleColsForExec(tblInfo, e.columns)
697 if e.index.Meta().Global {
698 e.columns = append(e.columns, model.NewExtraPhysTblIDColInfo())
699 }
700 return e
701}
702
703func (b *executorBuilder) buildCheckIndexRange(v *plannercore.CheckIndexRange) exec.Executor {
704 tb, err := b.is.TableByName(context.Background(), v.Table.Schema, v.Table.Name)

Callers 1

buildMethod · 0.95

Calls 10

MetaMethod · 0.95
NewBaseExecutorFunction · 0.92
buildHandleColsForExecFunction · 0.85
TableByNameMethod · 0.65
ToLowerMethod · 0.65
IndicesMethod · 0.65
ErrorfMethod · 0.65
SchemaMethod · 0.65
IDMethod · 0.65

Tested by

no test coverage detected