meta

package
v1.1.0-beta.0...-de36787 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const NameExtractRegexp = `"O":"([^"\\]*(?:\\.[^"\\]*)*)",`

NameExtractRegexp is exported for testing.

Variables

View Source
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

func AutoIncrementIDKey(tableID int64) []byte

AutoIncrementIDKey decodes the auto inc table key.

func AutoRandomTableIDKey

func AutoRandomTableIDKey(tableID int64) []byte

AutoRandomTableIDKey encodes the auto random tableID key.

func AutoTableIDKey

func AutoTableIDKey(tableID int64) []byte

AutoTableIDKey decodes the auto tableID key.

func DBkey

func DBkey(dbID int64) []byte

DBkey encodes the dbID into dbKey.

func DDLJobHistoryKey

func DDLJobHistoryKey(m *Mutator, jobID int64) []byte

DDLJobHistoryKey is only used for testing.

func DefaultGroupMeta4Test

func DefaultGroupMeta4Test() *model.ResourceGroupInfo

DefaultGroupMeta4Test return the default group info for test usage.

func ExtractSchemaAndTableNameFromJob

func ExtractSchemaAndTableNameFromJob(data []byte) (schemaName, tableName string, err error)

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

func IsAutoIncrementIDKey(key []byte) bool

IsAutoIncrementIDKey checks whether the key is auto increment key.

func IsAutoRandomTableIDKey

func IsAutoRandomTableIDKey(key []byte) bool

IsAutoRandomTableIDKey checks whether the key is auto random tableID key.

func IsAutoTableIDKey

func IsAutoTableIDKey(key []byte) bool

IsAutoTableIDKey checks whether the key is auto tableID key.

func IsDBkey

func IsDBkey(dbKey []byte) bool

IsDBkey checks whether the dbKey comes from DBKey().

func IsJobMatch

func IsJobMatch(job []byte, schemaNames, tableNames set.StringSet) (match bool, err error)

IsJobMatch examines whether given job's table/schema name matches.

func IsSequenceKey

func IsSequenceKey(key []byte) bool

IsSequenceKey checks whether the key is sequence key.

func IsTableInfoMustLoad

func IsTableInfoMustLoad(json []byte) bool

IsTableInfoMustLoad checks whether the table info needs to be loaded. Exported for testing.

func IsTableKey

func IsTableKey(tableKey []byte) bool

IsTableKey checks whether the tableKey comes from TableKey().

func ParseAutoIncrementIDKey

func ParseAutoIncrementIDKey(key []byte) (int64, error)

ParseAutoIncrementIDKey decodes the tableID from the auto tableID key.

func ParseAutoRandomTableIDKey

func ParseAutoRandomTableIDKey(key []byte) (int64, error)

ParseAutoRandomTableIDKey decodes the tableID from the auto random tableID key.

func ParseAutoTableIDKey

func ParseAutoTableIDKey(key []byte) (int64, error)

ParseAutoTableIDKey decodes the tableID from the auto tableID key.

func ParseDBKey

func ParseDBKey(dbkey []byte) (int64, error)

ParseDBKey decodes the dbkey to get dbID.

func ParseSequenceKey

func ParseSequenceKey(key []byte) (int64, error)

ParseSequenceKey decodes the tableID from the sequence key.

func ParseTableKey

func ParseTableKey(tableKey []byte) (int64, error)

ParseTableKey decodes the tableKey to get tableID.

func SequenceKey

func SequenceKey(sequenceID int64) []byte

SequenceKey encodes the sequence key.

func TableKey

func TableKey(tableID int64) []byte

TableKey encodes the tableID into tableKey.

func Unescape

func Unescape(s string) string

Unescape is exported for testing.

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

type Element struct {
	ID      int64
	TypeKey []byte
}

Element has the information of the backfill job's type and ID.

func DecodeElement

func DecodeElement(b []byte) (*Element, error)

DecodeElement decodes values from a byte slice generated with an element. It's exported for testing.

func (*Element) EncodeElement

func (e *Element) EncodeElement() []byte

EncodeElement encodes an Element into a byte slice. It's exported for testing.

func (*Element) String

func (e *Element) String() string

String defines a Stringer function for debugging and pretty printing.

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

func (i *HLastJobIterator) GetLastJobs(num int, jobs []*model.Job) ([]*model.Job, error)

GetLastJobs gets last several jobs.

type JobListKeyType

type JobListKeyType []byte

JobListKeyType is a key type of the DDL job queue.

type LastJobIterator

type LastJobIterator interface {
	GetLastJobs(num int, jobs []*model.Job) ([]*model.Job, error)
}

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

func (m *Mutator) AddHistoryDDLJob(job *model.Job, updateRawArgs bool) error

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

func (m *Mutator) AdvanceGlobalIDs(n int) (int64, error)

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

func (m *Mutator) CheckTableExists(dbID int64, tableID int64) (bool, error)

CheckTableExists checks if the table is existed with dbID and tableID.

func (*Mutator) ClearBDRRole

func (m *Mutator) ClearBDRRole() error

ClearBDRRole clear BDR role from storage.

func (*Mutator) CreateDatabase

func (m *Mutator) CreateDatabase(dbInfo *model.DBInfo) error

CreateDatabase creates a database with db info.

func (*Mutator) CreateMySQLDatabaseIfNotExists

func (m *Mutator) CreateMySQLDatabaseIfNotExists() (int64, error)

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

func (m *Mutator) CreateTableOrView(dbID int64, tableInfo *model.TableInfo) error

CreateTableOrView creates a table with tableInfo in database.

func (*Mutator) DropDatabase

func (m *Mutator) DropDatabase(dbID int64) error

DropDatabase drops whole database.

func (*Mutator) DropPolicy

func (m *Mutator) DropPolicy(policyID int64) error

DropPolicy drops the specified policy.

func (*Mutator) DropResourceGroup

func (m *Mutator) DropResourceGroup(groupID int64) error

DropResourceGroup drops a resource group.

func (*Mutator) DropSequence

func (m *Mutator) DropSequence(dbID int64, tblID int64) error

DropSequence drops sequence in database. Sequence is made of table struct and kv value pair.

func (*Mutator) DropTableOrView

func (m *Mutator) DropTableOrView(dbID int64, tblID int64) error

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

func (m *Mutator) EncodeSchemaDiffKey(schemaVersion int64) kv.Key

EncodeSchemaDiffKey returns the raw kv key for a schema diff

func (*Mutator) FinishBootstrap

func (m *Mutator) FinishBootstrap(version int64) error

FinishBootstrap finishes bootstrap.

func (*Mutator) GenAutoTableIDKeyValue

func (m *Mutator) GenAutoTableIDKeyValue(dbID, tableID, autoID int64) (key, value []byte)

GenAutoTableIDKeyValue generates meta key by dbID, tableID and corresponding value by autoID.

func (*Mutator) GenGlobalID

func (m *Mutator) GenGlobalID() (int64, error)

GenGlobalID generates next id globally.

func (*Mutator) GenGlobalIDs

func (m *Mutator) GenGlobalIDs(n int) ([]int64, error)

GenGlobalIDs generates the next n global IDs.

func (*Mutator) GenPlacementPolicyID

func (m *Mutator) GenPlacementPolicyID() (int64, error)

GenPlacementPolicyID generates next placement policy id globally.

func (*Mutator) GenSchemaVersion

func (m *Mutator) GenSchemaVersion() (int64, error)

GenSchemaVersion generates next schema version.

func (*Mutator) GenSchemaVersions

func (m *Mutator) GenSchemaVersions(count int64) (int64, error)

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

func (m *Mutator) GetBDRRole() (string, error)

GetBDRRole get BDR role from storage.

func (*Mutator) GetBootstrapVersion

func (m *Mutator) GetBootstrapVersion() (int64, error)

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

func (m *Mutator) GetDatabase(dbID int64) (*model.DBInfo, error)

GetDatabase gets the database value with ID.

func (*Mutator) GetGlobalID

func (m *Mutator) GetGlobalID() (int64, error)

GetGlobalID gets current global id.

func (*Mutator) GetHistoryDDLCount

func (m *Mutator) GetHistoryDDLCount() (uint64, error)

GetHistoryDDLCount the count of all history DDL jobs.

func (*Mutator) GetHistoryDDLJob

func (m *Mutator) GetHistoryDDLJob(id int64) (*model.Job, error)

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

func (m *Mutator) GetMetadataLock() (enable bool, isNull bool, err error)

GetMetadataLock gets the metadata lock.

func (*Mutator) GetMetasByDBID

func (m *Mutator) GetMetasByDBID(dbID int64) ([]structure.HashPair, error)

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

func (m *Mutator) GetPolicyID() (int64, error)

GetPolicyID gets current policy global id.

func (*Mutator) GetRUStats

func (m *Mutator) GetRUStats() (*RUStats, error)

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

func (m *Mutator) GetSchemaCacheSize() (size uint64, isNull bool, err error)

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

func (m *Mutator) GetSchemaVersion() (int64, error)

GetSchemaVersion gets current global schema version.

func (*Mutator) GetSchemaVersionWithNonEmptyDiff

func (m *Mutator) GetSchemaVersionWithNonEmptyDiff() (int64, error)

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

func (m *Mutator) GetSystemDBID() (int64, error)

GetSystemDBID gets the system DB ID. return (0, nil) indicates that the system DB does not exist.

func (*Mutator) GetTable

func (m *Mutator) GetTable(dbID int64, tableID int64) (*model.TableInfo, error)

GetTable gets the table value in database with tableID.

func (*Mutator) GlobalIDKey

func (m *Mutator) GlobalIDKey() []byte

GlobalIDKey returns the key for the global ID.

func (*Mutator) IterTables

func (m *Mutator) IterTables(dbID int64, fn func(info *model.TableInfo) error) error

IterTables iterates all the table at once, in order to avoid oom.

func (*Mutator) ListDatabases

func (m *Mutator) ListDatabases() ([]*model.DBInfo, error)

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

func (m *Mutator) ListTables(ctx context.Context, dbID int64) ([]*model.TableInfo, error)

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

func (m *Mutator) SetBDRRole(role string) error

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

func (m *Mutator) SetMetadataLock(b bool) error

SetMetadataLock sets the metadata lock.

func (*Mutator) SetRUStats

func (m *Mutator) SetRUStats(stats *RUStats) error

SetRUStats persist new ru stats data to meta storage.

func (*Mutator) SetSchemaCacheSize

func (m *Mutator) SetSchemaCacheSize(size uint64) error

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

func (m *Mutator) UpdateDatabase(dbInfo *model.DBInfo) error

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.

func (*Mutator) UpdateTable

func (m *Mutator) UpdateTable(dbID int64, tableInfo *model.TableInfo) error

UpdateTable updates the table with table info.

type Option

type Option func(m *Mutator)

Option is for Mutator option.

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

func NewReader

func NewReader(snapshot kv.Snapshot) Reader

NewReader creates a meta Reader in snapshot.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL