package
9.0.0-alpha+incompatible
Repository: https://github.com/pingcap/tidb.git
Documentation: pkg.go.dev
# Packages
Package mock is a generated GoMock package.
Package systable contains all constants/methods related accessing system tables related to DDL job execution.
# Functions
AddDelRangeJobInternal implements the generation the delete ranges for the provided job and consumes the delete ranges through delRangeExecWrapper.
AddHistoryDDLJob record the history job.
AddIndexColumnFlag aligns the column flags of columns in TableInfo to IndexInfo.
AllocateColumnID allocates next column ID from TableInfo.
AllocateIndexID allocates an index ID from TableInfo.
AppendPartitionDefs generates a list of partition definitions needed for SHOW CREATE TABLE (in executor/show.go) as well as needed for generating the ADD PARTITION query for INTERVAL partitioning of ALTER TABLE t LAST PARTITION and generating the CREATE TABLE query from CREATE TABLE ..
AppendPartitionInfo is used in SHOW CREATE TABLE as well as generation the SQL syntax for the PartitionInfo during validation of various DDL commands.
BackupFillerTypeCount represents the count of ddl jobs that need to do backfill.
BuildAddedPartitionInfo build alter table add partition info.
BuildElements is exported for testing.
BuildHandle is exported for test.
BuildHiddenColumnInfo builds hidden column info.
BuildIndexInfo builds a new IndexInfo according to the index information.
BuildSessionTemporaryTableInfo builds model.TableInfo from a SQL statement.
BuildTableInfo creates a TableInfo.
BuildTableInfoFromAST builds model.TableInfo from a SQL statement.
BuildTableInfoWithLike builds a new table info according to CREATE TABLE ..
BuildTableInfoWithStmt builds model.TableInfo from a SQL statement without validity check.
BuildViewInfo builds a ViewInfo structure from an ast.CreateViewStmt.
CalculateRegionBatch is exported for test.
CancelJobs cancels the DDL jobs according to user command.
CancelJobsBySystem cancels Jobs because of internal reasons.
CheckAfterPositionExists makes sure the column specified in AFTER clause is exists.
CheckDropTablePartition checks if the partition exists and does not allow deleting the last existing partition in the table.
CheckIsDropPrimaryKey checks if we will drop PK, there are many PK implementations so we provide a helper function.
CheckPKOnGeneratedColumn checks the specification of PK is valid.
CheckPlacementPolicyNotInUseFromInfoSchema export for test.
CheckPlacementPolicyNotInUseFromMeta export for test.
CheckTableInfoValidWithStmt exposes checkTableInfoValidWithStmt to SchemaTracker.
CloseOwnerManager closes the global DDL owner manager.
ConvertBetweenCharAndVarchar check whether column converted between char and varchar TODO: it is used for plugins.
CreateNewColumn creates a new column according to the column information.
DeniedByBDR checks whether the DDL is denied by BDR.
DisableTiFlashPoll disables TiFlash poll loop aka PollTiFlashReplicaStatus.
DropIndexColumnFlag drops the column flag of columns in TableInfo according to the IndexInfo.
EnableTiFlashPoll enables TiFlash poll loop aka PollTiFlashReplicaStatus.
ExtractDatumByOffsets is exported for test.
ExtractTblInfos extracts the table information from the infoschema.
FindColumnNamesInExpr returns a slice of ast.ColumnName which is referred in expr.
FindRelatedIndexesToChange finds the indexes that covering the given column.
GeneratePartDefsFromInterval generates range partitions from INTERVAL partitioning.
GetAllDDLJobs get all DDL jobs and sorts jobs by job.ID.
GetAllHistoryDDLJobs get all the done DDL jobs.
GetCharsetAndCollateInTableOption will iterate the charset and collate in the options, and returns the last charset and collate in options.
GetColumnForeignKeyInfo returns the wanted foreign key info.
GetCreateTableConfig applies the series of config options from default config and returns the final config.
GetDDLInfo returns DDL information and only uses for testing.
GetDDLInfoWithNewTxn returns DDL information using a new txn.
GetDefaultCollation returns the default collation for charset and handle the default collation for UTF8MB4.
GetDropOrTruncateTableInfoFromJobsByStore implements GetDropOrTruncateTableInfoFromJobs.
GetHistoryJobByID return history DDL job by ID.
GetLastHistoryDDLJobsIterator gets latest N history DDL jobs iterator.
GetLastNHistoryDDLJobs returns the DDL history jobs and an error.
GetModifiableColumnJob returns a DDL job of model.ActionModifyColumn.
GetName4AnonymousIndex returns a valid name for anonymous index.
GetOriginDefaultValueForModifyColumn gets the original default value for modifying column.
GetRangeEndKey gets the actual end key for the range of [startKey, endKey).
GetRangePlacementPolicyName get the placement policy name used by range.
GetTableInfoAndCancelFaultJob is exported for test.
GetTableMaxHandle gets the max handle of a PhysicalTable.
GetWaitTimeWhenErrorOccurred return waiting interval when processing DDL jobs encounter errors.
HandleLockTablesOnFinish handles the table lock for the job which is finished.
HandleLockTablesOnSuccessSubmit handles the table lock for the job which is submitted successfully.
InitAndAddColumnToTable initializes the ColumnInfo in-place and adds it to the table.
IsAutoRandomColumnID returns true if the given column ID belongs to an auto_random column.
IsColumnDroppableWithCheckConstraint check whether the column in check-constraint whose dependent col is more than 1.
IsColumnRenameableWithCheckConstraint check whether the column is referenced in check-constraint.
IsElemsChangedToModifyColumn check elems changed.
IterAllDDLJobs will iterates running DDL jobs first, return directly if `finishFn` return true or error, then iterates history DDL jobs until the `finishFn` return true or error.
IterHistoryDDLJobs iterates history DDL jobs until the `finishFn` return true or error.
JobNeedGC is called to determine whether delete-ranges need to be generated for the provided job.
LoadTiFlashReplicaInfo parses model.TableInfo into []TiFlashReplicaStatus.
LocateOffsetToMove returns the offset of the column to move.
MockTableInfo mocks a table info by create table stmt ast and a specified table id.
NeedToOverwriteColCharset return true for altering charset and specified CONVERT TO.
NewAddIndexIngestPipeline creates a pipeline for adding index in ingest mode.
NewBackfillingSchedulerExt creates a new backfillingSchedulerExt, only used for test now.
NewDDL creates a new DDL.
NewDDLReorgMeta create a DDL ReorgMeta.
NewDistTaskOperatorCtx is used for adding index with dist framework.
NewIndexIngestOperator creates a new IndexIngestOperator.
NewJobWrapper creates a new JobWrapper.
NewJobWrapperWithArgs creates a new JobWrapper with job args.
NewLocalOperatorCtx is used for adding index with local ingest mode.
NewMetaBuildContextWithSctx creates a new MetaBuildContext with the given session context.
NewPollTiFlashBackoffContext creates an instance of PollTiFlashBackoffContext.
NewPollTiFlashBackoffElement initialize backoff element for a TiFlash table.
NewReorgContext returns a new ddl job context.
NewReorgCopContext creates a CopContext for reorg.
NewReorgHandlerForTest creates a new reorgHandler, only used in test.
NewTableScanOperator creates a new TableScanOperator.
NewTableScanTaskSource creates a new TableScanTaskSource.
NewTiFlashManagementContext creates an instance for TiFlashManagementContext.
NewWriteExternalStoreOperator creates a new WriteExternalStoreOperator.
NewWriteIndexToExternalStoragePipeline creates a pipeline for writing index to external storage.
OverwriteCollationWithBinaryFlag is used to handle the case like
CREATE TABLE t (a VARCHAR(255) BINARY) CHARSET utf8 COLLATE utf8_general_ci;
The 'BINARY' sets the column collation to *_bin according to the table charset.
PauseAllJobsBySystem pauses all running Jobs because of internal reasons.
PauseJobs pause all the DDL jobs according to user command.
PauseJobsBySystem pauses Jobs because of internal reasons.
PollAvailableTableProgress will poll and check availability of available tables.
ProcessColumnCharsetAndCollation process column charset and collation.
ProcessModifyColumnOptions process column options.
RemoveDependentHiddenColumns removes hidden columns by the indexInfo.
ResolveAlterAlgorithm resolves the algorithm of the alterSpec.
ResolveAlterTableSpec resolves alter table algorithm and removes ignore table spec in specs.
ResolveCharsetCollation will resolve the charset and collate by the order of parameters: * If any given ast.CharsetOpt is not empty, the resolved charset and collate will be returned.
ResumeAllJobsBySystem resumes all paused Jobs because of internal reasons.
ResumeJobs resume all the DDL jobs according to user command.
ResumeJobsBySystem resumes Jobs that are paused by TiDB itself.
ScanHistoryDDLJobs get some of the done DDL jobs.
SendFlashbackToVersionRPC flashback the MVCC key to the version Function also be called by BR for volume snapshot backup and restore.
SendPrepareFlashbackToVersionRPC prepares regions for flashback, the purpose is to put region into flashback state which region stop write Function also be called by BR for volume snapshot backup and restore.
SetBatchInsertDeleteRangeSize sets the batch insert/delete range size in the test.
SetDefaultValue sets the default value of the column.
SetDirectPlacementOpt tries to make the PlacementSettings assignments generic for Schema/Table/Partition.
SetDirectResourceGroupBackgroundOption set background configs of the ResourceGroupSettings.
SetDirectResourceGroupRunawayOption tries to set runaway part of the ResourceGroupSettings.
SetDirectResourceGroupRUSecondOption tries to set ru second part of the ResourceGroupSettings.
SetDirectResourceGroupSettings tries to set the ResourceGroupSettings.
SetIdxColNameOffset sets index column name and offset from changing ColumnInfo.
SetSchemaDiffForCreateTable set SchemaDiff for ActionCreateTable.
SetSchemaDiffForCreateTables set SchemaDiff for ActionCreateTables.
SetSchemaDiffForCreateView set SchemaDiff for ActionCreateView.
SetSchemaDiffForDropTable set SchemaDiff for ActionDropTable.
SetSchemaDiffForDropTablePartition set SchemaDiff for ActionDropTablePartition.
SetSchemaDiffForExchangeTablePartition set SchemaDiff for ActionExchangeTablePartition.
SetSchemaDiffForFlashbackCluster set SchemaDiff for ActionFlashbackCluster.
SetSchemaDiffForMultiInfos set SchemaDiff for multiInfos.
SetSchemaDiffForPartitionModify set SchemaDiff for ActionRemovePartitioning, ActionAlterTablePartitioning.
SetSchemaDiffForRecoverSchema set SchemaDiff for ActionRecoverSchema.
SetSchemaDiffForRecoverTable set SchemaDiff for ActionRecoverTable.
SetSchemaDiffForRenameTable set SchemaDiff for ActionRenameTable.
SetSchemaDiffForRenameTables set SchemaDiff for ActionRenameTables.
SetSchemaDiffForReorganizePartition set SchemaDiff for ActionReorganizePartition.
SetSchemaDiffForTruncateTable set SchemaDiff for ActionTruncateTable.
SetSchemaDiffForTruncateTablePartition set SchemaDiff for ActionTruncateTablePartition.
SetWaitTimeWhenErrorOccurred update waiting interval when processing DDL jobs encounter errors.
ShouldBuildClusteredIndex is used to determine whether the CREATE TABLE statement should build a clustered index table.
SplitRecordRegion is to split region in store by table prefix.
StartOwnerManager starts a global DDL owner manager.
UpdateColsNull2NotNull changes the null option of columns of an index.
ValidateFlashbackTS validates that flashBackTS in range [gcSafePoint, currentTS).
ValidateRenameIndex checks if index name is ok to be renamed.
WaitScatterRegionFinish will block until all regions are scattered.
WithAutoIDClient specifies the autoid client used by the autoid service for those AUTO_ID_CACHE=1 tables.
WithEtcdClient specifies the `clientv3.Client` of DDL used to request the etcd service.
WithEventPublishStore specifies the store used to publish DDL events.
WithIDAllocated applies the IDAllocated option.
WithInfoCache specifies the `infoschema.InfoCache`.
WithLease specifies the schema lease duration.
WithOnExist applies the OnExist option.
WithSchemaLoader specifies the schema loader used to load schema from storage.
WithStore specifies the `kv.Storage` of DDL used to request the KV service.
# Constants
BackgroundSubtaskHistoryTableID is the table ID of `tidb_background_subtask_history`.
BackgroundSubtaskHistoryTableSQL is the CREATE TABLE SQL of `tidb_background_subtask_history`.
BackgroundSubtaskTableID is the table ID of `tidb_background_subtask`.
BackgroundSubtaskTableSQL is the CREATE TABLE SQL of `tidb_background_subtask`.
Bootstrap mode, cluster is during bootstrap.
Only used in the BR unit test.
Only used in the BR unit test.
DDLOwnerKey is the ddl owner path that is saved to etcd, and it's exported for testing.
DefNumGetDDLHistoryJobs is the max count for getting the ddl history once.
DefNumHistoryJobs is default value of the default number of history job.
HistoryTable stores the history DDL jobs.
HistoryTableID is the table ID of `tidb_ddl_history`.
HistoryTableSQL is the CREATE TABLE SQL of `tidb_ddl_history`.
JobTable stores the information of DDL jobs.
JobTableID is the table ID of `tidb_ddl_job`.
JobTableSQL is the CREATE TABLE SQL of `tidb_ddl_job`.
MaxCommentLength is exported for testing.
MDLTableID is the table ID of `tidb_mdl_info`.
Normal mode, cluster is in normal state.
NotifierTableID is the table ID of `tidb_ddl_notifier`.
NotifierTableName is `tidb_ddl_notifier`.
NotifierTableSQL is the CREATE TABLE SQL of `tidb_ddl_notifier`.
OnExistError throws an error on name collision.
OnExistIgnore skips creating the new object.
OnExistReplace replaces the old object by the new object.
Prompt is the prompt for ddl owner manager.
ReorgTable stores the information of DDL reorganization.
ReorgTableID is the table ID of `tidb_ddl_reorg`.
ReorgTableSQL is the CREATE TABLE SQL of `tidb_ddl_reorg`.
UpdateDDLJobReorgCfgInterval is the interval to check and update reorg configuration.
Upgrade mode, cluster is during upgrade, we will force current node to be the DDL owner, to make sure all upgrade related DDLs are run on new version TiDB instance.
# Variables
CheckBackfillJobFinishInterval is export for test.
DDLBackfillers contains the DDL need backfill step.
EnableSplitTableRegion is a flag to decide whether to split a new region for a newly created table.
EstimateTableRowSizeForTest is used for test.
LastReorgMetaFastReorgDisabled is used for test.
MockDMLExecution is only used for test.
MockDMLExecutionMerging is only used for test.
MockDMLExecutionStateBeforeImport is only used for test.
MockDMLExecutionStateBeforeMerge is only used for test.
MockDMLExecutionStateMerging is only used for test.
PollTiFlashBackoffCapacity is the cache size of backoff struct.
PollTiFlashBackoffMaxTick is the max tick before we try to update TiFlash replica availability for one table.
PollTiFlashBackoffMinTick is the min tick before we try to update TiFlash replica availability for one table.
PollTiFlashBackoffRate is growth rate of exponential backoff threshold.
PollTiFlashInterval is the interval between every pollTiFlashReplicaStatus call.
PullTiFlashPdTick indicates the number of intervals before we fully sync all TiFlash pd rules and tables.
RefreshProgressMaxTableCount is the max count of table to refresh progress after available each poll.
ResultCounterForTest is used for test.
RunInGoTest is used to identify whether ddl in running in the test.
TestCheckReorgTimeout is used to mock timeout when reorg data.
TestCheckWorkerNumber use for test adjust backfill worker.
TestCheckWorkerNumCh use for test adjust backfill worker.
TestNotifyBeginTxnCh is used for if the txn is beginning in runInTxn.
TestReorgGoroutineRunning is only used in test to indicate the reorg goroutine has been started.
UpdateBackfillJobRowCountInterval is the interval of updating the job row count.
UpdateTiFlashStoreTick indicates the number of intervals before we fully update TiFlash stores.
WaitTimeWhenErrorOccurred is waiting interval when processing DDL jobs encounter errors.
# Structs
AlterAlgorithm is used to store supported alter algorithm.
AvailableTableID is the table id info of available table for waiting to update TiFlash replica progress.
BackfillCleanUpS3 implements scheduler.CleanUpRoutine.
BackfillingSchedulerExt is an extension of litBackfillScheduler, exported for test.
BackfillSubTaskMeta is the sub-task meta for backfilling index.
BackfillTaskMeta is the dist task meta for backfilling index.
CreateTableConfig is the configuration of `CreateTableWithInfo`.
EmptyRowCntListener implements a noop RowCountListener.
IndexIngestOperator writes index records to ingest engine.
IndexRecordChunk contains one of the chunk read from corresponding TableScanTask.
IndexWriteResult contains the result of writing index records to ingest engine.
Info is for DDL information.
JobSubmitter collects the DDL jobs and submits them to job tables in batch, it's also responsible allocating IDs for the jobs.
JobWrapper is used to wrap a job and some other information.
LitBackfillScheduler wraps BaseScheduler.
OperatorCtx is the context for AddIndexIngestPipeline.
Options represents all the options of the DDL module needs.
PollTiFlashBackoffContext is a collection of all backoff states.
PollTiFlashBackoffElement records backoff for each TiFlash Table.
ReorgContext contains context info for reorg job.
TableScanOperator scans table records in given key ranges from kv store.
TableScanTask contains the start key and the end key of a region.
TableScanTaskSource produces TableScanTask by splitting table records into ranges.
TiFlashManagementContext is the context for TiFlash Replica Management.
TiFlashReplicaStatus records status for each TiFlash replica.
WriteExternalStoreOperator writes index records to external storage.
# Interfaces
DDL is responsible for updating schema in data store and maintaining in-memory InfoSchema cache.
DelRangeExecWrapper consumes the delete ranges with the provided table ID(s) and index ID(s).
Executor is the interface for executing DDL statements.
ExecutorForTest is the interface for executing DDL statements in tests.
RowCountListener is invoked when some index records are flushed to disk or imported to TiKV.
SchemaLoader is used to reload info schema, the only impl is domain currently.
# Type aliases
CreateTableOption is the option for creating table.
OnExist specifies what to do when a new object has a name collision.
Option represents an option to initialize the DDL module.
StartMode is an enum type for the start mode of the DDL.
TiFlashTick is type for backoff threshold.