Versions in this module Expand all Collapse all v1 v1.0.0 Aug 23, 2023 v0 v0.1.0 Aug 23, 2023 Changes in this version + const DDLOwnerKey + const DefNumHistoryJobs + const HistoryTable + const HistoryTableID + const HistoryTableSQL + const JobTable + const JobTableID + const JobTableSQL + const MDLTableID + const MaxCommentLength + const MaxHistoryJobs + const ReorgTable + const ReorgTableID + const ReorgTableSQL + var DDLBackfillers = map[model.ActionType]string + var EnableSplitTableRegion = uint32(0) + var MockDMLExecution func() + var MockDMLExecutionMerging func() + var MockDMLExecutionStateMerging func() + var PollTiFlashBackoffCapacity int = 1000 + var PollTiFlashBackoffMaxTick TiFlashTick = 10 + var PollTiFlashBackoffMinTick TiFlashTick = 1 + var PollTiFlashBackoffRate TiFlashTick = 1.5 + var PollTiFlashInterval = 2 * time.Second + var PullTiFlashPdTick = atomicutil.NewUint64(30 * 5) + var RefreshProgressMaxTableCount uint64 = 1000 + var ReorgWaitTimeout = 5 * time.Second + var ResultCounterForTest *atomic.Int32 + var RunInGoTest bool + var TestCheckReorgTimeout = int32(0) + var TestCheckWorkerNumCh = make(chan *sync.WaitGroup) + var TestCheckWorkerNumber = int32(1) + var TestReorgGoroutineRunning = make(chan interface{}) + var UpdateTiFlashStoreTick = atomicutil.NewUint64(5) + var WaitTimeWhenErrorOccurred = int64(1 * time.Second) + func AddHistoryDDLJob(sess *session, t *meta.Meta, job *model.Job, updateRawArgs bool, ...) error + func AddHistoryDDLJobForTest(sess sessionctx.Context, t *meta.Meta, job *model.Job, updateRawArgs bool) error + func AddIndexColumnFlag(tblInfo *model.TableInfo, indexInfo *model.IndexInfo) + func AllocateColumnID(tblInfo *model.TableInfo) int64 + func AllocateIndexID(tblInfo *model.TableInfo) int64 + func AppendPartitionDefs(partitionInfo *model.PartitionInfo, buf *bytes.Buffer, sqlMode mysql.SQLMode) + func AppendPartitionInfo(partitionInfo *model.PartitionInfo, buf *bytes.Buffer, sqlMode mysql.SQLMode) + func BuildAddedPartitionInfo(ctx sessionctx.Context, meta *model.TableInfo, spec *ast.AlterTableSpec) (*model.PartitionInfo, error) + func BuildElements(changingCol *model.ColumnInfo, changingIdxs []*model.IndexInfo) []*meta.Element + func BuildHiddenColumnInfo(ctx sessionctx.Context, indexPartSpecifications []*ast.IndexPartSpecification, ...) ([]*model.ColumnInfo, error) + func BuildIndexInfo(ctx sessionctx.Context, allTableColumns []*model.ColumnInfo, ...) (*model.IndexInfo, error) + func BuildSessionTemporaryTableInfo(ctx sessionctx.Context, is infoschema.InfoSchema, s *ast.CreateTableStmt, ...) (*model.TableInfo, error) + func BuildTableInfo(ctx sessionctx.Context, tableName model.CIStr, cols []*table.Column, ...) (tbInfo *model.TableInfo, err error) + func BuildTableInfoFromAST(s *ast.CreateTableStmt) (*model.TableInfo, error) + func BuildTableInfoWithLike(ctx sessionctx.Context, ident ast.Ident, referTblInfo *model.TableInfo, ...) (*model.TableInfo, error) + func BuildTableInfoWithStmt(ctx sessionctx.Context, s *ast.CreateTableStmt, dbCharset, dbCollate string, ...) (*model.TableInfo, error) + func BuildViewInfo(ctx sessionctx.Context, s *ast.CreateViewStmt) (*model.ViewInfo, error) + func CancelJobs(se sessionctx.Context, store kv.Storage, ids []int64) (errs []error, err error) + func CheckAfterPositionExists(tblInfo *model.TableInfo, pos *ast.ColumnPosition) error + func CheckDropIndexOnAutoIncrementColumn(tblInfo *model.TableInfo, indexInfo *model.IndexInfo) error + func CheckDropTablePartition(meta *model.TableInfo, partLowerNames []string) error + func CheckIsDropPrimaryKey(indexName model.CIStr, indexInfo *model.IndexInfo, t table.Table) (bool, error) + func CheckPKOnGeneratedColumn(tblInfo *model.TableInfo, ...) (*model.ColumnInfo, error) + func CheckPlacementPolicyNotInUseFromInfoSchema(is infoschema.InfoSchema, policy *model.PolicyInfo) error + func CheckPlacementPolicyNotInUseFromMeta(t *meta.Meta, policy *model.PolicyInfo) error + func CheckTableInfoValidWithStmt(ctx sessionctx.Context, tbInfo *model.TableInfo, s *ast.CreateTableStmt) (err error) + func CleanupDDLReorgHandles(job *model.Job, w *worker, t *meta.Meta) + func CreateNewColumn(ctx sessionctx.Context, ti ast.Ident, schema *model.DBInfo, ...) (*table.Column, error) + func DisableTiFlashPoll(d interface{}) + func DropIndexColumnFlag(tblInfo *model.TableInfo, indexInfo *model.IndexInfo) + func EnableTiFlashPoll(d interface{}) + func ExtractTblInfos(is infoschema.InfoSchema, oldIdent, newIdent ast.Ident, isAlterTable bool, ...) ([]*model.DBInfo, int64, error) + func FindColumnNamesInExpr(expr ast.ExprNode) []*ast.ColumnName + func FindRelatedIndexesToChange(tblInfo *model.TableInfo, colName model.CIStr) []changingIndex + func GeneratePartDefsFromInterval(ctx sessionctx.Context, tp ast.AlterTableType, tbInfo *model.TableInfo, ...) error + func GetAllDDLJobs(sess sessionctx.Context, t *meta.Meta) ([]*model.Job, error) + func GetAllHistoryDDLJobs(m *meta.Meta) ([]*model.Job, error) + func GetCharsetAndCollateInTableOption(startIdx int, options []*ast.TableOption) (chs, coll string, err error) + func GetColumnForeignKeyInfo(colName string, fkInfos []*model.FKInfo) *model.FKInfo + func GetCustomizedHook(s string) (func(do DomainReloader) Callback, error) + func GetDropOrTruncateTableInfoFromJobsByStore(jobs []*model.Job, gcSafePoint uint64, ...) (bool, error) + func GetFlashbackKeyRanges(sess sessionctx.Context) ([]kv.KeyRange, error) + func GetHistoryJobByID(sess sessionctx.Context, id int64) (*model.Job, error) + func GetLastHistoryDDLJobsIterator(m *meta.Meta) (meta.LastJobIterator, error) + func GetLastNHistoryDDLJobs(t *meta.Meta, maxNumJobs int) ([]*model.Job, error) + func GetModifiableColumnJob(ctx context.Context, sctx sessionctx.Context, is infoschema.InfoSchema, ...) (*model.Job, error) + func GetName4AnonymousIndex(t table.Table, colName model.CIStr, idxName model.CIStr) model.CIStr + func GetOriginDefaultValueForModifyColumn(sessCtx sessionctx.Context, changingCol, oldCol *model.ColumnInfo) (interface{}, error) + func GetTableInfoAndCancelFaultJob(t *meta.Meta, job *model.Job, schemaID int64) (*model.TableInfo, error) + func GetWaitTimeWhenErrorOccurred() time.Duration + func IngestJobsNotExisted(ctx sessionctx.Context) bool + func InitAndAddColumnToTable(tblInfo *model.TableInfo, colInfo *model.ColumnInfo) *model.ColumnInfo + func IsAutoRandomColumnID(tblInfo *model.TableInfo, colID int64) bool + func IsEnableFastReorg() bool + func IterAllDDLJobs(ctx sessionctx.Context, txn kv.Transaction, ...) error + func IterHistoryDDLJobs(txn kv.Transaction, finishFn func([]*model.Job) (bool, error)) error + func LoadTiFlashReplicaInfo(tblInfo *model.TableInfo, tableList *[]TiFlashReplicaStatus) + func LocateOffsetToMove(currentOffset int, pos *ast.ColumnPosition, tblInfo *model.TableInfo) (destOffset int, err error) + func MockTableInfo(ctx sessionctx.Context, stmt *ast.CreateTableStmt, tableID int64) (*model.TableInfo, error) + func NeedToOverwriteColCharset(options []*ast.TableOption) bool + func NewMockSchemaSyncer() syncer.SchemaSyncer + func NewReorgHandlerForTest(m *meta.Meta, sess sessionctx.Context) *reorgHandler + func OverwriteCollationWithBinaryFlag(colDef *ast.ColumnDef, chs, coll string) (newChs string, newColl string) + func RemoveDependentHiddenColumns(tblInfo *model.TableInfo, idxInfo *model.IndexInfo) + func ResolveAlterAlgorithm(alterSpec *ast.AlterTableSpec, specify ast.AlgorithmType) (ast.AlgorithmType, error) + func ResolveAlterTableSpec(ctx sessionctx.Context, specs []*ast.AlterTableSpec) ([]*ast.AlterTableSpec, error) + func ResolveCharsetCollation(charsetOpts ...ast.CharsetOpt) (string, string, error) + func ScanHistoryDDLJobs(m *meta.Meta, startJobID int64, limit int) ([]*model.Job, error) + func SendFlashbackToVersionRPC(ctx context.Context, s tikv.Storage, version uint64, startTS, commitTS uint64, ...) (rangetask.TaskStat, error) + func SendPrepareFlashbackToVersionRPC(ctx context.Context, s tikv.Storage, flashbackTS, startTS uint64, ...) (rangetask.TaskStat, error) + func SetBackfillTaskChanSizeForTest(n int) + func SetDefaultValue(ctx sessionctx.Context, col *table.Column, option *ast.ColumnOption) (bool, error) + func SetDirectPlacementOpt(placementSettings *model.PlacementSettings, ...) error + func SetIdxColNameOffset(idxCol *model.IndexColumn, changingCol *model.ColumnInfo) + func SetWaitTimeWhenErrorOccurred(dur time.Duration) + func ShouldBuildClusteredIndex(ctx sessionctx.Context, opt *ast.IndexOption, isSingleIntPK bool) bool + func SplitRecordRegion(ctx context.Context, store kv.SplittableStore, physicalTableID, tableID int64, ...) uint64 + func UpdateColsNull2NotNull(tblInfo *model.TableInfo, indexInfo *model.IndexInfo) error + func ValidateFlashbackTS(ctx context.Context, sctx sessionctx.Context, flashBackTS uint64) error + func ValidateRenameIndex(from, to model.CIStr, tbl *model.TableInfo) (ignore bool, err error) + func WaitScatterRegionFinish(ctx context.Context, store kv.SplittableStore, regionIDs ...uint64) + type AllocTableIDIf func(*model.TableInfo) bool + func (a AllocTableIDIf) Apply(c *CreateTableWithInfoConfig) + type AlterAlgorithm struct + type AvailableTableID struct + ID int64 + IsPartition bool + type BaseCallback struct + func (*BaseCallback) OnChanged(err error) error + func (*BaseCallback) OnJobRunBefore(_ *model.Job) + func (*BaseCallback) OnJobUpdated(job *model.Job) + func (*BaseCallback) OnSchemaStateChanged(schemaVer int64) + func (*BaseCallback) OnWatched(ctx context.Context) + func (c *BaseCallback) OnGetJobAfter(jobType string, job *model.Job) + func (c *BaseCallback) OnGetJobBefore(jobType string) + type BaseInterceptor struct + func (*BaseInterceptor) OnGetInfoSchema(_ sessionctx.Context, is infoschema.InfoSchema) infoschema.InfoSchema + type Callback interface + OnChanged func(err error) error + OnGetJobAfter func(jobType string, job *model.Job) + OnGetJobBefore func(jobType string) + OnJobRunBefore func(job *model.Job) + OnJobUpdated func(job *model.Job) + OnSchemaStateChanged func(schemaVer int64) + OnWatched func(ctx context.Context) + type CreateTableWithInfoConfig struct + OnExist OnExist + ShouldAllocTableID AllocTableIDIf + func GetCreateTableWithInfoConfig(cs []CreateTableWithInfoConfigurier) CreateTableWithInfoConfig + type CreateTableWithInfoConfigurier interface + Apply func(*CreateTableWithInfoConfig) + type DDL interface + AlterPlacementPolicy func(ctx sessionctx.Context, stmt *ast.AlterPlacementPolicyStmt) error + AlterSchema func(sctx sessionctx.Context, stmt *ast.AlterDatabaseStmt) error + AlterSequence func(ctx sessionctx.Context, stmt *ast.AlterSequenceStmt) error + AlterTable func(ctx context.Context, sctx sessionctx.Context, stmt *ast.AlterTableStmt) error + BatchCreateTableWithInfo func(ctx sessionctx.Context, schema model.CIStr, info []*model.TableInfo, ...) error + CleanupTableLock func(ctx sessionctx.Context, tables []*ast.TableName) error + CreateIndex func(ctx sessionctx.Context, stmt *ast.CreateIndexStmt) error + CreatePlacementPolicy func(ctx sessionctx.Context, stmt *ast.CreatePlacementPolicyStmt) error + CreatePlacementPolicyWithInfo func(ctx sessionctx.Context, policy *model.PolicyInfo, onExist OnExist) error + CreateSchema func(ctx sessionctx.Context, stmt *ast.CreateDatabaseStmt) error + CreateSchemaWithInfo func(ctx sessionctx.Context, info *model.DBInfo, onExist OnExist) error + CreateSequence func(ctx sessionctx.Context, stmt *ast.CreateSequenceStmt) error + CreateTable func(ctx sessionctx.Context, stmt *ast.CreateTableStmt) error + CreateTableWithInfo func(ctx sessionctx.Context, schema model.CIStr, info *model.TableInfo, ...) error + CreateView func(ctx sessionctx.Context, stmt *ast.CreateViewStmt) error + DoDDLJob func(ctx sessionctx.Context, job *model.Job) error + DropIndex func(ctx sessionctx.Context, stmt *ast.DropIndexStmt) error + DropPlacementPolicy func(ctx sessionctx.Context, stmt *ast.DropPlacementPolicyStmt) error + DropSchema func(ctx sessionctx.Context, stmt *ast.DropDatabaseStmt) error + DropSequence func(ctx sessionctx.Context, stmt *ast.DropSequenceStmt) (err error) + DropTable func(ctx sessionctx.Context, stmt *ast.DropTableStmt) (err error) + DropView func(ctx sessionctx.Context, stmt *ast.DropTableStmt) (err error) + FlashbackCluster func(ctx sessionctx.Context, flashbackTS uint64) error + GetHook func() Callback + GetID func() string + GetInfoSchemaWithInterceptor func(ctx sessionctx.Context) infoschema.InfoSchema + GetLease func() time.Duration + GetScope func(status string) variable.ScopeFlag + GetTableMaxHandle func(ctx *JobContext, startTS uint64, tbl table.PhysicalTable) (kv.Handle, bool, error) + LockTables func(ctx sessionctx.Context, stmt *ast.LockTablesStmt) error + MoveJobFromQueue2Table func(bool) error + MoveJobFromTable2Queue func() error + OwnerManager func() owner.Manager + RecoverSchema func(ctx sessionctx.Context, recoverSchemaInfo *RecoverSchemaInfo) error + RecoverTable func(ctx sessionctx.Context, recoverInfo *RecoverInfo) (err error) + RegisterStatsHandle func(*handle.Handle) + RenameTable func(ctx sessionctx.Context, stmt *ast.RenameTableStmt) error + RepairTable func(ctx sessionctx.Context, table *ast.TableName, createStmt *ast.CreateTableStmt) error + SchemaSyncer func() syncer.SchemaSyncer + SetBinlogClient func(*pumpcli.PumpsClient) + SetHook func(h Callback) + Start func(ctxPool *pools.ResourcePool) error + Stats func(vars *variable.SessionVars) (map[string]interface{}, error) + Stop func() error + TruncateTable func(ctx sessionctx.Context, tableIdent ast.Ident) error + UnlockTables func(ctx sessionctx.Context, lockedTables []model.TableLockTpInfo) error + UpdateTableReplicaInfo func(ctx sessionctx.Context, physicalID int64, available bool) error + func NewDDL(ctx context.Context, options ...Option) DDL + type DefaultCallback struct + func (c *DefaultCallback) OnChanged(err error) error + func (c *DefaultCallback) OnSchemaStateChanged(schemaVer int64) + type DomainReloader interface + Reload func() error + type Info struct + Jobs []*model.Job + ReorgHandle kv.Key + SchemaVer int64 + func GetDDLInfo(s sessionctx.Context) (*Info, error) + func GetDDLInfoWithNewTxn(s sessionctx.Context) (*Info, error) + type Interceptor interface + OnGetInfoSchema func(ctx sessionctx.Context, is infoschema.InfoSchema) infoschema.InfoSchema + type JobContext struct + func NewJobContext() *JobContext + type LockTablesArg struct + IndexOfLock int + IndexOfUnlock int + IsCleanup bool + LockTables []model.TableLockTpInfo + SessionInfo model.SessionInfo + UnlockTables []model.TableLockTpInfo + type MockSchemaSyncer struct + func (*MockSchemaSyncer) Close() + func (s *MockSchemaSyncer) CloseSession() + func (s *MockSchemaSyncer) Done() <-chan struct{} + func (s *MockSchemaSyncer) GlobalVersionCh() clientv3.WatchChan + func (s *MockSchemaSyncer) Init(ctx context.Context) error + func (s *MockSchemaSyncer) OwnerCheckAllVersions(ctx context.Context, jobID int64, latestVer int64) error + func (s *MockSchemaSyncer) OwnerUpdateGlobalVersion(ctx context.Context, version int64) error + func (s *MockSchemaSyncer) Restart(_ context.Context) error + func (s *MockSchemaSyncer) UpdateSelfVersion(ctx context.Context, jobID int64, version int64) error + func (s *MockSchemaSyncer) WatchGlobalSchemaVer(context.Context) + type OnExist uint8 + const OnExistError + const OnExistIgnore + const OnExistReplace + func (o OnExist) Apply(c *CreateTableWithInfoConfig) + type Option func(*Options) + func WithEtcdClient(client *clientv3.Client) Option + func WithHook(callback Callback) Option + func WithInfoCache(ic *infoschema.InfoCache) Option + func WithLease(lease time.Duration) Option + func WithStore(store kv.Storage) Option + type Options struct + EtcdCli *clientv3.Client + Hook Callback + InfoCache *infoschema.InfoCache + Lease time.Duration + Store kv.Storage + type PollTiFlashBackoffContext struct + Capacity int + MaxThreshold TiFlashTick + MinThreshold TiFlashTick + Rate TiFlashTick + func NewPollTiFlashBackoffContext(MinThreshold, MaxThreshold TiFlashTick, Capacity int, Rate TiFlashTick) (*PollTiFlashBackoffContext, error) + func (b *PollTiFlashBackoffContext) Get(ID int64) (*PollTiFlashBackoffElement, bool) + func (b *PollTiFlashBackoffContext) Len() int + func (b *PollTiFlashBackoffContext) Put(ID int64) bool + func (b *PollTiFlashBackoffContext) Remove(ID int64) bool + func (b *PollTiFlashBackoffContext) Tick(ID int64) (bool, bool, int) + type PollTiFlashBackoffElement struct + Counter int + Threshold TiFlashTick + TotalCounter int + func NewPollTiFlashBackoffElement() *PollTiFlashBackoffElement + func (e *PollTiFlashBackoffElement) MaybeGrow(b *PollTiFlashBackoffContext) bool + func (e *PollTiFlashBackoffElement) NeedGrow() bool + type RecoverInfo struct + AutoIDs meta.AutoIDGroup + DropJobID int64 + OldSchemaName string + OldTableName string + SchemaID int64 + SnapshotTS uint64 + TableInfo *model.TableInfo + type RecoverSchemaInfo struct + DropJobID int64 + OldSchemaName model.CIStr + RecoverTabsInfo []*RecoverInfo + SnapshotTS uint64 + type TiFlashManagementContext struct + Backoff *PollTiFlashBackoffContext + PollCounter uint64 + TiFlashStores map[int64]helper.StoreStat + UpdatingProgressTables *list.List + func NewTiFlashManagementContext() (*TiFlashManagementContext, error) + type TiFlashReplicaStatus struct + Available bool + Count uint64 + HighPriority bool + ID int64 + IsPartition bool + LocationLabels []string + LogicalTableAvailable bool + type TiFlashTick float64