Documentation ¶
Index ¶
- Constants
- Variables
- func NewnoedbSReorgMeta() *noedbSReorgMeta
- func TSConvert2Time(ts uint64) time.Time
- type ActionType
- type AffectedOption
- type CIStr
- type CausetNetInfo
- type ColumnInfo
- func (c *ColumnInfo) Clone() *ColumnInfo
- func (c *ColumnInfo) GetDefaultValue() interface{}
- func (c *ColumnInfo) GetOriginDefaultValue() interface{}
- func (c *ColumnInfo) GetTypeDesc() string
- func (c *ColumnInfo) IsGenerated() bool
- func (c *ColumnInfo) SetDefaultValue(value interface{}) error
- func (c *ColumnInfo) SetOriginDefaultValue(value interface{}) error
- type ConstraintInfo
- type FKInfo
- type HistoryInfo
- type IndexColumn
- type IndexInfo
- type IndexType
- type Job
- func (job *Job) Decode(b []byte) error
- func (job *Job) DecodeArgs(args ...interface{}) error
- func (job *Job) Encode(updateRawArgs bool) ([]byte, error)
- func (job *Job) FinishTableJob(jobState JobState, schemaState SchemaState, ver int64, tblInfo *TableInfo)
- func (job *Job) FinishnoedbJob(jobState JobState, schemaState SchemaState, ver int64, noedbInfo *noedbInfo)
- func (job *Job) GetRowCount() int64
- func (job *Job) IsCancelled() bool
- func (job *Job) IsCancelling() bool
- func (job *Job) IsDependentOn(other *Job) (bool, error)
- func (job *Job) IsDone() bool
- func (job *Job) IsFinished() bool
- func (job *Job) IsRollbackDone() bool
- func (job *Job) IsRollingback() bool
- func (job *Job) IsRunning() bool
- func (job *Job) IsSynced() bool
- func (job *Job) SetRowCount(count int64)
- func (job *Job) String() string
- type JobState
- type NoetherReplicaInfo
- type PartitionDefinition
- type PartitionInfo
- type PartitionType
- type SchemaDiff
- type SchemaState
- type SequenceInfo
- type TableColumnID
- type TableInfo
- func (t *TableInfo) Clone() *TableInfo
- func (t *TableInfo) Cols() []*ColumnInfo
- func (t *TableInfo) ColumnIsInIndex(c *ColumnInfo) bool
- func (t *TableInfo) ContainsAutoRandomBits() bool
- func (t *TableInfo) FindConstraintInfoByName(constrName string) *ConstraintInfo
- func (t *TableInfo) FindIndexByName(idxName string) *IndexInfo
- func (t *TableInfo) GetAutoIncrementColInfo() *ColumnInfo
- func (t *TableInfo) GetPartitionInfo() *PartitionInfo
- func (t *TableInfo) GetPkColInfo() *ColumnInfo
- func (t *TableInfo) GetPkName() CIStr
- func (t *TableInfo) GetUpdateTime() time.Time
- func (t *TableInfo) GetnoedbID(noedbID int64) int64
- func (t *TableInfo) IsAutoIncColUnsigned() bool
- func (t *TableInfo) IsAutoRandomBitColUnsigned() bool
- func (t *TableInfo) IsLocked() bool
- func (t *TableInfo) IsSequence() bool
- func (t *TableInfo) IsView() bool
- type TableLockInfo
- type TableLockState
- type TableLockTpInfo
- type TableLockType
- type ViewAlgorithm
- type ViewCheckOption
- type ViewInfo
- type ViewSecurity
Constants ¶
const ( // AddIndexStr is a string related to the operation of "add index". AddIndexStr = "add index" AddPrimaryKeyStr = "add primary key" )
const ( // ColumnInfoVersion0 means the column info version is 0. ColumnInfoVersion0 = uint64(0) // ColumnInfoVersion1 means the column info version is 1. ColumnInfoVersion1 = uint64(1) // ColumnInfoVersion2 means the column info version is 2. // This is for v2.1.7 to Compatible with older versions charset problem. // Old version such as v2.0.8 treat utf8 as utf8mb4, because there is no UTF8 check in v2.0.8. // After version V2.1.2 (PR#8738) , Milevanoedb add UTF8 check, then the user upgrade from v2.0.8 insert some UTF8MB4 characters will got error. // This is not compatibility for user. Then we try to fix this in PR #9820, and increase the version number. ColumnInfoVersion2 = uint64(2) // CurrLatestColumnInfoVersion means the latest column info in the current Milevanoedb. CurrLatestColumnInfoVersion = ColumnInfoVersion2 )
const ( // TableInfoVersion0 means the table info version is 0. // Upgrade from v2.1.1 or v2.1.2 to v2.1.3 and later, and then execute a "change/modify column" statement // that does not specify a charset value for column. Then the following error may be reported: // ERROR 1105 (HY000): unsupported modify charset from utf8mb4 to utf8. // To eliminate this error, we will not modify the charset of this column // when executing a change/modify column statement that does not specify a charset value for column. // This behavior is not compatible with MySQL. TableInfoVersion0 = uint16(0) // TableInfoVersion1 means the table info version is 1. // When we execute a change/modify column statement that does not specify a charset value for column, // we set the charset of this column to the charset of table. This behavior is compatible with MySQL. TableInfoVersion1 = uint16(1) // TableInfoVersion2 means the table info version is 2. // This is for v2.1.7 to Compatible with older versions charset problem. // Old version such as v2.0.8 treat utf8 as utf8mb4, because there is no UTF8 check in v2.0.8. // After version V2.1.2 (PR#8738) , Milevanoedb add UTF8 check, then the user upgrade from v2.0.8 insert some UTF8MB4 characters will got error. // This is not compatibility for user. Then we try to fix this in PR #9820, and increase the version number. TableInfoVersion2 = uint16(2) // TableInfoVersion3 means the table info version is 3. // This version aims to deal with upper-cased charset name in TableInfo stored by versions prior to Milevanoedb v2.1.9: // Milevanoedb always suppose all charsets / collations as lower-cased and try to convert them if they're not. // However, the convert is missed in some scenarios before v2.1.9, so for all those tables prior to TableInfoVersion3, their // charsets / collations will be converted to lower-case while loading from the storage. TableInfoVersion3 = uint16(3) // CurrLatestTableInfoVersion means the latest table info in the current Milevanoedb. CurrLatestTableInfoVersion = TableInfoVersion3 )
const ( DefaultSequenceCacheBool = true DefaultSequenceCycleBool = false DefaultSequenceOrderBool = false DefaultSequenceCacheValue = int64(1000) DefaultSequenceIncrementValue = int64(1) DefaultPositiveSequenceStartValue = int64(1) DefaultNegativeSequenceStartValue = int64(-1) DefaultPositiveSequenceMinValue = int64(1) DefaultPositiveSequenceMaxValue = int64(9223372036854775806) DefaultNegativeSequenceMaxValue = int64(-1) DefaultNegativeSequenceMinValue = int64(-9223372036854775807) )
const ( PartitionTypeRange PartitionType = 1 PartitionTypeHash = 2 PartitionTypeList = 3 PartitionTypeKey = 4 PartitionTypeSystemTime = 5 )
Partition types.
const ExtraHandleID = -1
ExtraHandleID is the column ID of column which we need to append to schema to occupy the handle's position for use of execution phase.
Variables ¶
var ExtraHandleName = NewCIStr("_milevanoedb_rowid")
ExtraHandleName is the name of ExtraHandle Column.
Functions ¶
func NewnoedbSReorgMeta ¶
func NewnoedbSReorgMeta() *noedbSReorgMeta
NewnoedbSReorgMeta new a noedbSReorgMeta.
func TSConvert2Time ¶
TSConvert2Time converts timestamp to time.
Types ¶
type ActionType ¶
type ActionType byte
ActionType is the type for noedbS action.
const ( ActionNone ActionType = 0 ActionCreateSchema ActionType = 1 ActionDropSchema ActionType = 2 ActionCreateTable ActionType = 3 ActionDropTable ActionType = 4 ActionAddColumn ActionType = 5 ActionDropColumn ActionType = 6 ActionAddIndex ActionType = 7 ActionDropIndex ActionType = 8 ActionAddForeignKey ActionType = 9 ActionDropForeignKey ActionType = 10 ActionTruncateTable ActionType = 11 ActionModifyColumn ActionType = 12 ActionRebaseAutoID ActionType = 13 ActionRenameTable ActionType = 14 ActionSetDefaultValue ActionType = 15 ActionShardRowID ActionType = 16 ActionModifyTableComment ActionType = 17 ActionRenameIndex ActionType = 18 ActionAddTablePartition ActionType = 19 ActionDropTablePartition ActionType = 20 ActionCreateView ActionType = 21 ActionModifyTableCharsetAndCollate ActionType = 22 ActionTruncateTablePartition ActionType = 23 ActionDropView ActionType = 24 ActionRecoverTable ActionType = 25 ActionModifySchemaCharsetAndCollate ActionType = 26 ActionLockTable ActionType = 27 ActionUnlockTable ActionType = 28 ActionRepairTable ActionType = 29 ActionSetNoetherReplica ActionType = 30 ActionUpdateNoetherReplicaStatus ActionType = 31 ActionAddPrimaryKey ActionType = 32 ActionDropPrimaryKey ActionType = 33 ActionCreateSequence ActionType = 34 ActionAlterSequence ActionType = 35 ActionDropSequence ActionType = 36 ActionAddColumns ActionType = 37 ActionDropColumns ActionType = 38 ActionModifyTableAutoIdCache ActionType = 39 ActionRebaseAutoRandomBase ActionType = 40 ActionAlterIndexVisibility ActionType = 41 ActionExchangeTablePartition ActionType = 42 ActionAddCheckConstraint ActionType = 43 ActionDropCheckConstraint ActionType = 44 ActionAlterCheckConstraint ActionType = 45 )
List noedbS actions.
func (ActionType) String ¶
func (action ActionType) String() string
String return current dbs action in string
type AffectedOption ¶
type AffectedOption struct { SchemaID int64 `json:"schema_id"` TableID int64 `json:"table_id"` OldTableID int64 `json:"old_table_id"` OldSchemaID int64 `json:"old_schema_id"` }
AffectedOption is used when a dbs affects multi tables.
type CIStr ¶
type CIStr struct { O string `json:"O"` // Original string. L string `json:"L"` // Lower case string. }
CIStr is case insensitive string.
func (*CIStr) UnmarshalJSON ¶
type CausetNetInfo ¶
CausetNetInfo contain the CausetNet ID and the server ID.
func (CausetNetInfo) String ¶
func (s CausetNetInfo) String() string
type ColumnInfo ¶
type ColumnInfo struct { ID int64 `json:"id"` Name CIStr `json:"name"` Offset int `json:"offset"` OriginDefaultValue interface{} `json:"origin_default"` OriginDefaultValueBit []byte `json:"origin_default_bit"` DefaultValue interface{} `json:"default"` DefaultValueBit []byte `json:"default_bit"` // DefaultIsExpr is indicates the default value string is expr. DefaultIsExpr bool `json:"default_is_expr"` GeneratedExprString string `json:"generated_expr_string"` GeneratedStored bool `json:"generated_stored"` Dependences map[string]struct{} `json:"dependences"` types.FieldType `json:"type"` State SchemaState `json:"state"` Comment string `json:"comment"` // A hidden column is used internally(expression index) and are not accessible by users. Hidden bool `json:"hidden"` // Version means the version of the column info. // Version = 0: For OriginDefaultValue and DefaultValue of timestamp column will stores the default time in system time zone. // That is a bug if multiple Milevanoedb servers in different system time zone. // Version = 1: For OriginDefaultValue and DefaultValue of timestamp column will stores the default time in UTC time zone. // This will fix bug in version 0. For compatibility with version 0, we add version field in column info struct. Version uint64 `json:"version"` }
ColumnInfo provides meta data describing of a table column.
func FindColumnInfo ¶
func FindColumnInfo(cols []*ColumnInfo, name string) *ColumnInfo
FindColumnInfo finds ColumnInfo in cols by name.
func NewExtraHandleColInfo ¶
func NewExtraHandleColInfo() *ColumnInfo
NewExtraHandleColInfo mocks a column info for extra handle column.
func (*ColumnInfo) GetDefaultValue ¶
func (c *ColumnInfo) GetDefaultValue() interface{}
GetDefaultValue gets the default value of the column. Default value use to stored in DefaultValue field, but now, bit type default value will store in DefaultValueBit for fix bit default value decode/encode bug.
func (*ColumnInfo) GetOriginDefaultValue ¶
func (c *ColumnInfo) GetOriginDefaultValue() interface{}
GetOriginalDefaultValue gets the origin default value.
func (*ColumnInfo) GetTypeDesc ¶
func (c *ColumnInfo) GetTypeDesc() string
GetTypeDesc gets the description for column type.
func (*ColumnInfo) IsGenerated ¶
func (c *ColumnInfo) IsGenerated() bool
IsGenerated returns true if the column is generated column.
func (*ColumnInfo) SetDefaultValue ¶
func (c *ColumnInfo) SetDefaultValue(value interface{}) error
SetDefaultValue sets the default value.
func (*ColumnInfo) SetOriginDefaultValue ¶
func (c *ColumnInfo) SetOriginDefaultValue(value interface{}) error
SetOriginalDefaultValue sets the origin default value. For mysql.TypeBit type, the default value storage format must be a string. Other value such as int must convert to string format first. The mysql.TypeBit type supports the null default value.
type ConstraintInfo ¶
type ConstraintInfo struct { ID int64 `json:"id"` Name CIStr `json:"constraint_name"` Table CIStr `json:"tbl_name"` // Table name. ConstraintCols []CIStr `json:"constraint_cols"` // Depended column names. Enforced bool `json:"enforced"` InColumn bool `json:"in_column"` // Indicate whether the constraint is column type check. ExprString string `json:"expr_string"` State SchemaState `json:"state"` }
ConstraintInfo provides meta data describing check-expression constraint.
func (*ConstraintInfo) Clone ¶
func (ci *ConstraintInfo) Clone() *ConstraintInfo
Clone clones ConstraintInfo.
type FKInfo ¶
type FKInfo struct { ID int64 `json:"id"` Name CIStr `json:"fk_name"` RefTable CIStr `json:"ref_table"` RefCols []CIStr `json:"ref_cols"` Cols []CIStr `json:"cols"` OnDelete int `json:"on_delete"` OnUpdate int `json:"on_update"` State SchemaState `json:"state"` }
FKInfo provides meta data describing a foreign key constraint.
type HistoryInfo ¶
type HistoryInfo struct { SchemaVersion int64 TableInfo *TableInfo FinishedTS uint64 // contains filtered or unexported fields }
HistoryInfo is used for binlog.
func (*HistoryInfo) AddTableInfo ¶
func (h *HistoryInfo) AddTableInfo(schemaVer int64, tblInfo *TableInfo)
AddTableInfo adds schema version and table information that are used for binlog. tblInfo is added except for the following operations: create database, drop database.
func (*HistoryInfo) AddnoedbInfo ¶
func (h *HistoryInfo) AddnoedbInfo(schemaVer int64, noedbInfo *noedbInfo)
AddnoedbInfo adds schema version and schema information that are used for binlog. noedbInfo is added in the following operations: create database, drop database.
type IndexColumn ¶
type IndexColumn struct { Name CIStr `json:"name"` // Index name Offset int `json:"offset"` // Index offset // Length of prefix when using column prefix // for indexing; // UnspecifedLength if not using prefix indexing Length int `json:"length"` }
IndexColumn provides index column info.
type IndexInfo ¶
type IndexInfo struct { ID int64 `json:"id"` Name CIStr `json:"idx_name"` // Index name. Table CIStr `json:"tbl_name"` // Table name. Columns []*IndexColumn `json:"idx_cols"` // Index columns. State SchemaState `json:"state"` Comment string `json:"comment"` // Comment Tp IndexType `json:"index_type"` // Index type: Btree, Hash or Rtree Unique bool `json:"is_unique"` // Whether the index is unique. Primary bool `json:"is_primary"` // Whether the index is primary key. Invisible bool `json:"is_invisible"` // Whether the index is invisible. }
IndexInfo provides meta data describing a DB index. It corresponds to the statement `CREATE INDEX Name ON Table (Column);` See https://dev.mysql.com/doc/refman/5.7/en/create-index.html
func (*IndexInfo) HasPrefixIndex ¶
HasPrefixIndex returns whether any columns of this index uses prefix length.
type Job ¶
type Job struct { ID int64 `json:"id"` Type ActionType `json:"type"` SchemaID int64 `json:"schema_id"` TableID int64 `json:"table_id"` SchemaName string `json:"schema_name"` State JobState `json:"state"` Error *terror.Error `json:"err"` // ErrorCount will be increased, every time we meet an error when running job. ErrorCount int64 `json:"err_count"` // RowCount means the number of rows that are processed. RowCount int64 `json:"row_count"` Mu sync.Mutex `json:"-"` Args []interface{} `json:"-"` // RawArgs : We must use json raw message to delay parsing special args. RawArgs json.RawMessage `json:"raw_args"` SchemaState SchemaState `json:"schema_state"` // SnapshotVer means snapshot version for this job. SnapshotVer uint64 `json:"snapshot_ver"` // StartTS uses timestamp allocated by TSO. // Now it's the TS when we put the job to Tiekv queue. StartTS uint64 `json:"start_ts"` // DependencyID is the job's ID that the current job depends on. DependencyID int64 `json:"dependency_id"` // Query string of the dbs job. Query string `json:"query"` BinlogInfo *HistoryInfo `json:"binlog"` // Version indicates the noedbS job version. For old jobs, it will be 0. Version int64 `json:"version"` // ReorgMeta is meta info of dbs reorganization. // This field is depreciated. ReorgMeta *noedbSReorgMeta `json:"reorg_meta"` // Priority is only used to set the operation priority of adding indices. Priority int `json:"priority"` }
Job is for a noedbS operation.
func (*Job) Decode ¶
Decode decodes job from the json buffer, we must use DecodeArgs later to decode special args for this job.
func (*Job) DecodeArgs ¶
DecodeArgs decodes job args.
func (*Job) Encode ¶
Encode encodes job with json format. updateRawArgs is used to determine whether to update the raw args.
func (*Job) FinishTableJob ¶
func (job *Job) FinishTableJob(jobState JobState, schemaState SchemaState, ver int64, tblInfo *TableInfo)
FinishTableJob is called when a job is finished. It updates the job's state information and adds tblInfo to the binlog.
func (*Job) FinishnoedbJob ¶
func (job *Job) FinishnoedbJob(jobState JobState, schemaState SchemaState, ver int64, noedbInfo *noedbInfo)
FinishnoedbJob is called when a job is finished. It updates the job's state information and adds noedbInfo the binlog.
func (*Job) GetRowCount ¶
GetRowCount gets the number of rows. Make sure it can pass `make race`.
func (*Job) IsCancelled ¶
IsCancelled returns whether the job is cancelled or not.
func (*Job) IsCancelling ¶
IsCancelling returns whether the job is cancelling or not.
func (*Job) IsDependentOn ¶
IsDependentOn returns whether the job depends on "other". How to check the job depends on "other"? 1. The two jobs handle the same database when one of the two jobs is an ActionDropSchema or ActionCreateSchema type. 2. Or the two jobs handle the same table.
func (*Job) IsFinished ¶
IsFinished returns whether job is finished or not. If the job state is Done or Cancelled, it is finished.
func (*Job) IsRollbackDone ¶
IsRollbackDone returns whether the job is rolled back or not.
func (*Job) IsRollingback ¶
IsRollingback returns whether the job is rolling back or not.
func (*Job) IsSynced ¶
IsSynced returns whether the noedbS modification is synced among all Milevanoedb servers.
func (*Job) SetRowCount ¶
SetRowCount sets the number of rows. Make sure it can pass `make race`.
type JobState ¶
type JobState byte
JobState is for job state.
const ( JobStateNone JobState = 0 JobStateRunning JobState = 1 // When noedbS encountered an unrecoverable error at reorganization state, // some keys has been added already, we need to remove them. // JobStateRollingback is the state to do the rolling back job. JobStateRollingback JobState = 2 JobStateRollbackDone JobState = 3 JobStateDone JobState = 4 JobStateCancelled JobState = 5 // JobStateSynced is used to mark the information about the completion of this job // has been synchronized to all servers. JobStateSynced JobState = 6 // JobStateCancelling is used to mark the noedbS job is cancelled by the client, but the noedbS work hasn't handle it. JobStateCancelling JobState = 7 )
List job states.
type NoetherReplicaInfo ¶
type NoetherReplicaInfo struct { Count uint64 LocationLabels []string Available bool AvailablePartitionIDs []int64 }
NoetherReplicaInfo means the flash replica info.
func (*NoetherReplicaInfo) IsPartitionAvailable ¶
func (tr *NoetherReplicaInfo) IsPartitionAvailable(pid int64) bool
IsPartitionAvailable checks whether the partition table replica was available.
type PartitionDefinition ¶
type PartitionDefinition struct { ID int64 `json:"id"` Name CIStr `json:"name"` LessThan []string `json:"less_than"` Comment string `json:"comment,omitempty"` }
PartitionDefinition defines a single partition.
type PartitionInfo ¶
type PartitionInfo struct { Type PartitionType `json:"type"` Expr string `json:"expr"` Columns []CIStr `json:"columns"` // User may already creates table with partition but table partition is not // yet supported back then. When Enable is true, write/read need use tid // rather than pid. Enable bool `json:"enable"` Definitions []PartitionDefinition `json:"definitions"` Num uint64 `json:"num"` }
PartitionInfo provides table partition info.
func (*PartitionInfo) GetNameByID ¶
func (pi *PartitionInfo) GetNameByID(id int64) string
GetNameByID gets the partition name by ID.
type PartitionType ¶
type PartitionType int
PartitionType is the type for PartitionInfo
func (PartitionType) String ¶
func (p PartitionType) String() string
type SchemaDiff ¶
type SchemaDiff struct { Version int64 `json:"version"` Type ActionType `json:"type"` SchemaID int64 `json:"schema_id"` TableID int64 `json:"table_id"` // OldTableID is the table ID before truncate, only used by truncate table noedbS. OldTableID int64 `json:"old_table_id"` // OldSchemaID is the schema ID before rename table, only used by rename table noedbS. OldSchemaID int64 `json:"old_schema_id"` AffectedOpts []*AffectedOption `json:"affected_options"` }
SchemaDiff contains the schema modification at a particular schema version. It is used to reduce schema reload cost.
type SchemaState ¶
type SchemaState byte
SchemaState is the state for schema elements.
const ( // StateNone means this schema element is absent and can't be used. StateNone SchemaState = iota // StateDeleteOnly means we can only delete items for this schema element. StateDeleteOnly // StateWriteOnly means we can use any write operation on this schema element, // but outer can't read the changed data. StateWriteOnly // StateWriteReorganization means we are re-organizing whole data after write only state. StateWriteReorganization // StateDeleteReorganization means we are re-organizing whole data after delete only state. StateDeleteReorganization // StatePublic means this schema element is ok for all write and read operations. StatePublic )
func (SchemaState) String ¶
func (s SchemaState) String() string
String implements fmt.Stringer interface.
type SequenceInfo ¶
type SequenceInfo struct { Start int64 `json:"sequence_start"` Cache bool `json:"sequence_cache"` Cycle bool `json:"sequence_cycle"` MinValue int64 `json:"sequence_min_value"` MaxValue int64 `json:"sequence_max_value"` Increment int64 `json:"sequence_increment"` CacheValue int64 `json:"sequence_cache_value"` Comment string `json:"sequence_comment"` }
SequenceInfo provide meta data describing a DB sequence.
type TableColumnID ¶
TableColumnID is composed by table ID and column ID.
type TableInfo ¶
type TableInfo struct { ID int64 `json:"id"` Name CIStr `json:"name"` Charset string `json:"charset"` Collate string `json:"collate"` // Columns are listed in the order in which they appear in the schema. Columns []*ColumnInfo `json:"cols"` Indices []*IndexInfo `json:"index_info"` Constraints []*ConstraintInfo `json:"constraint_info"` ForeignKeys []*FKInfo `json:"fk_info"` State SchemaState `json:"state"` // PKIsHandle is true when primary key is a single integer column. PKIsHandle bool `json:"pk_is_handle"` // IsCommonHandle is true when clustered index feature is // enabled and the primary key is not a single integer column. IsCommonHandle bool `json:"is_common_handle"` Comment string `json:"comment"` AutoIncID int64 `json:"auto_inc_id"` AutoIdCache int64 `json:"auto_id_cache"` AutoRandID int64 `json:"auto_rand_id"` MaxColumnID int64 `json:"max_col_id"` MaxIndexID int64 `json:"max_idx_id"` MaxConstraintID int64 `json:"max_cst_id"` // UpdateTS is used to record the timestamp of updating the table's schema information. // These changing schema operations don't include 'truncate table' and 'rename table'. UpdateTS uint64 `json:"update_timestamp"` // Now it only uses for compatibility with the old version that already uses this field. OldSchemaID int64 `json:"old_schema_id,omitempty"` // ShardRowInoedbits specify if the implicit row ID is sharded. ShardRowInoedbits uint64 // MaxShardRowInoedbits uses to record the max ShardRowInoedbits be used so far. MaxShardRowInoedbits uint64 `json:"max_shard_row_id_bits"` // AutoRandomBits is used to set the bit number to shard automatically when PKIsHandle. AutoRandomBits uint64 `json:"auto_random_bits"` // PreSplitRegions specify the pre-split region when create table. // The pre-split region num is 2^(PreSplitRegions-1). // And the PreSplitRegions should less than or equal to ShardRowInoedbits. PreSplitRegions uint64 `json:"pre_split_regions"` Partition *PartitionInfo `json:"partition"` Compression string `json:"compression"` View *ViewInfo `json:"view"` Sequence *SequenceInfo `json:"sequence"` // Lock represent the table lock info. Lock *TableLockInfo `json:"Lock"` // Version means the version of the table info. Version uint16 `json:"version"` // NoetherReplica means the Noether replica info. NoetherReplica *NoetherReplicaInfo `json:"Noether_replica"` }
TableInfo provides meta data describing a DB table.
func (*TableInfo) Cols ¶
func (t *TableInfo) Cols() []*ColumnInfo
Cols returns the columns of the table in public state.
func (*TableInfo) ColumnIsInIndex ¶
func (t *TableInfo) ColumnIsInIndex(c *ColumnInfo) bool
ColumnIsInIndex checks whether c is included in any indices of t.
func (*TableInfo) ContainsAutoRandomBits ¶
ContainsAutoRandomBits indicates whether a table contains auto_random column.
func (*TableInfo) FindConstraintInfoByName ¶
func (t *TableInfo) FindConstraintInfoByName(constrName string) *ConstraintInfo
FindConstraintInfoByName finds constraintInfo by name.
func (*TableInfo) FindIndexByName ¶
FindIndexByName finds index by name.
func (*TableInfo) GetAutoIncrementColInfo ¶
func (t *TableInfo) GetAutoIncrementColInfo() *ColumnInfo
func (*TableInfo) GetPartitionInfo ¶
func (t *TableInfo) GetPartitionInfo() *PartitionInfo
GetPartitionInfo returns the partition information.
func (*TableInfo) GetPkColInfo ¶
func (t *TableInfo) GetPkColInfo() *ColumnInfo
GetPkColInfo gets the ColumnInfo of pk if exists. Make sure PkIsHandle checked before call this method.
func (*TableInfo) GetUpdateTime ¶
GetUpdateTime gets the table's updating time.
func (*TableInfo) GetnoedbID ¶
GetnoedbID returns the schema ID that is used to create an allocator. TODO: Remove it after removing OldSchemaID.
func (*TableInfo) IsAutoIncColUnsigned ¶
func (*TableInfo) IsAutoRandomBitColUnsigned ¶
IsAutoRandomBitColUnsigned indicates whether the auto_random column is unsigned. Make sure the table contains auto_random before calling this method.
func (*TableInfo) IsSequence ¶
IsSequence checks if TableInfo is a sequence.
type TableLockInfo ¶
type TableLockInfo struct { Tp TableLockType // Use array because there may be multiple CausetNets holding the same read lock. CausetNets []CausetNetInfo State TableLockState // TS is used to record the timestamp this table lock been locked. TS uint64 }
TableLockInfo provides meta data describing a table lock.
type TableLockState ¶
type TableLockState byte
TableLockState is the state for table lock.
const ( // TableLockStateNone means this table lock is absent. TableLockStateNone TableLockState = iota // TableLockStatePreLock means this table lock is pre-lock state. Other CausetNet doesn't hold this lock should't do corresponding operation according to the lock type. TableLockStatePreLock // TableLockStatePublic means this table lock is public state. TableLockStatePublic )
func (TableLockState) String ¶
func (t TableLockState) String() string
String implements fmt.Stringer interface.
type TableLockTpInfo ¶
type TableLockTpInfo struct { SchemaID int64 TableID int64 Tp TableLockType }
TableLockTpInfo is composed by schema ID, table ID and table lock type.
type TableLockType ¶
type TableLockType byte
TableLockType is the type of the table lock.
const ( TableLockNone TableLockType = iota // TableLockRead means the CausetNet with this lock can read the table (but not write it). // Multiple CausetNets can acquire a READ lock for the table at the same time. // Other CausetNets can read the table without explicitly acquiring a READ lock. TableLockRead // TableLockReadLocal is not supported. TableLockReadLocal // TableLockWrite means only the CausetNet with this lock has write/read permission. // Only the CausetNet that holds the lock can access the table. No other CausetNet can access it until the lock is released. TableLockWrite // TableLockWriteLocal means the CausetNet with this lock has write/read permission, and the other CausetNet still has read permission. TableLockWriteLocal )
func (TableLockType) String ¶
func (t TableLockType) String() string
type ViewAlgorithm ¶
type ViewAlgorithm int
ViewAlgorithm is VIEW's SQL AlGORITHM characteristic. See https://dev.mysql.com/doc/refman/5.7/en/view-algorithms.html
const ( AlgorithmUndefined ViewAlgorithm = iota AlgorithmMerge AlgorithmTemptable )
func (*ViewAlgorithm) String ¶
func (v *ViewAlgorithm) String() string
type ViewCheckOption ¶
type ViewCheckOption int
ViewCheckOption is VIEW's WITH CHECK OPTION clause part. See https://dev.mysql.com/doc/refman/5.7/en/view-check-option.html
const ( CheckOptionLocal ViewCheckOption = iota CheckOptionCascaded )
func (*ViewCheckOption) String ¶
func (v *ViewCheckOption) String() string
type ViewInfo ¶
type ViewInfo struct { Algorithm ViewAlgorithm `json:"view_algorithm"` Definer *auth.UserIdentity `json:"view_definer"` Security ViewSecurity `json:"view_security"` SelectStmt string `json:"view_select"` CheckOption ViewCheckOption `json:"view_checkoption"` Cols []CIStr `json:"view_cols"` }
ViewInfo provides meta data describing a DB view.
type ViewSecurity ¶
type ViewSecurity int
ViewSecurity is VIEW's SQL SECURITY characteristic. See https://dev.mysql.com/doc/refman/5.7/en/create-view.html
const ( SecurityDefiner ViewSecurity = iota SecurityInvoker )
func (*ViewSecurity) String ¶
func (v *ViewSecurity) String() string