Documentation ¶
Index ¶
- Constants
- Variables
- func AllSchemaNames(is InfoSchema) (names []string)
- func AppendHostInfoToRows(ctx sessionctx.Context, rows [][]types.Datum) ([][]types.Datum, error)
- func ConvertCharsetCollateToLowerCaseIfNeed(tbInfo *model.TableInfo)
- func ConvertOldVersionUTF8ToUTF8MB4IfNeed(tbInfo *model.TableInfo)
- func FetchClusterServerInfoWithoutPrivilegeCheck(ctx context.Context, vars *variable.SessionVars, serversInfo []ServerInfo, ...) ([][]types.Datum, error)
- func FindTableByTblOrPartID(is InfoSchema, id int64) (table.Table, *model.PartitionDefinition)
- func FormatStoreServerVersion(version string) string
- func FormatTiDBVersion(TiDBVersion string, isDefaultVersion bool) string
- func GenLabelConditionValues(values set.StringSet) string
- func GetDataFromSessionConnectAttrs(sctx sessionctx.Context, sameAccount bool) ([][]types.Datum, error)
- func GetDataFromSessionVariables(ctx context.Context, sctx sessionctx.Context) ([][]types.Datum, error)
- func GetInstanceAddr(ctx sessionctx.Context) (string, error)
- func GetSequenceByName(is InfoSchema, schema, sequence pmodel.CIStr) (util.SequenceTable, error)
- func GetShardingInfo(dbInfo pmodel.CIStr, tableInfo *model.TableInfo) any
- func GetTableTiDBHotRegionsHistoryCols() []columnInfo
- func GetTableTiKVRegionPeersCols() []columnInfo
- func GetTiFlashStoreCount(store kv.Storage) (cnt uint64, err error)
- func HasAutoIncrementColumn(tbInfo *model.TableInfo) (bool, string)
- func IsClusterTableByName(dbName, tableName string) bool
- func IsMetricTable(lowerTableName string) bool
- func IsSpecialDB(dbName string) bool
- func IsV2(is InfoSchema) (bool, *infoschemaV2)
- func NewInfoSchemaV2(r autoid.Requirement, factory func() (pools.Resource, error), infoData *Data) infoschemaV2
- func RegisterVirtualTable(dbInfo *model.DBInfo, tableFromMeta tableFromMetaFunc)
- func SchemaByTable(is InfoSchema, tableInfo *model.TableInfo) (val *model.DBInfo, ok bool)
- func SysVarHiddenForSem(ctx sessionctx.Context, sysVarNameInLower string) bool
- func TableIsSequence(is InfoSchema, schema, table pmodel.CIStr) bool
- func TableIsView(is InfoSchema, schema, table pmodel.CIStr) bool
- func WithRefillOption(ctx context.Context, refill bool) context.Context
- type Builder
- func (is *Builder) AllSchemaNames() []pmodel.CIStr
- func (is *Builder) AllSchemas() (schemas []*model.DBInfo)
- func (b *Builder) ApplyDiff(m meta.Reader, diff *model.SchemaDiff) ([]int64, error)
- func (b *Builder) Build(schemaTS uint64) InfoSchema
- func (is *Builder) CloneAndUpdateTS(startTS uint64) *infoschemaV2
- func (is *Builder) EvictTable(schema, tbl pmodel.CIStr)
- func (is *Builder) FindTableByPartitionID(partitionID int64) (table.Table, *model.DBInfo, *model.PartitionDefinition)
- func (is *Builder) FindTableInfoByPartitionID(partitionID int64) (*model.TableInfo, *model.DBInfo, *model.PartitionDefinition)
- func (b *Builder) InitWithDBInfos(dbInfos []*model.DBInfo, policies []*model.PolicyInfo, ...) error
- func (b *Builder) InitWithOldInfoSchema(oldSchema InfoSchema) error
- func (is *Builder) IterateAllTableItems(visit func(TableItem) bool)
- func (is *Builder) ListTablesWithSpecialAttribute(filter infoschemacontext.SpecialAttributeFilter) []infoschemacontext.TableInfoResult
- func (is *Builder) SchemaByID(id int64) (*model.DBInfo, bool)
- func (is *Builder) SchemaByName(schema pmodel.CIStr) (val *model.DBInfo, ok bool)
- func (is *Builder) SchemaExists(schema pmodel.CIStr) bool
- func (is *Builder) SchemaNameByTableID(tableID int64) (schemaName pmodel.CIStr, ok bool)
- func (is *Builder) SchemaSimpleTableInfos(ctx context.Context, schema pmodel.CIStr) ([]*model.TableNameInfo, error)
- func (is *Builder) SchemaTableInfos(ctx context.Context, schema pmodel.CIStr) ([]*model.TableInfo, error)
- func (b *Builder) SetDeltaUpdateBundles()
- func (is *Builder) TableByID(ctx context.Context, id int64) (val table.Table, ok bool)
- func (is *Builder) TableByName(ctx context.Context, schema, tbl pmodel.CIStr) (t table.Table, err error)
- func (is *Builder) TableExists(schema, table pmodel.CIStr) bool
- func (is *Builder) TableInfoByID(id int64) (*model.TableInfo, bool)
- func (is *Builder) TableInfoByName(schema, table pmodel.CIStr) (*model.TableInfo, error)
- func (is *Builder) TableIsCached(id int64) (ok bool)
- func (b *Builder) WithStore(s kv.Storage) *Builder
- type ClusterTableCopDestination
- type Data
- type InfoCache
- func (h *InfoCache) GetBySnapshotTS(snapshotTS uint64) InfoSchema
- func (h *InfoCache) GetByVersion(version int64) InfoSchema
- func (h *InfoCache) GetEmptySchemaVersions() map[int64]struct{}
- func (h *InfoCache) GetLatest() InfoSchema
- func (h *InfoCache) Insert(is InfoSchema, schemaTS uint64) bool
- func (h *InfoCache) InsertEmptySchemaVersion(version int64)
- func (h *InfoCache) Len() int
- func (h *InfoCache) ReSize(capacity int)
- func (h *InfoCache) Reset(capacity int)
- func (h *InfoCache) Size() int
- func (h *InfoCache) Upsert(is InfoSchema, schemaTS uint64) func()
- type InfoSchema
- type MetricTableDef
- type SchemaAndTableName
- type ServerInfo
- func FilterClusterServerInfo(serversInfo []ServerInfo, nodeTypes, addresses set.StringSet) []ServerInfo
- func GetClusterServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
- func GetPDServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
- func GetSchedulingServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
- func GetStoreServerInfo(store kv.Storage) ([]ServerInfo, error)
- func GetTSOServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
- func GetTiCDCServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
- func GetTiDBServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
- func GetTiFlashServerInfo(store kv.Storage) ([]ServerInfo, error)
- func GetTiProxyServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
- type SessionExtendedInfoSchema
- func (ts *SessionExtendedInfoSchema) DetachTemporaryTableInfoSchema() *SessionExtendedInfoSchema
- func (ts *SessionExtendedInfoSchema) FindTableInfoByPartitionID(partitionID int64) (*model.TableInfo, *model.DBInfo, *model.PartitionDefinition)
- func (ts *SessionExtendedInfoSchema) HasTemporaryTable() bool
- func (ts *SessionExtendedInfoSchema) SchemaByID(id int64) (*model.DBInfo, bool)
- func (ts *SessionExtendedInfoSchema) TableByID(ctx stdctx.Context, id int64) (table.Table, bool)
- func (ts *SessionExtendedInfoSchema) TableByName(ctx stdctx.Context, schema, table pmodel.CIStr) (table.Table, error)
- func (ts *SessionExtendedInfoSchema) TableInfoByID(id int64) (*model.TableInfo, bool)
- func (ts *SessionExtendedInfoSchema) TableInfoByName(schema, table pmodel.CIStr) (*model.TableInfo, error)
- func (ts *SessionExtendedInfoSchema) UpdateTableInfo(db *model.DBInfo, tableInfo table.Table) error
- type SessionTables
- func (is *SessionTables) AddTable(db *model.DBInfo, tbl table.Table) error
- func (is *SessionTables) Count() int
- func (is *SessionTables) RemoveTable(schema, table pmodel.CIStr) (exist bool)
- func (is *SessionTables) SchemaByID(id int64) (*model.DBInfo, bool)
- func (is *SessionTables) TableByID(id int64) (tbl table.Table, ok bool)
- func (is *SessionTables) TableByName(ctx stdctx.Context, schema, table pmodel.CIStr) (table.Table, bool)
- func (is *SessionTables) TableExists(schema, table pmodel.CIStr) (ok bool)
- type Sieve
- func (s *Sieve[K, V]) Capacity() uint64
- func (s *Sieve[K, V]) Close()
- func (s *Sieve[K, V]) Contains(key K) (ok bool)
- func (s *Sieve[K, V]) Get(key K) (value V, ok bool)
- func (s *Sieve[K, V]) Len() int
- func (s *Sieve[K, V]) Peek(key K) (value V, ok bool)
- func (s *Sieve[K, V]) Purge()
- func (s *Sieve[K, V]) Remove(key K) (ok bool)
- func (s *Sieve[K, V]) Set(key K, value V)
- func (s *Sieve[K, V]) SetCapacity(capacity uint64)
- func (s *Sieve[K, V]) SetCapacityAndWaitEvict(capacity uint64)
- func (s *Sieve[K, V]) SetStatusHook(hook sieveStatusHook)
- func (s *Sieve[K, V]) Size() uint64
- type TableItem
- type VirtualTable
- func (vt *VirtualTable) AddRecord(ctx table.MutateContext, txn kv.Transaction, r []types.Datum, ...) (recordID kv.Handle, err error)
- func (vt *VirtualTable) Allocators(_ table.AllocatorContext) autoid.Allocators
- func (vt *VirtualTable) Cols() []*table.Column
- func (vt *VirtualTable) DeletableCols() []*table.Column
- func (vt *VirtualTable) DeletableIndices() []table.Index
- func (vt *VirtualTable) FullHiddenColsAndVisibleCols() []*table.Column
- func (vt *VirtualTable) GetPhysicalID() int64
- func (vt *VirtualTable) HiddenCols() []*table.Column
- func (vt *VirtualTable) IndexPrefix() kv.Key
- func (vt *VirtualTable) Indices() []table.Index
- func (vt *VirtualTable) Meta() *model.TableInfo
- func (vt *VirtualTable) RecordPrefix() kv.Key
- func (vt *VirtualTable) RemoveRecord(ctx table.MutateContext, txn kv.Transaction, h kv.Handle, r []types.Datum, ...) error
- func (vt *VirtualTable) Type() table.Type
- func (vt *VirtualTable) UpdateRecord(ctx table.MutateContext, txn kv.Transaction, h kv.Handle, ...) error
- func (vt *VirtualTable) VisibleCols() []*table.Column
- func (vt *VirtualTable) WritableCols() []*table.Column
- func (vt *VirtualTable) WritableConstraint() []*table.Constraint
Constants ¶
const ( // ClusterTableSlowLog is the string constant of cluster slow query memory table. ClusterTableSlowLog = "CLUSTER_SLOW_QUERY" ClusterTableProcesslist = "CLUSTER_PROCESSLIST" // ClusterTableStatementsSummary is the string constant of cluster statement summary table. ClusterTableStatementsSummary = "CLUSTER_STATEMENTS_SUMMARY" // ClusterTableStatementsSummaryHistory is the string constant of cluster statement summary history table. ClusterTableStatementsSummaryHistory = "CLUSTER_STATEMENTS_SUMMARY_HISTORY" // ClusterTableStatementsSummaryEvicted is the string constant of cluster statement summary evict table. ClusterTableStatementsSummaryEvicted = "CLUSTER_STATEMENTS_SUMMARY_EVICTED" // ClusterTableTiDBTrx is the string constant of cluster transaction running table. ClusterTableTiDBTrx = "CLUSTER_TIDB_TRX" // ClusterTableDeadlocks is the string constant of cluster dead lock table. ClusterTableDeadlocks = "CLUSTER_DEADLOCKS" // ClusterTableDeadlocks is the string constant of cluster transaction summary table. ClusterTableTrxSummary = "CLUSTER_TRX_SUMMARY" // ClusterTableMemoryUsage is the memory usage status of tidb cluster. ClusterTableMemoryUsage = "CLUSTER_MEMORY_USAGE" // ClusterTableMemoryUsageOpsHistory is the memory control operators history of tidb cluster. ClusterTableMemoryUsageOpsHistory = "CLUSTER_MEMORY_USAGE_OPS_HISTORY" // ClusterTableTiDBIndexUsage is a table to show the usage stats of indexes across the whole cluster. ClusterTableTiDBIndexUsage = "CLUSTER_TIDB_INDEX_USAGE" )
Cluster table indicates that these tables need to get data from other tidb nodes, which may get from all other nodes, or may get from the ddl owner. Cluster table list, attention: 1. the table name should be upper case. 2. For tables that need to get data from all other TiDB nodes, clusterTableName should equal to "CLUSTER_" + memTableTableName.
const ( // TableSchemata is the string constant of infoschema table. TableSchemata = "SCHEMATA" // TableTables is the string constant of infoschema table. TableTables = "TABLES" // TableColumns is the string constant of infoschema table TableColumns = "COLUMNS" // TableStatistics is the string constant of infoschema table TableStatistics = "STATISTICS" // TableCharacterSets is the string constant of infoschema charactersets memory table TableCharacterSets = "CHARACTER_SETS" // TableCollations is the string constant of infoschema collations memory table. TableCollations = "COLLATIONS" // CatalogVal is the string constant of TABLE_CATALOG. CatalogVal = "def" // TableProfiling is the string constant of infoschema table. TableProfiling = "PROFILING" // TablePartitions is the string constant of infoschema table. TablePartitions = "PARTITIONS" // TableKeyColumn is the string constant of KEY_COLUMN_USAGE. TableKeyColumn = "KEY_COLUMN_USAGE" // TableReferConst is the string constant of REFERENTIAL_CONSTRAINTS. TableReferConst = "REFERENTIAL_CONSTRAINTS" // TableConstraints is the string constant of TABLE_CONSTRAINTS. TableConstraints = "TABLE_CONSTRAINTS" // TableUserPrivileges is the string constant of infoschema user privilege table. TableUserPrivileges = "USER_PRIVILEGES" // TableEngines is the string constant of infoschema table. TableEngines = "ENGINES" // TableViews is the string constant of infoschema table. TableViews = "VIEWS" // TableCollationCharacterSetApplicability is the string constant of infoschema memory table. TableCollationCharacterSetApplicability = "COLLATION_CHARACTER_SET_APPLICABILITY" // TableProcesslist is the string constant of infoschema table. TableProcesslist = "PROCESSLIST" // TableTiDBIndexes is the string constant of infoschema table TableTiDBIndexes = "TIDB_INDEXES" // TableTiDBHotRegions is the string constant of infoschema table TableTiDBHotRegions = "TIDB_HOT_REGIONS" // TableTiDBHotRegionsHistory is the string constant of infoschema table TableTiDBHotRegionsHistory = "TIDB_HOT_REGIONS_HISTORY" // TableTiKVStoreStatus is the string constant of infoschema table TableTiKVStoreStatus = "TIKV_STORE_STATUS" // TableAnalyzeStatus is the string constant of Analyze Status TableAnalyzeStatus = "ANALYZE_STATUS" // TableTiKVRegionStatus is the string constant of infoschema table TableTiKVRegionStatus = "TIKV_REGION_STATUS" // TableTiKVRegionPeers is the string constant of infoschema table TableTiKVRegionPeers = "TIKV_REGION_PEERS" // TableTiDBServersInfo is the string constant of TiDB server information table. TableTiDBServersInfo = "TIDB_SERVERS_INFO" // TableSlowQuery is the string constant of slow query memory table. TableSlowQuery = "SLOW_QUERY" // TableClusterInfo is the string constant of cluster info memory table. TableClusterInfo = "CLUSTER_INFO" // TableClusterConfig is the string constant of cluster configuration memory table. TableClusterConfig = "CLUSTER_CONFIG" // TableClusterLog is the string constant of cluster log memory table. TableClusterLog = "CLUSTER_LOG" // TableClusterLoad is the string constant of cluster load memory table. TableClusterLoad = "CLUSTER_LOAD" // TableClusterHardware is the string constant of cluster hardware table. TableClusterHardware = "CLUSTER_HARDWARE" // TableClusterSystemInfo is the string constant of cluster system info table. TableClusterSystemInfo = "CLUSTER_SYSTEMINFO" // TableTiFlashReplica is the string constant of tiflash replica table. TableTiFlashReplica = "TIFLASH_REPLICA" // TableInspectionResult is the string constant of inspection result table. TableInspectionResult = "INSPECTION_RESULT" // TableMetricTables is a table that contains all metrics table definition. TableMetricTables = "METRICS_TABLES" // TableMetricSummary is a summary table that contains all metrics. TableMetricSummary = "METRICS_SUMMARY" // TableMetricSummaryByLabel is a metric table that contains all metrics that group by label info. TableMetricSummaryByLabel = "METRICS_SUMMARY_BY_LABEL" // TableInspectionSummary is the string constant of inspection summary table. TableInspectionSummary = "INSPECTION_SUMMARY" // TableInspectionRules is the string constant of currently implemented inspection and summary rules. TableInspectionRules = "INSPECTION_RULES" // TableDDLJobs is the string constant of DDL job table. TableDDLJobs = "DDL_JOBS" // TableSequences is the string constant of all sequences created by user. TableSequences = "SEQUENCES" // TableStatementsSummary is the string constant of statement summary table. TableStatementsSummary = "STATEMENTS_SUMMARY" // TableStatementsSummaryHistory is the string constant of statements summary history table. TableStatementsSummaryHistory = "STATEMENTS_SUMMARY_HISTORY" // TableStatementsSummaryEvicted is the string constant of statements summary evicted table. TableStatementsSummaryEvicted = "STATEMENTS_SUMMARY_EVICTED" // TableStorageStats is a table that contains all tables disk usage TableStorageStats = "TABLE_STORAGE_STATS" // TableTiFlashTables is the string constant of tiflash tables table. TableTiFlashTables = "TIFLASH_TABLES" // TableTiFlashSegments is the string constant of tiflash segments table. TableTiFlashSegments = "TIFLASH_SEGMENTS" // TableTiFlashIndexes is the string constant of tiflash indexes table. TableTiFlashIndexes = "TIFLASH_INDEXES" // TableClientErrorsSummaryGlobal is the string constant of client errors table. TableClientErrorsSummaryGlobal = "CLIENT_ERRORS_SUMMARY_GLOBAL" // TableClientErrorsSummaryByUser is the string constant of client errors table. TableClientErrorsSummaryByUser = "CLIENT_ERRORS_SUMMARY_BY_USER" // TableClientErrorsSummaryByHost is the string constant of client errors table. TableClientErrorsSummaryByHost = "CLIENT_ERRORS_SUMMARY_BY_HOST" // TableTiDBTrx is current running transaction status table. TableTiDBTrx = "TIDB_TRX" // TableDeadlocks is the string constant of deadlock table. TableDeadlocks = "DEADLOCKS" // TableDataLockWaits is current lock waiting status table. TableDataLockWaits = "DATA_LOCK_WAITS" // TableAttributes is the string constant of attributes table. TableAttributes = "ATTRIBUTES" // TablePlacementPolicies is the string constant of placement policies table. TablePlacementPolicies = "PLACEMENT_POLICIES" // TableTrxSummary is the string constant of transaction summary table. TableTrxSummary = "TRX_SUMMARY" // TableVariablesInfo is the string constant of variables_info table. TableVariablesInfo = "VARIABLES_INFO" // TableUserAttributes is the string constant of user_attributes view. TableUserAttributes = "USER_ATTRIBUTES" // TableMemoryUsage is the memory usage status of tidb instance. TableMemoryUsage = "MEMORY_USAGE" // TableMemoryUsageOpsHistory is the memory control operators history. TableMemoryUsageOpsHistory = "MEMORY_USAGE_OPS_HISTORY" // TableResourceGroups is the metadata of resource groups. TableResourceGroups = "RESOURCE_GROUPS" // TableRunawayWatches is the query list of runaway watch. TableRunawayWatches = "RUNAWAY_WATCHES" // TableCheckConstraints is the list of CHECK constraints. TableCheckConstraints = "CHECK_CONSTRAINTS" // TableTiDBCheckConstraints is the list of CHECK constraints, with non-standard TiDB extensions. TableTiDBCheckConstraints = "TIDB_CHECK_CONSTRAINTS" // TableKeywords is the list of keywords. TableKeywords = "KEYWORDS" // TableTiDBIndexUsage is a table to show the usage stats of indexes in the current instance. TableTiDBIndexUsage = "TIDB_INDEX_USAGE" )
const ( // DataLockWaitsColumnKey is the name of the KEY column of the DATA_LOCK_WAITS table. DataLockWaitsColumnKey = "KEY" // DataLockWaitsColumnKeyInfo is the name of the KEY_INFO column of the DATA_LOCK_WAITS table. DataLockWaitsColumnKeyInfo = "KEY_INFO" // DataLockWaitsColumnTrxID is the name of the TRX_ID column of the DATA_LOCK_WAITS table. DataLockWaitsColumnTrxID = "TRX_ID" // DataLockWaitsColumnCurrentHoldingTrxID is the name of the CURRENT_HOLDING_TRX_ID column of the DATA_LOCK_WAITS table. DataLockWaitsColumnCurrentHoldingTrxID = "CURRENT_HOLDING_TRX_ID" // DataLockWaitsColumnSQLDigest is the name of the SQL_DIGEST column of the DATA_LOCK_WAITS table. DataLockWaitsColumnSQLDigest = "SQL_DIGEST" // DataLockWaitsColumnSQLDigestText is the name of the SQL_DIGEST_TEXT column of the DATA_LOCK_WAITS table. DataLockWaitsColumnSQLDigestText = "SQL_DIGEST_TEXT" )
const ( // PrimaryKeyType is the string constant of PRIMARY KEY. PrimaryKeyType = "PRIMARY KEY" // PrimaryConstraint is the string constant of PRIMARY. PrimaryConstraint = "PRIMARY" // UniqueKeyType is the string constant of UNIQUE. UniqueKeyType = "UNIQUE" // ForeignKeyType is the string constant of Foreign Key. ForeignKeyType = "FOREIGN KEY" )
const (
// TiFlashWrite is the TiFlash write node in disaggregated mode.
TiFlashWrite = "tiflash_write"
)
Variables ¶
var ( // ErrDatabaseExists returns for database already exists. ErrDatabaseExists = dbterror.ClassSchema.NewStd(mysql.ErrDBCreateExists) // ErrDatabaseDropExists returns for dropping a non-existent database. ErrDatabaseDropExists = dbterror.ClassSchema.NewStd(mysql.ErrDBDropExists) // ErrAccessDenied return when the user doesn't have the permission to access the table. ErrAccessDenied = dbterror.ClassSchema.NewStd(mysql.ErrAccessDenied) // ErrDatabaseNotExists returns for database not exists. ErrDatabaseNotExists = dbterror.ClassSchema.NewStd(mysql.ErrBadDB) // ErrPlacementPolicyExists returns for placement_policy policy already exists. ErrPlacementPolicyExists = dbterror.ClassSchema.NewStd(mysql.ErrPlacementPolicyExists) // ErrPlacementPolicyNotExists return for placement_policy policy not exists. ErrPlacementPolicyNotExists = dbterror.ClassSchema.NewStd(mysql.ErrPlacementPolicyNotExists) // ErrResourceGroupExists return for resource group already exists. ErrResourceGroupExists = dbterror.ClassSchema.NewStd(mysql.ErrResourceGroupExists) // ErrResourceGroupNotExists return for resource group not exists. ErrResourceGroupNotExists = dbterror.ClassSchema.NewStd(mysql.ErrResourceGroupNotExists) // ErrResourceGroupInvalidBackgroundTaskName return for unknown resource group background task name. ErrResourceGroupInvalidBackgroundTaskName = dbterror.ClassExecutor.NewStd(mysql.ErrResourceGroupInvalidBackgroundTaskName) // ErrResourceGroupInvalidForRole return for invalid resource group for role. ErrResourceGroupInvalidForRole = dbterror.ClassSchema.NewStd(mysql.ErrResourceGroupInvalidForRole) // ErrReservedSyntax for internal syntax. ErrReservedSyntax = dbterror.ClassSchema.NewStd(mysql.ErrReservedSyntax) // ErrTableExists returns for table already exists. ErrTableExists = dbterror.ClassSchema.NewStd(mysql.ErrTableExists) // ErrTableDropExists returns for dropping a non-existent table. ErrTableDropExists = dbterror.ClassSchema.NewStd(mysql.ErrBadTable) // ErrSequenceDropExists returns for dropping a non-exist sequence. ErrSequenceDropExists = dbterror.ClassSchema.NewStd(mysql.ErrUnknownSequence) // ErrColumnNotExists returns for column not exists. ErrColumnNotExists = dbterror.ClassSchema.NewStd(mysql.ErrBadField) // ErrColumnExists returns for column already exists. ErrColumnExists = dbterror.ClassSchema.NewStd(mysql.ErrDupFieldName) // ErrKeyNameDuplicate returns for index duplicate when rename index. ErrKeyNameDuplicate = dbterror.ClassSchema.NewStd(mysql.ErrDupKeyName) // ErrNonuniqTable returns when none unique tables errors. ErrNonuniqTable = dbterror.ClassSchema.NewStd(mysql.ErrNonuniqTable) // ErrMultiplePriKey returns for multiple primary keys. ErrMultiplePriKey = dbterror.ClassSchema.NewStd(mysql.ErrMultiplePriKey) // ErrTooManyKeyParts returns for too many key parts. ErrTooManyKeyParts = dbterror.ClassSchema.NewStd(mysql.ErrTooManyKeyParts) // ErrForeignKeyNotExists returns for foreign key not exists. ErrForeignKeyNotExists = dbterror.ClassSchema.NewStd(mysql.ErrCantDropFieldOrKey) // ErrTableNotLockedForWrite returns for write tables when only hold the table read lock. ErrTableNotLockedForWrite = dbterror.ClassSchema.NewStd(mysql.ErrTableNotLockedForWrite) // ErrTableNotLocked returns when session has explicitly lock tables, then visit unlocked table will return this error. ErrTableNotLocked = dbterror.ClassSchema.NewStd(mysql.ErrTableNotLocked) // ErrTableNotExists returns for table not exists. ErrTableNotExists = dbterror.ClassSchema.NewStd(mysql.ErrNoSuchTable) // ErrKeyNotExists returns for index not exists. ErrKeyNotExists = dbterror.ClassSchema.NewStd(mysql.ErrKeyDoesNotExist) // ErrCannotAddForeign returns for foreign key exists. ErrCannotAddForeign = dbterror.ClassSchema.NewStd(mysql.ErrCannotAddForeign) // ErrForeignKeyOnPartitioned returns for foreign key on partition table. ErrForeignKeyOnPartitioned = dbterror.ClassSchema.NewStd(mysql.ErrForeignKeyOnPartitioned) // ErrForeignKeyNotMatch returns for foreign key not match. ErrForeignKeyNotMatch = dbterror.ClassSchema.NewStd(mysql.ErrWrongFkDef) // ErrIndexExists returns for index already exists. ErrIndexExists = dbterror.ClassSchema.NewStd(mysql.ErrDupIndex) // ErrUserDropExists returns for dropping a non-existent user. ErrUserDropExists = dbterror.ClassSchema.NewStd(mysql.ErrBadUser) // ErrUserAlreadyExists return for creating a existent user. ErrUserAlreadyExists = dbterror.ClassSchema.NewStd(mysql.ErrUserAlreadyExists) // ErrTableLocked returns when the table was locked by other session. ErrTableLocked = dbterror.ClassSchema.NewStd(mysql.ErrTableLocked) // ErrWrongObject returns when the table/view/sequence is not the expected object. ErrWrongObject = dbterror.ClassSchema.NewStd(mysql.ErrWrongObject) // ErrAdminCheckTable returns when the check table in temporary mode. ErrAdminCheckTable = dbterror.ClassSchema.NewStd(mysql.ErrAdminCheckTable) // ErrEmptyDatabase returns when the database is unexpectedly empty. ErrEmptyDatabase = dbterror.ClassSchema.NewStd(mysql.ErrBadDB) // ErrForbidSchemaChange returns when the schema change is illegal ErrForbidSchemaChange = dbterror.ClassSchema.NewStd(mysql.ErrForbidSchemaChange) // ErrTableWithoutPrimaryKey returns when there is no primary key on a table and sql_require_primary_key is set ErrTableWithoutPrimaryKey = dbterror.ClassSchema.NewStd(mysql.ErrTableWithoutPrimaryKey) // ErrForeignKeyCannotUseVirtualColumn returns when foreign key refer virtual generated column. ErrForeignKeyCannotUseVirtualColumn = dbterror.ClassSchema.NewStd(mysql.ErrForeignKeyCannotUseVirtualColumn) // ErrForeignKeyCannotOpenParent returns when foreign key refer table not exists. ErrForeignKeyCannotOpenParent = dbterror.ClassSchema.NewStd(mysql.ErrForeignKeyCannotOpenParent) // ErrForeignKeyNoColumnInParent returns when foreign key refer columns don't exist in parent table. ErrForeignKeyNoColumnInParent = dbterror.ClassSchema.NewStd(mysql.ErrForeignKeyNoColumnInParent) // ErrForeignKeyNoIndexInParent returns when foreign key refer columns don't have related index in parent table. ErrForeignKeyNoIndexInParent = dbterror.ClassSchema.NewStd(mysql.ErrForeignKeyNoIndexInParent) // ErrForeignKeyColumnNotNull returns when foreign key with SET NULL constrain and the related column has not null. ErrForeignKeyColumnNotNull = dbterror.ClassSchema.NewStd(mysql.ErrForeignKeyColumnNotNull) // ErrResourceGroupSupportDisabled returns for resource group feature is disabled ErrResourceGroupSupportDisabled = dbterror.ClassSchema.NewStd(mysql.ErrResourceGroupSupportDisabled) // ErrCheckConstraintDupName returns for duplicate constraint names. ErrCheckConstraintDupName = dbterror.ClassSchema.NewStd(mysql.ErrCheckConstraintDupName) )
var MetricTableMap = map[string]MetricTableDef{}/* 637 elements not displayed */
MetricTableMap records the metric table definition, export for test. TODO: read from system table.
var TableTiDBHotRegionsCols = []columnInfo{ {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, }
TableTiDBHotRegionsCols is TiDB hot region mem table columns.
var TableTiDBHotRegionsHistoryCols = []columnInfo{ {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, }
TableTiDBHotRegionsHistoryCols is TiDB hot region history mem table columns.
var TableTiKVRegionPeersCols = []columnInfo{ {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, }
TableTiKVRegionPeersCols is TiKV region peers mem table columns.
var TableTiKVRegionStatusCols = []columnInfo{ {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, }
TableTiKVRegionStatusCols is TiKV region status mem table columns.
var TableTiKVStoreStatusCols = []columnInfo{ {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, }
TableTiKVStoreStatusCols is TiDB kv store status columns.
Functions ¶
func AllSchemaNames ¶
func AllSchemaNames(is InfoSchema) (names []string)
AllSchemaNames returns all the schemas' names.
func AppendHostInfoToRows ¶
AppendHostInfoToRows appends host info to the rows.
func ConvertCharsetCollateToLowerCaseIfNeed ¶
ConvertCharsetCollateToLowerCaseIfNeed convert the charset / collation of table and its columns to lower case, if the table's version is prior to TableInfoVersion3.
func ConvertOldVersionUTF8ToUTF8MB4IfNeed ¶
ConvertOldVersionUTF8ToUTF8MB4IfNeed convert old version UTF8 to UTF8MB4 if config.TreatOldVersionUTF8AsUTF8MB4 is enable.
func FetchClusterServerInfoWithoutPrivilegeCheck ¶
func FetchClusterServerInfoWithoutPrivilegeCheck(ctx context.Context, vars *variable.SessionVars, serversInfo []ServerInfo, serverInfoType diagnosticspb.ServerInfoType, recordWarningInStmtCtx bool) ([][]types.Datum, error)
FetchClusterServerInfoWithoutPrivilegeCheck fetches cluster server information
func FindTableByTblOrPartID ¶
func FindTableByTblOrPartID(is InfoSchema, id int64) (table.Table, *model.PartitionDefinition)
FindTableByTblOrPartID looks for table.Table for the given id in the InfoSchema. The id can be either a table id or a partition id. If the id is a table id, the corresponding table.Table will be returned, and the second return value is nil. If the id is a partition id, the corresponding table.Table and PartitionDefinition will be returned. If the id is not found in the InfoSchema, nil will be returned for both return values.
func FormatStoreServerVersion ¶
FormatStoreServerVersion format version of store servers(Tikv or TiFlash)
func FormatTiDBVersion ¶
FormatTiDBVersion make TiDBVersion consistent to TiKV and PD. The default TiDBVersion is 5.7.25-TiDB-${TiDBReleaseVersion}.
func GenLabelConditionValues ¶
GenLabelConditionValues generates the label condition values.
func GetDataFromSessionConnectAttrs ¶
func GetDataFromSessionConnectAttrs(sctx sessionctx.Context, sameAccount bool) ([][]types.Datum, error)
GetDataFromSessionConnectAttrs produces the rows for the session_connect_attrs table.
func GetDataFromSessionVariables ¶
func GetDataFromSessionVariables(ctx context.Context, sctx sessionctx.Context) ([][]types.Datum, error)
GetDataFromSessionVariables return the [name, value] of all session variables
func GetInstanceAddr ¶
func GetInstanceAddr(ctx sessionctx.Context) (string, error)
GetInstanceAddr gets the instance address.
func GetSequenceByName ¶
func GetSequenceByName(is InfoSchema, schema, sequence pmodel.CIStr) (util.SequenceTable, error)
GetSequenceByName gets the sequence by name.
func GetShardingInfo ¶
GetShardingInfo returns a nil or description string for the sharding information of given TableInfo. The returned description string may be:
- "NOT_SHARDED": for tables that SHARD_ROW_ID_BITS is not specified.
- "NOT_SHARDED(PK_IS_HANDLE)": for tables of which primary key is row id.
- "PK_AUTO_RANDOM_BITS={bit_number}, RANGE BITS={bit_number}": for tables of which primary key is sharded row id.
- "SHARD_BITS={bit_number}": for tables that with SHARD_ROW_ID_BITS.
The returned nil indicates that sharding information is not suitable for the table(for example, when the table is a View). This function is exported for unit test.
func GetTableTiDBHotRegionsHistoryCols ¶
func GetTableTiDBHotRegionsHistoryCols() []columnInfo
GetTableTiDBHotRegionsHistoryCols is to get TableTiDBHotRegionsHistoryCols. It is an optimization because Go does’t support const arrays. The solution is to use initialization functions. It is useful in the BCE optimization. https://go101.org/article/bounds-check-elimination.html
func GetTableTiKVRegionPeersCols ¶
func GetTableTiKVRegionPeersCols() []columnInfo
GetTableTiKVRegionPeersCols is to get TableTiKVRegionPeersCols. It is an optimization because Go does’t support const arrays. The solution is to use initialization functions. It is useful in the BCE optimization. https://go101.org/article/bounds-check-elimination.html
func GetTiFlashStoreCount ¶
GetTiFlashStoreCount returns the count of tiflash server.
func HasAutoIncrementColumn ¶
HasAutoIncrementColumn checks whether the table has auto_increment columns, if so, return true and the column name.
func IsClusterTableByName ¶
IsClusterTableByName used to check whether the table is a cluster memory table. Export for PhysicalTableScan.ExplainID
func IsMetricTable ¶
IsMetricTable uses to checks whether the table is a metric table.
func IsSpecialDB ¶
IsSpecialDB tells whether the database is a special database.
func IsV2 ¶
func IsV2(is InfoSchema) (bool, *infoschemaV2)
IsV2 tells whether an InfoSchema is v2 or not.
func NewInfoSchemaV2 ¶
func NewInfoSchemaV2(r autoid.Requirement, factory func() (pools.Resource, error), infoData *Data) infoschemaV2
NewInfoSchemaV2 create infoschemaV2.
func RegisterVirtualTable ¶
RegisterVirtualTable register virtual tables to the builder.
func SchemaByTable ¶
SchemaByTable get a table's schema name
func SysVarHiddenForSem ¶
func SysVarHiddenForSem(ctx sessionctx.Context, sysVarNameInLower string) bool
SysVarHiddenForSem checks if a given sysvar is hidden according to SEM and privileges.
func TableIsSequence ¶
func TableIsSequence(is InfoSchema, schema, table pmodel.CIStr) bool
TableIsSequence indicates whether the schema.table is a sequence.
func TableIsView ¶
func TableIsView(is InfoSchema, schema, table pmodel.CIStr) bool
TableIsView indicates whether the schema.table is a view.
Types ¶
type Builder ¶
type Builder struct { // Used by autoid allocators autoid.Requirement // contains filtered or unexported fields }
Builder builds a new InfoSchema.
func NewBuilder ¶
func NewBuilder(r autoid.Requirement, factory func() (pools.Resource, error), infoData *Data, useV2 bool) *Builder
NewBuilder creates a new Builder with a Handle.
func (*Builder) AllSchemaNames ¶
func (*Builder) AllSchemas ¶
func (*Builder) ApplyDiff ¶
ApplyDiff applies SchemaDiff to the new InfoSchema. Return the detail updated table IDs that are produced from SchemaDiff and an error.
func (*Builder) Build ¶
func (b *Builder) Build(schemaTS uint64) InfoSchema
Build builds and returns the built infoschema.
func (*Builder) CloneAndUpdateTS ¶
func (is *Builder) CloneAndUpdateTS(startTS uint64) *infoschemaV2
func (*Builder) EvictTable ¶
EvictTable is exported for testing only.
func (*Builder) FindTableByPartitionID ¶
func (*Builder) FindTableInfoByPartitionID ¶
func (is *Builder) FindTableInfoByPartitionID( partitionID int64, ) (*model.TableInfo, *model.DBInfo, *model.PartitionDefinition)
FindTableInfoByPartitionID implements InfoSchema.FindTableInfoByPartitionID
func (*Builder) InitWithDBInfos ¶
func (b *Builder) InitWithDBInfos(dbInfos []*model.DBInfo, policies []*model.PolicyInfo, resourceGroups []*model.ResourceGroupInfo, schemaVersion int64) error
InitWithDBInfos initializes an empty new InfoSchema with a slice of DBInfo, all placement rules, and schema version.
func (*Builder) InitWithOldInfoSchema ¶
func (b *Builder) InitWithOldInfoSchema(oldSchema InfoSchema) error
InitWithOldInfoSchema initializes an empty new InfoSchema by copies all the data from old InfoSchema.
func (*Builder) IterateAllTableItems ¶
IterateAllTableItems is used for special performance optimization. Used by executor/infoschema_reader.go to handle reading from INFORMATION_SCHEMA.TABLES. If visit return false, stop the iterate process.
func (*Builder) ListTablesWithSpecialAttribute ¶
func (is *Builder) ListTablesWithSpecialAttribute(filter infoschemacontext.SpecialAttributeFilter) []infoschemacontext.TableInfoResult
func (*Builder) SchemaByName ¶
func (*Builder) SchemaExists ¶
func (*Builder) SchemaNameByTableID ¶
func (*Builder) SchemaSimpleTableInfos ¶
func (is *Builder) SchemaSimpleTableInfos(ctx context.Context, schema pmodel.CIStr) ([]*model.TableNameInfo, error)
SchemaSimpleTableInfos implements MetaOnlyInfoSchema.
func (*Builder) SchemaTableInfos ¶
func (is *Builder) SchemaTableInfos(ctx context.Context, schema pmodel.CIStr) ([]*model.TableInfo, error)
SchemaTableInfos implements MetaOnlyInfoSchema.
func (*Builder) SetDeltaUpdateBundles ¶
func (b *Builder) SetDeltaUpdateBundles()
func (*Builder) TableByID ¶
TableByID implements the InfoSchema interface. As opposed to TableByName, TableByID will not refill cache when schema cache miss, unless the caller changes the behavior by passing a context use WithRefillOption.
func (*Builder) TableByName ¶
func (is *Builder) TableByName(ctx context.Context, schema, tbl pmodel.CIStr) (t table.Table, err error)
TableByName implements the InfoSchema interface. When schema cache miss, it will fetch the TableInfo from TikV and refill cache.
func (*Builder) TableExists ¶
func (*Builder) TableInfoByID ¶
TableInfoByID implements InfoSchema.TableInfoByID
func (*Builder) TableInfoByName ¶
TableInfoByName implements InfoSchema.TableInfoByName
func (*Builder) TableIsCached ¶
TableIsCached checks whether the table is cached.
type ClusterTableCopDestination ¶
type ClusterTableCopDestination int
ClusterTableCopDestination means the destination that cluster tables will send cop requests to.
const ( // AllTiDB is uese by CLUSTER_* table, means that these tables will send cop request to all TiDB nodes. AllTiDB ClusterTableCopDestination = iota // DDLOwner is uese by tiflash_replica currently, means that this table will send cop request to DDL owner node. DDLOwner )
func GetClusterTableCopDestination ¶
func GetClusterTableCopDestination(tableName string) ClusterTableCopDestination
GetClusterTableCopDestination gets cluster table cop request destination.
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data is the core data struct of infoschema V2.
func (*Data) CacheCapacity ¶
CacheCapacity is exported for testing.
func (*Data) SetCacheCapacity ¶
SetCacheCapacity sets the cache capacity size in bytes.
type InfoCache ¶
type InfoCache struct { Data *Data // contains filtered or unexported fields }
InfoCache handles information schema, including getting and setting. The cache behavior, however, is transparent and under automatic management. It only promised to cache the infoschema, if it is newer than all the cached.
func NewCache ¶
func NewCache(r autoid.Requirement, capacity int) *InfoCache
NewCache creates a new InfoCache.
func (*InfoCache) GetBySnapshotTS ¶
func (h *InfoCache) GetBySnapshotTS(snapshotTS uint64) InfoSchema
GetBySnapshotTS gets the information schema based on snapshotTS. It searches the schema cache and find the schema with max schema ts that equals or smaller than given snapshot ts Where the schema ts is the commitTs of the txn creates the schema diff
func (*InfoCache) GetByVersion ¶
func (h *InfoCache) GetByVersion(version int64) InfoSchema
GetByVersion gets the information schema based on schemaVersion. Returns nil if it is not loaded.
func (*InfoCache) GetEmptySchemaVersions ¶
GetEmptySchemaVersions returns emptySchemaVersions, exports for testing.
func (*InfoCache) GetLatest ¶
func (h *InfoCache) GetLatest() InfoSchema
GetLatest gets the newest information schema.
func (*InfoCache) Insert ¶
func (h *InfoCache) Insert(is InfoSchema, schemaTS uint64) bool
Insert will **TRY** to insert the infoschema into the cache. It only promised to cache the newest infoschema. It returns 'true' if it is cached, 'false' otherwise. schemaTs is the commitTs of the txn creates the schema diff, which indicates since when the schema version is taking effect
func (*InfoCache) InsertEmptySchemaVersion ¶
InsertEmptySchemaVersion inserts empty schema version into a map. If exceeded the cache capacity, remove the oldest version.
func (*InfoCache) Upsert ¶
func (h *InfoCache) Upsert(is InfoSchema, schemaTS uint64) func()
Upsert is Resert and Insert combined, used during infoschema v1 v2 switch.
type InfoSchema ¶
type InfoSchema interface { context.MetaOnlyInfoSchema TableByName(ctx stdctx.Context, schema, table pmodel.CIStr) (table.Table, error) TableByID(ctx stdctx.Context, id int64) (table.Table, bool) SchemaNameByTableID(tableID int64) (pmodel.CIStr, bool) FindTableByPartitionID(partitionID int64) (table.Table, *model.DBInfo, *model.PartitionDefinition) // contains filtered or unexported methods }
InfoSchema is the interface used to retrieve the schema information. It works as a in memory cache and doesn't handle any schema change. InfoSchema is read-only, and the returned value is a copy.
func MockInfoSchema ¶
func MockInfoSchema(tbList []*model.TableInfo) InfoSchema
MockInfoSchema only serves for test.
func MockInfoSchemaWithSchemaVer ¶
func MockInfoSchemaWithSchemaVer(tbList []*model.TableInfo, schemaVer int64) InfoSchema
MockInfoSchemaWithSchemaVer only serves for test.
type MetricTableDef ¶
MetricTableDef is the metric table define.
func GetMetricTableDef ¶
func GetMetricTableDef(lowerTableName string) (*MetricTableDef, error)
GetMetricTableDef gets the metric table define.
type SchemaAndTableName ¶
type SchemaAndTableName struct {
// contains filtered or unexported fields
}
SchemaAndTableName contains the lower-case schema name and table name.
type ServerInfo ¶
type ServerInfo struct { ServerType string Address string StatusAddr string Version string GitHash string StartTimestamp int64 ServerID uint64 EngineRole string }
ServerInfo represents the basic server information of single cluster component
func FilterClusterServerInfo ¶
func FilterClusterServerInfo(serversInfo []ServerInfo, nodeTypes, addresses set.StringSet) []ServerInfo
FilterClusterServerInfo filters serversInfo by nodeTypes and addresses
func GetClusterServerInfo ¶
func GetClusterServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
GetClusterServerInfo returns all components information of cluster
func GetPDServerInfo ¶
func GetPDServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
GetPDServerInfo returns all PD nodes information of cluster
func GetSchedulingServerInfo ¶
func GetSchedulingServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
GetSchedulingServerInfo returns all scheduling nodes information of cluster
func GetStoreServerInfo ¶
func GetStoreServerInfo(store kv.Storage) ([]ServerInfo, error)
GetStoreServerInfo returns all store nodes(TiKV or TiFlash) cluster information
func GetTSOServerInfo ¶
func GetTSOServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
GetTSOServerInfo returns all TSO nodes information of cluster
func GetTiCDCServerInfo ¶
func GetTiCDCServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
GetTiCDCServerInfo gets server info of TiCDC from PD.
func GetTiDBServerInfo ¶
func GetTiDBServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
GetTiDBServerInfo returns all TiDB nodes information of cluster
func GetTiFlashServerInfo ¶
func GetTiFlashServerInfo(store kv.Storage) ([]ServerInfo, error)
GetTiFlashServerInfo returns all TiFlash server infos
func GetTiProxyServerInfo ¶
func GetTiProxyServerInfo(ctx sessionctx.Context) ([]ServerInfo, error)
GetTiProxyServerInfo gets server info of TiProxy from PD.
func (*ServerInfo) ResolveLoopBackAddr ¶
func (s *ServerInfo) ResolveLoopBackAddr()
ResolveLoopBackAddr exports for testing.
type SessionExtendedInfoSchema ¶
type SessionExtendedInfoSchema struct { InfoSchema LocalTemporaryTablesOnce sync.Once LocalTemporaryTables *SessionTables MdlTables *SessionTables }
SessionExtendedInfoSchema implements InfoSchema Local temporary table has a loose relationship with database. So when a database is dropped, its temporary tables still exist and can be returned by TableByName/TableByID.
func (*SessionExtendedInfoSchema) DetachTemporaryTableInfoSchema ¶
func (ts *SessionExtendedInfoSchema) DetachTemporaryTableInfoSchema() *SessionExtendedInfoSchema
DetachTemporaryTableInfoSchema returns a new SessionExtendedInfoSchema without temporary tables
func (*SessionExtendedInfoSchema) FindTableInfoByPartitionID ¶
func (ts *SessionExtendedInfoSchema) FindTableInfoByPartitionID( partitionID int64, ) (*model.TableInfo, *model.DBInfo, *model.PartitionDefinition)
FindTableInfoByPartitionID implements InfoSchema.FindTableInfoByPartitionID
func (*SessionExtendedInfoSchema) HasTemporaryTable ¶
func (ts *SessionExtendedInfoSchema) HasTemporaryTable() bool
HasTemporaryTable returns whether information schema has temporary table
func (*SessionExtendedInfoSchema) SchemaByID ¶
func (ts *SessionExtendedInfoSchema) SchemaByID(id int64) (*model.DBInfo, bool)
SchemaByID implements InfoSchema.SchemaByID, it returns a stale DBInfo even if it's dropped.
func (*SessionExtendedInfoSchema) TableByName ¶
func (ts *SessionExtendedInfoSchema) TableByName(ctx stdctx.Context, schema, table pmodel.CIStr) (table.Table, error)
TableByName implements InfoSchema.TableByName
func (*SessionExtendedInfoSchema) TableInfoByID ¶
func (ts *SessionExtendedInfoSchema) TableInfoByID(id int64) (*model.TableInfo, bool)
TableInfoByID implements InfoSchema.TableInfoByID
func (*SessionExtendedInfoSchema) TableInfoByName ¶
func (ts *SessionExtendedInfoSchema) TableInfoByName(schema, table pmodel.CIStr) (*model.TableInfo, error)
TableInfoByName implements InfoSchema.TableInfoByName
func (*SessionExtendedInfoSchema) UpdateTableInfo ¶
UpdateTableInfo implements InfoSchema.SchemaByTable.
type SessionTables ¶
type SessionTables struct {
// contains filtered or unexported fields
}
SessionTables store local temporary tables
func NewSessionTables ¶
func NewSessionTables() *SessionTables
NewSessionTables creates a new NewSessionTables object
func (*SessionTables) Count ¶
func (is *SessionTables) Count() int
Count gets the count of the temporary tables.
func (*SessionTables) RemoveTable ¶
func (is *SessionTables) RemoveTable(schema, table pmodel.CIStr) (exist bool)
RemoveTable remove a table
func (*SessionTables) SchemaByID ¶
func (is *SessionTables) SchemaByID(id int64) (*model.DBInfo, bool)
SchemaByID get a table's schema from the schema ID.
func (*SessionTables) TableByID ¶
func (is *SessionTables) TableByID(id int64) (tbl table.Table, ok bool)
TableByID get table by table id
func (*SessionTables) TableByName ¶
func (is *SessionTables) TableByName(ctx stdctx.Context, schema, table pmodel.CIStr) (table.Table, bool)
TableByName get table by name
func (*SessionTables) TableExists ¶
func (is *SessionTables) TableExists(schema, table pmodel.CIStr) (ok bool)
TableExists check if table with the name exists
type Sieve ¶
type Sieve[K comparable, V any] struct { // contains filtered or unexported fields }
Sieve is an efficient turn-Key eviction algorithm for web caches. See blog post https://cachemon.github.io/SIEVE-website/blog/2023/12/17/sieve-is-simpler-than-lru/ and also the academic paper "SIEVE is simpler than LRU"
func (*Sieve[K, V]) SetCapacity ¶
func (*Sieve[K, V]) SetCapacityAndWaitEvict ¶
func (*Sieve[K, V]) SetStatusHook ¶
func (s *Sieve[K, V]) SetStatusHook(hook sieveStatusHook)
type VirtualTable ¶
type VirtualTable struct{}
VirtualTable is a dummy table.Table implementation.
func (*VirtualTable) AddRecord ¶
func (vt *VirtualTable) AddRecord(ctx table.MutateContext, txn kv.Transaction, r []types.Datum, opts ...table.AddRecordOption) (recordID kv.Handle, err error)
AddRecord implements table.Table AddRecord interface.
func (*VirtualTable) Allocators ¶
func (vt *VirtualTable) Allocators(_ table.AllocatorContext) autoid.Allocators
Allocators implements table.Table Allocators interface.
func (*VirtualTable) Cols ¶
func (vt *VirtualTable) Cols() []*table.Column
Cols implements table.Table Cols interface.
func (*VirtualTable) DeletableCols ¶
func (vt *VirtualTable) DeletableCols() []*table.Column
DeletableCols implements table.Table WritableCols interface.
func (*VirtualTable) DeletableIndices ¶
func (vt *VirtualTable) DeletableIndices() []table.Index
DeletableIndices implements table.Table DeletableIndices interface.
func (*VirtualTable) FullHiddenColsAndVisibleCols ¶
func (vt *VirtualTable) FullHiddenColsAndVisibleCols() []*table.Column
FullHiddenColsAndVisibleCols implements table FullHiddenColsAndVisibleCols interface.
func (*VirtualTable) GetPhysicalID ¶
func (vt *VirtualTable) GetPhysicalID() int64
GetPhysicalID implements table.Table GetPhysicalID interface.
func (*VirtualTable) HiddenCols ¶
func (vt *VirtualTable) HiddenCols() []*table.Column
HiddenCols implements table.Table HiddenCols interface.
func (*VirtualTable) IndexPrefix ¶
func (vt *VirtualTable) IndexPrefix() kv.Key
IndexPrefix implements table.Table IndexPrefix interface.
func (*VirtualTable) Indices ¶
func (vt *VirtualTable) Indices() []table.Index
Indices implements table.Table Indices interface.
func (*VirtualTable) Meta ¶
func (vt *VirtualTable) Meta() *model.TableInfo
Meta implements table.Table Meta interface.
func (*VirtualTable) RecordPrefix ¶
func (vt *VirtualTable) RecordPrefix() kv.Key
RecordPrefix implements table.Table RecordPrefix interface.
func (*VirtualTable) RemoveRecord ¶
func (vt *VirtualTable) RemoveRecord(ctx table.MutateContext, txn kv.Transaction, h kv.Handle, r []types.Datum, opts ...table.RemoveRecordOption) error
RemoveRecord implements table.Table RemoveRecord interface.
func (*VirtualTable) Type ¶
func (vt *VirtualTable) Type() table.Type
Type implements table.Table Type interface.
func (*VirtualTable) UpdateRecord ¶
func (vt *VirtualTable) UpdateRecord(ctx table.MutateContext, txn kv.Transaction, h kv.Handle, oldData, newData []types.Datum, touched []bool, opts ...table.UpdateRecordOption) error
UpdateRecord implements table.Table UpdateRecord interface.
func (*VirtualTable) VisibleCols ¶
func (vt *VirtualTable) VisibleCols() []*table.Column
VisibleCols implements table.Table VisibleCols interface.
func (*VirtualTable) WritableCols ¶
func (vt *VirtualTable) WritableCols() []*table.Column
WritableCols implements table.Table WritableCols interface.
func (*VirtualTable) WritableConstraint ¶
func (vt *VirtualTable) WritableConstraint() []*table.Constraint
WritableConstraint implements table.Table WritableConstraint interface.