Documentation ¶
Index ¶
- Constants
- Variables
- func AutoIncrementIDKey(tableID int64) []byte
- func AutoRandomTableIDKey(tableID int64) []byte
- func AutoTableIDKey(tableID int64) []byte
- func DBkey(dbID int64) []byte
- func DDLJobHistoryKey(m *Mutator, jobID int64) []byte
- func DefaultGroupMeta4Test() *model.ResourceGroupInfo
- func ExtractSchemaAndTableNameFromJob(data []byte) (schemaName, tableName string, err error)
- func FastUnmarshalTableNameInfo(data []byte) (*model.TableNameInfo, error)
- func GetTableInfoWithAttributes(m *Mutator, dbID int64, filterAttrs ...string) ([]*model.TableInfo, error)
- func IsAutoIncrementIDKey(key []byte) bool
- func IsAutoRandomTableIDKey(key []byte) bool
- func IsAutoTableIDKey(key []byte) bool
- func IsDBkey(dbKey []byte) bool
- func IsJobMatch(job []byte, schemaNames, tableNames set.StringSet) (match bool, err error)
- func IsSequenceKey(key []byte) bool
- func IsTableInfoMustLoad(json []byte) bool
- func IsTableKey(tableKey []byte) bool
- func ParseAutoIncrementIDKey(key []byte) (int64, error)
- func ParseAutoRandomTableIDKey(key []byte) (int64, error)
- func ParseAutoTableIDKey(key []byte) (int64, error)
- func ParseDBKey(dbkey []byte) (int64, error)
- func ParseSequenceKey(key []byte) (int64, error)
- func ParseTableKey(tableKey []byte) (int64, error)
- func SequenceKey(sequenceID int64) []byte
- func TableKey(tableID int64) []byte
- func Unescape(s string) string
- type AccessorPicker
- type AutoIDAccessor
- type AutoIDAccessors
- type DDLTableVersion
- type DailyRUStats
- type Element
- type ElementKeyType
- type GroupRUStats
- type HLastJobIterator
- type JobListKeyType
- type LastJobIterator
- type Mutator
- func (m *Mutator) AddHistoryDDLJob(job *model.Job, updateRawArgs bool) error
- func (m *Mutator) AddResourceGroup(group *model.ResourceGroupInfo) error
- func (m *Mutator) AdvanceGlobalIDs(n int) (int64, error)
- func (m *Mutator) CheckDDLTableVersion() (DDLTableVersion, error)
- func (m *Mutator) CheckTableExists(dbID int64, tableID int64) (bool, error)
- func (m *Mutator) ClearBDRRole() error
- func (m *Mutator) CreateDatabase(dbInfo *model.DBInfo) error
- func (m *Mutator) CreateMySQLDatabaseIfNotExists() (int64, error)
- func (m *Mutator) CreatePolicy(policy *model.PolicyInfo) error
- func (m *Mutator) CreateSequenceAndSetSeqValue(dbID int64, tableInfo *model.TableInfo, seqValue int64) error
- func (m *Mutator) CreateTableAndSetAutoID(dbID int64, tableInfo *model.TableInfo, autoIDs model.AutoIDGroup) error
- func (m *Mutator) CreateTableOrView(dbID int64, tableInfo *model.TableInfo) error
- func (m *Mutator) DropDatabase(dbID int64) error
- func (m *Mutator) DropPolicy(policyID int64) error
- func (m *Mutator) DropResourceGroup(groupID int64) error
- func (m *Mutator) DropSequence(dbID int64, tblID int64) error
- func (m *Mutator) DropTableOrView(dbID int64, tblID int64) error
- func (m *Mutator) EncodeSchemaDiffKey(schemaVersion int64) kv.Key
- func (m *Mutator) FinishBootstrap(version int64) error
- func (m *Mutator) GenAutoTableIDKeyValue(dbID, tableID, autoID int64) (key, value []byte)
- func (m *Mutator) GenGlobalID() (int64, error)
- func (m *Mutator) GenGlobalIDs(n int) ([]int64, error)
- func (m *Mutator) GenPlacementPolicyID() (int64, error)
- func (m *Mutator) GenSchemaVersion() (int64, error)
- func (m *Mutator) GenSchemaVersions(count int64) (int64, error)
- func (m *Mutator) GetAllNameToIDAndTheMustLoadedTableInfo(dbID int64) (map[string]int64, []*model.TableInfo, error)
- func (m *Mutator) GetAutoIDAccessors(dbID, tableID int64) AutoIDAccessors
- func (m *Mutator) GetBDRRole() (string, error)
- func (m *Mutator) GetBootstrapVersion() (int64, error)
- func (m *Mutator) GetDatabase(dbID int64) (*model.DBInfo, error)
- func (m *Mutator) GetGlobalID() (int64, error)
- func (m *Mutator) GetHistoryDDLCount() (uint64, error)
- func (m *Mutator) GetHistoryDDLJob(id int64) (*model.Job, error)
- func (m *Mutator) GetHistoryDDLJobsIterator(startJobID int64) (LastJobIterator, error)
- func (m *Mutator) GetLastHistoryDDLJobsIterator() (LastJobIterator, error)
- func (m *Mutator) GetLastHistoryDDLJobsIteratorWithFilter(schemaNames set.StringSet, tableNames set.StringSet) (LastJobIterator, error)
- func (m *Mutator) GetMetadataLock() (enable bool, isNull bool, err error)
- func (m *Mutator) GetMetasByDBID(dbID int64) ([]structure.HashPair, error)
- func (m *Mutator) GetPolicy(policyID int64) (*model.PolicyInfo, error)
- func (m *Mutator) GetPolicyID() (int64, error)
- func (m *Mutator) GetRUStats() (*RUStats, error)
- func (m *Mutator) GetResourceGroup(groupID int64) (*model.ResourceGroupInfo, error)
- func (m *Mutator) GetSchemaCacheSize() (size uint64, isNull bool, err error)
- func (m *Mutator) GetSchemaDiff(schemaVersion int64) (*model.SchemaDiff, error)
- func (m *Mutator) GetSchemaVersion() (int64, error)
- func (m *Mutator) GetSchemaVersionWithNonEmptyDiff() (int64, error)
- func (m *Mutator) GetSystemDBID() (int64, error)
- func (m *Mutator) GetTable(dbID int64, tableID int64) (*model.TableInfo, error)
- func (m *Mutator) GlobalIDKey() []byte
- func (m *Mutator) IterTables(dbID int64, fn func(info *model.TableInfo) error) error
- func (m *Mutator) ListDatabases() ([]*model.DBInfo, error)
- func (m *Mutator) ListPolicies() ([]*model.PolicyInfo, error)
- func (m *Mutator) ListResourceGroups() ([]*model.ResourceGroupInfo, error)
- func (m *Mutator) ListSimpleTables(dbID int64) ([]*model.TableNameInfo, error)
- func (m *Mutator) ListTables(ctx context.Context, dbID int64) ([]*model.TableInfo, error)
- func (m *Mutator) RestartSequenceValue(dbID int64, tableInfo *model.TableInfo, seqValue int64) error
- func (m *Mutator) SetBDRRole(role string) error
- func (m *Mutator) SetDDLTables(ddlTableVersion DDLTableVersion) error
- func (m *Mutator) SetMetadataLock(b bool) error
- func (m *Mutator) SetRUStats(stats *RUStats) error
- func (m *Mutator) SetSchemaCacheSize(size uint64) error
- func (m *Mutator) SetSchemaDiff(diff *model.SchemaDiff) error
- func (m *Mutator) UpdateDatabase(dbInfo *model.DBInfo) error
- func (m *Mutator) UpdatePolicy(policy *model.PolicyInfo) error
- func (m *Mutator) UpdateResourceGroup(group *model.ResourceGroupInfo) error
- func (m *Mutator) UpdateTable(dbID int64, tableInfo *model.TableInfo) error
- type Option
- type RUStats
- type Reader
Constants ¶
const ( // CurrentMagicByteVer is the current magic byte version, used for future meta compatibility. CurrentMagicByteVer byte = 0x00 // MaxInt48 is the max value of int48. MaxInt48 = 0x0000FFFFFFFFFFFF // MaxGlobalID reserves 1000 IDs. Use MaxInt48 to reserves the high 2 bytes to compatible with Multi-tenancy. MaxGlobalID = MaxInt48 - 1000 )
const NameExtractRegexp = `"O":"([^"\\]*(?:\\.[^"\\]*)*)",`
NameExtractRegexp is exported for testing.
Variables ¶
var ( // ErrDBExists is the error for db exists. ErrDBExists = dbterror.ClassMeta.NewStd(mysql.ErrDBCreateExists) // ErrDBNotExists is the error for db not exists. ErrDBNotExists = dbterror.ClassMeta.NewStd(mysql.ErrBadDB) // ErrPolicyExists is the error for policy exists. ErrPolicyExists = dbterror.ClassMeta.NewStd(errno.ErrPlacementPolicyExists) // ErrPolicyNotExists is the error for policy not exists. ErrPolicyNotExists = dbterror.ClassMeta.NewStd(errno.ErrPlacementPolicyNotExists) // ErrResourceGroupExists is the error for resource group exists. ErrResourceGroupExists = dbterror.ClassMeta.NewStd(errno.ErrResourceGroupExists) // ErrResourceGroupNotExists is the error for resource group not exists. ErrResourceGroupNotExists = dbterror.ClassMeta.NewStd(errno.ErrResourceGroupNotExists) // ErrTableExists is the error for table exists. ErrTableExists = dbterror.ClassMeta.NewStd(mysql.ErrTableExists) // ErrTableNotExists is the error for table not exists. ErrTableNotExists = dbterror.ClassMeta.NewStd(mysql.ErrNoSuchTable) // ErrDDLReorgElementNotExist is the error for reorg element not exists. ErrDDLReorgElementNotExist = dbterror.ClassMeta.NewStd(errno.ErrDDLReorgElementNotExist) // ErrInvalidString is the error for invalid string to parse ErrInvalidString = dbterror.ClassMeta.NewStd(errno.ErrInvalidCharacterString) )
Functions ¶
func AutoIncrementIDKey ¶
AutoIncrementIDKey decodes the auto inc table key.
func AutoRandomTableIDKey ¶
AutoRandomTableIDKey encodes the auto random tableID key.
func AutoTableIDKey ¶
AutoTableIDKey decodes the auto tableID key.
func DDLJobHistoryKey ¶
DDLJobHistoryKey is only used for testing.
func DefaultGroupMeta4Test ¶
func DefaultGroupMeta4Test() *model.ResourceGroupInfo
DefaultGroupMeta4Test return the default group info for test usage.
func ExtractSchemaAndTableNameFromJob ¶
ExtractSchemaAndTableNameFromJob extract schema_name and table_name from encoded Job structure Note, here we strongly rely on the order of fields in marshalled string, just like checkSubstringsInOrder Exported for test
func FastUnmarshalTableNameInfo ¶
func FastUnmarshalTableNameInfo(data []byte) (*model.TableNameInfo, error)
FastUnmarshalTableNameInfo is exported for testing.
func GetTableInfoWithAttributes ¶
func GetTableInfoWithAttributes(m *Mutator, dbID int64, filterAttrs ...string) ([]*model.TableInfo, error)
GetTableInfoWithAttributes retrieves all the table infos for a given db. The filterAttrs are used to filter out any table that is not needed.
func IsAutoIncrementIDKey ¶
IsAutoIncrementIDKey checks whether the key is auto increment key.
func IsAutoRandomTableIDKey ¶
IsAutoRandomTableIDKey checks whether the key is auto random tableID key.
func IsAutoTableIDKey ¶
IsAutoTableIDKey checks whether the key is auto tableID key.
func IsJobMatch ¶
IsJobMatch examines whether given job's table/schema name matches.
func IsSequenceKey ¶
IsSequenceKey checks whether the key is sequence key.
func IsTableInfoMustLoad ¶
IsTableInfoMustLoad checks whether the table info needs to be loaded. Exported for testing.
func IsTableKey ¶
IsTableKey checks whether the tableKey comes from TableKey().
func ParseAutoIncrementIDKey ¶
ParseAutoIncrementIDKey decodes the tableID from the auto tableID key.
func ParseAutoRandomTableIDKey ¶
ParseAutoRandomTableIDKey decodes the tableID from the auto random tableID key.
func ParseAutoTableIDKey ¶
ParseAutoTableIDKey decodes the tableID from the auto tableID key.
func ParseDBKey ¶
ParseDBKey decodes the dbkey to get dbID.
func ParseSequenceKey ¶
ParseSequenceKey decodes the tableID from the sequence key.
func ParseTableKey ¶
ParseTableKey decodes the tableKey to get tableID.
Types ¶
type AccessorPicker ¶
type AccessorPicker interface { RowID() AutoIDAccessor RandomID() AutoIDAccessor IncrementID(tableVersion uint16) AutoIDAccessor SequenceValue() AutoIDAccessor SequenceCycle() AutoIDAccessor }
AccessorPicker is used to pick a type of auto ID accessor.
type AutoIDAccessor ¶
type AutoIDAccessor interface { Get() (int64, error) Put(val int64) error Inc(step int64) (int64, error) CopyTo(databaseID, tableID int64) error Del() error }
AutoIDAccessor represents the entry to retrieve/mutate auto IDs.
type AutoIDAccessors ¶
type AutoIDAccessors interface { Get() (model.AutoIDGroup, error) Put(autoIDs model.AutoIDGroup) error Del() error AccessorPicker }
AutoIDAccessors represents all the auto IDs of a table.
func NewAutoIDAccessors ¶
func NewAutoIDAccessors(m *Mutator, databaseID, tableID int64) AutoIDAccessors
NewAutoIDAccessors creates a new AutoIDAccessors.
type DDLTableVersion ¶
type DDLTableVersion int
DDLTableVersion is to display ddl related table versions
const ( // InitDDLTableVersion is the original version. InitDDLTableVersion DDLTableVersion = 0 // BaseDDLTableVersion is for support concurrent DDL, it added tidb_ddl_job, tidb_ddl_reorg and tidb_ddl_history. BaseDDLTableVersion DDLTableVersion = 1 // MDLTableVersion is for support MDL tables. MDLTableVersion DDLTableVersion = 2 // BackfillTableVersion is for support distributed reorg stage, it added tidb_background_subtask, tidb_background_subtask_history. BackfillTableVersion DDLTableVersion = 3 // DDLNotifierTableVersion is for support ddl notifier, it added tidb_ddl_notifier. DDLNotifierTableVersion DDLTableVersion = 4 )
func (DDLTableVersion) Bytes ¶
func (ver DDLTableVersion) Bytes() []byte
Bytes returns the byte slice.
type DailyRUStats ¶
type DailyRUStats struct { EndTime time.Time `json:"date"` Stats []GroupRUStats `json:"stats"` }
DailyRUStats keeps all the ru consumption statistics data.
type Element ¶
Element has the information of the backfill job's type and ID.
func DecodeElement ¶
DecodeElement decodes values from a byte slice generated with an element. It's exported for testing.
func (*Element) EncodeElement ¶
EncodeElement encodes an Element into a byte slice. It's exported for testing.
type ElementKeyType ¶
type ElementKeyType []byte
ElementKeyType is a key type of the element.
var ( // ColumnElementKey is the key for column element. ColumnElementKey ElementKeyType = []byte("_col_") // IndexElementKey is the key for index element. IndexElementKey ElementKeyType = []byte("_idx_") )
type GroupRUStats ¶
type GroupRUStats struct { ID int64 `json:"id"` Name string `json:"name"` RUConsumption *rmpb.Consumption `json:"ru_consumption"` }
GroupRUStats keeps the ru consumption statistics data.
type HLastJobIterator ¶
type HLastJobIterator struct {
// contains filtered or unexported fields
}
HLastJobIterator is the iterator for gets the latest history.
func (*HLastJobIterator) GetLastJobs ¶
GetLastJobs gets last several jobs.
type LastJobIterator ¶
LastJobIterator is the iterator for gets latest history.
type Mutator ¶
type Mutator struct { StartTS uint64 // StartTS is the txn's start TS. // contains filtered or unexported fields }
Mutator is for handling meta information in a transaction.
func NewMutator ¶
func NewMutator(txn kv.Transaction, options ...Option) *Mutator
NewMutator creates a meta Mutator in transaction txn. If the current Mutator needs to handle a job, jobListKey is the type of the job's list.
func (*Mutator) AddHistoryDDLJob ¶
AddHistoryDDLJob adds DDL job to history.
func (*Mutator) AddResourceGroup ¶
func (m *Mutator) AddResourceGroup(group *model.ResourceGroupInfo) error
AddResourceGroup creates a resource group.
func (*Mutator) AdvanceGlobalIDs ¶
AdvanceGlobalIDs advances the global ID by n. return the old global ID.
func (*Mutator) CheckDDLTableVersion ¶
func (m *Mutator) CheckDDLTableVersion() (DDLTableVersion, error)
CheckDDLTableVersion check if the tables related to concurrent DDL exists.
func (*Mutator) CheckTableExists ¶
CheckTableExists checks if the table is existed with dbID and tableID.
func (*Mutator) ClearBDRRole ¶
ClearBDRRole clear BDR role from storage.
func (*Mutator) CreateDatabase ¶
CreateDatabase creates a database with db info.
func (*Mutator) CreateMySQLDatabaseIfNotExists ¶
CreateMySQLDatabaseIfNotExists creates mysql schema and return its DB ID.
func (*Mutator) CreatePolicy ¶
func (m *Mutator) CreatePolicy(policy *model.PolicyInfo) error
CreatePolicy creates a policy.
func (*Mutator) CreateSequenceAndSetSeqValue ¶
func (m *Mutator) CreateSequenceAndSetSeqValue(dbID int64, tableInfo *model.TableInfo, seqValue int64) error
CreateSequenceAndSetSeqValue creates sequence with tableInfo in database, and rebase the sequence seqValue.
func (*Mutator) CreateTableAndSetAutoID ¶
func (m *Mutator) CreateTableAndSetAutoID(dbID int64, tableInfo *model.TableInfo, autoIDs model.AutoIDGroup) error
CreateTableAndSetAutoID creates a table with tableInfo in database, and rebases the table autoID.
func (*Mutator) CreateTableOrView ¶
CreateTableOrView creates a table with tableInfo in database.
func (*Mutator) DropDatabase ¶
DropDatabase drops whole database.
func (*Mutator) DropPolicy ¶
DropPolicy drops the specified policy.
func (*Mutator) DropResourceGroup ¶
DropResourceGroup drops a resource group.
func (*Mutator) DropSequence ¶
DropSequence drops sequence in database. Sequence is made of table struct and kv value pair.
func (*Mutator) DropTableOrView ¶
DropTableOrView drops table in database. If delAutoID is true, it will delete the auto_increment id key-value of the table. For rename table, we do not need to rename auto_increment id key-value.
func (*Mutator) EncodeSchemaDiffKey ¶
EncodeSchemaDiffKey returns the raw kv key for a schema diff
func (*Mutator) FinishBootstrap ¶
FinishBootstrap finishes bootstrap.
func (*Mutator) GenAutoTableIDKeyValue ¶
GenAutoTableIDKeyValue generates meta key by dbID, tableID and corresponding value by autoID.
func (*Mutator) GenGlobalID ¶
GenGlobalID generates next id globally.
func (*Mutator) GenGlobalIDs ¶
GenGlobalIDs generates the next n global IDs.
func (*Mutator) GenPlacementPolicyID ¶
GenPlacementPolicyID generates next placement policy id globally.
func (*Mutator) GenSchemaVersion ¶
GenSchemaVersion generates next schema version.
func (*Mutator) GenSchemaVersions ¶
GenSchemaVersions increases the schema version.
func (*Mutator) GetAllNameToIDAndTheMustLoadedTableInfo ¶
func (m *Mutator) GetAllNameToIDAndTheMustLoadedTableInfo(dbID int64) (map[string]int64, []*model.TableInfo, error)
GetAllNameToIDAndTheMustLoadedTableInfo gets all the fields and values and table info for special attributes in a hash. It's used to get some infos for information schema cache in a faster way. If a table contains any of the attributes listed in checkSubstringsInOrder, it must be loaded during schema full load. hasSpecialAttributes() is a subset of it, the difference is that: If a table need to be resident in-memory, its table info MUST be loaded. If a table info is loaded, it's NOT NECESSARILY to be keep in-memory.
func (*Mutator) GetAutoIDAccessors ¶
func (m *Mutator) GetAutoIDAccessors(dbID, tableID int64) AutoIDAccessors
GetAutoIDAccessors gets the controller for auto IDs.
func (*Mutator) GetBDRRole ¶
GetBDRRole get BDR role from storage.
func (*Mutator) GetBootstrapVersion ¶
GetBootstrapVersion returns the version of the server which bootstrap the store. If the store is not bootstraped, the version will be zero.
func (*Mutator) GetDatabase ¶
GetDatabase gets the database value with ID.
func (*Mutator) GetGlobalID ¶
GetGlobalID gets current global id.
func (*Mutator) GetHistoryDDLCount ¶
GetHistoryDDLCount the count of all history DDL jobs.
func (*Mutator) GetHistoryDDLJob ¶
GetHistoryDDLJob gets a history DDL job.
func (*Mutator) GetHistoryDDLJobsIterator ¶
func (m *Mutator) GetHistoryDDLJobsIterator(startJobID int64) (LastJobIterator, error)
GetHistoryDDLJobsIterator gets the jobs iterator begin with startJobID.
func (*Mutator) GetLastHistoryDDLJobsIterator ¶
func (m *Mutator) GetLastHistoryDDLJobsIterator() (LastJobIterator, error)
GetLastHistoryDDLJobsIterator gets latest history ddl jobs iterator.
func (*Mutator) GetLastHistoryDDLJobsIteratorWithFilter ¶
func (m *Mutator) GetLastHistoryDDLJobsIteratorWithFilter( schemaNames set.StringSet, tableNames set.StringSet, ) (LastJobIterator, error)
GetLastHistoryDDLJobsIteratorWithFilter returns a iterator for getting latest history ddl jobs. This iterator will also filter jobs using given schemaNames and tableNames
func (*Mutator) GetMetadataLock ¶
GetMetadataLock gets the metadata lock.
func (*Mutator) GetMetasByDBID ¶
GetMetasByDBID return all meta information of a database. Note(dongmen): This method is used by TiCDC to reduce the time of changefeed initialization. Ref: https://github.com/pingcap/tiflow/issues/11109
func (*Mutator) GetPolicy ¶
func (m *Mutator) GetPolicy(policyID int64) (*model.PolicyInfo, error)
GetPolicy gets the database value with ID.
func (*Mutator) GetPolicyID ¶
GetPolicyID gets current policy global id.
func (*Mutator) GetRUStats ¶
GetRUStats load the persisted RUStats data.
func (*Mutator) GetResourceGroup ¶
func (m *Mutator) GetResourceGroup(groupID int64) (*model.ResourceGroupInfo, error)
GetResourceGroup gets the database value with ID.
func (*Mutator) GetSchemaCacheSize ¶
GetSchemaCacheSize gets the schema cache size.
func (*Mutator) GetSchemaDiff ¶
func (m *Mutator) GetSchemaDiff(schemaVersion int64) (*model.SchemaDiff, error)
GetSchemaDiff gets the modification information on a given schema version.
func (*Mutator) GetSchemaVersion ¶
GetSchemaVersion gets current global schema version.
func (*Mutator) GetSchemaVersionWithNonEmptyDiff ¶
GetSchemaVersionWithNonEmptyDiff gets current global schema version, if diff is nil, we should return version - 1. Consider the following scenario:
// t1 t2 t3 t4 // | | | // update schema version | set diff // stale read ts
At the first time, t2 reads the schema version v10, but the v10's diff is not set yet, so it loads v9 infoSchema. But at t4 moment, v10's diff has been set and been cached in the memory, so stale read on t2 will get v10 schema from cache, and inconsistency happen. To solve this problem, we always check the schema diff at first, if the diff is empty, we know at t2 moment we can only see the v9 schema, so make neededSchemaVersion = neededSchemaVersion - 1. For `Reload`, we can also do this: if the newest version's diff is not set yet, it is ok to load the previous version's infoSchema, and wait for the next reload. if there are multiple consecutive jobs failed or cancelled after the schema version increased, the returned 'version - 1' might still not have diff.
func (*Mutator) GetSystemDBID ¶
GetSystemDBID gets the system DB ID. return (0, nil) indicates that the system DB does not exist.
func (*Mutator) GlobalIDKey ¶
GlobalIDKey returns the key for the global ID.
func (*Mutator) IterTables ¶
IterTables iterates all the table at once, in order to avoid oom.
func (*Mutator) ListDatabases ¶
ListDatabases shows all databases.
func (*Mutator) ListPolicies ¶
func (m *Mutator) ListPolicies() ([]*model.PolicyInfo, error)
ListPolicies shows all policies.
func (*Mutator) ListResourceGroups ¶
func (m *Mutator) ListResourceGroups() ([]*model.ResourceGroupInfo, error)
ListResourceGroups shows all resource groups.
func (*Mutator) ListSimpleTables ¶
func (m *Mutator) ListSimpleTables(dbID int64) ([]*model.TableNameInfo, error)
ListSimpleTables shows all simple tables in database.
func (*Mutator) ListTables ¶
ListTables shows all tables in database.
func (*Mutator) RestartSequenceValue ¶
func (m *Mutator) RestartSequenceValue(dbID int64, tableInfo *model.TableInfo, seqValue int64) error
RestartSequenceValue resets the the sequence value.
func (*Mutator) SetBDRRole ¶
SetBDRRole write BDR role into storage.
func (*Mutator) SetDDLTables ¶
func (m *Mutator) SetDDLTables(ddlTableVersion DDLTableVersion) error
SetDDLTables write a key into storage.
func (*Mutator) SetMetadataLock ¶
SetMetadataLock sets the metadata lock.
func (*Mutator) SetRUStats ¶
SetRUStats persist new ru stats data to meta storage.
func (*Mutator) SetSchemaCacheSize ¶
SetSchemaCacheSize sets the schema cache size.
func (*Mutator) SetSchemaDiff ¶
func (m *Mutator) SetSchemaDiff(diff *model.SchemaDiff) error
SetSchemaDiff sets the modification information on a given schema version.
func (*Mutator) UpdateDatabase ¶
UpdateDatabase updates a database with db info.
func (*Mutator) UpdatePolicy ¶
func (m *Mutator) UpdatePolicy(policy *model.PolicyInfo) error
UpdatePolicy updates a policy.
func (*Mutator) UpdateResourceGroup ¶
func (m *Mutator) UpdateResourceGroup(group *model.ResourceGroupInfo) error
UpdateResourceGroup updates a resource group.
type RUStats ¶
type RUStats struct { Latest *DailyRUStats `json:"latest"` Previous *DailyRUStats `json:"previous"` }
RUStats keeps the lastest and second lastest DailyRUStats data.
type Reader ¶
type Reader interface { GetDatabase(dbID int64) (*model.DBInfo, error) ListDatabases() ([]*model.DBInfo, error) GetTable(dbID int64, tableID int64) (*model.TableInfo, error) ListTables(ctx context.Context, dbID int64) ([]*model.TableInfo, error) ListSimpleTables(dbID int64) ([]*model.TableNameInfo, error) IterTables(dbID int64, fn func(info *model.TableInfo) error) error GetAutoIDAccessors(dbID, tableID int64) AutoIDAccessors GetAllNameToIDAndTheMustLoadedTableInfo(dbID int64) (map[string]int64, []*model.TableInfo, error) GetMetadataLock() (enable bool, isNull bool, err error) GetHistoryDDLJob(id int64) (*model.Job, error) GetHistoryDDLCount() (uint64, error) GetLastHistoryDDLJobsIterator() (LastJobIterator, error) GetHistoryDDLJobsIterator(startJobID int64) (LastJobIterator, error) GetSchemaVersion() (int64, error) EncodeSchemaDiffKey(schemaVersion int64) kv.Key GetSchemaDiff(schemaVersion int64) (*model.SchemaDiff, error) GetSchemaVersionWithNonEmptyDiff() (int64, error) GetPolicyID() (int64, error) GetPolicy(policyID int64) (*model.PolicyInfo, error) ListPolicies() ([]*model.PolicyInfo, error) GetRUStats() (*RUStats, error) GetResourceGroup(groupID int64) (*model.ResourceGroupInfo, error) ListResourceGroups() ([]*model.ResourceGroupInfo, error) GetMetasByDBID(dbID int64) ([]structure.HashPair, error) GetGlobalID() (int64, error) GetBDRRole() (string, error) GetSystemDBID() (int64, error) GetSchemaCacheSize() (size uint64, isNull bool, err error) GetBootstrapVersion() (int64, error) }
Reader is the meta reader