Documentation ¶
Index ¶
- Variables
- type Domain
- func (do *Domain) Close()
- func (do *Domain) CreateStatsHandle(ctx context.Context)
- func (do *Domain) DDL() ddl.DDL
- func (do *Domain) GetScope(status string) variable.ScopeFlag
- func (do *Domain) GetSnapshotInfoSchema(snapshotTS uint64) (infoschema.InfoSchema, error)
- func (do *Domain) InfoSchema() infoschema.InfoSchema
- func (do *Domain) LoadPrivilegeLoop(ctx context.Context) error
- func (do *Domain) NotifyUpdatePrivilege(ctx context.Context)
- func (do *Domain) PrivilegeHandle() *privileges.Handle
- func (do *Domain) Reload() error
- func (do *Domain) StatsHandle() *statistics.Handle
- func (do *Domain) Store() kv.Storage
- func (do *Domain) SysSessionPool() *pools.ResourcePool
- func (do *Domain) UpdateTableStatsLoop(ctx context.Context) error
- type EtcdBackend
- type MockFailure
- type SchemaValidator
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInfoSchemaExpired returns the error that information schema is out of date. ErrInfoSchemaExpired = terror.ClassDomain.New(codeInfoSchemaExpired, "Information schema is out of date.") // ErrInfoSchemaChanged returns the error that information schema is changed. ErrInfoSchemaChanged = terror.ClassDomain.New(codeInfoSchemaChanged, "Information schema is changed.") )
Functions ¶
This section is empty.
Types ¶
type Domain ¶
type Domain struct { SchemaValidator SchemaValidator MockReloadFailed MockFailure // It mocks reload failed. // contains filtered or unexported fields }
Domain represents a storage space. Different domains can use the same database name. Multiple domains can be used in parallel without synchronization.
func NewDomain ¶
func NewDomain(store kv.Storage, ddlLease time.Duration, statsLease time.Duration, factory pools.Factory, sysFactory func(*Domain) (pools.Resource, error)) (d *Domain, err error)
NewDomain creates a new domain. Should not create multiple domains for the same store.
func (*Domain) CreateStatsHandle ¶
CreateStatsHandle is used only for test.
func (*Domain) GetSnapshotInfoSchema ¶
func (do *Domain) GetSnapshotInfoSchema(snapshotTS uint64) (infoschema.InfoSchema, error)
GetSnapshotInfoSchema gets a snapshot information schema.
func (*Domain) InfoSchema ¶
func (do *Domain) InfoSchema() infoschema.InfoSchema
InfoSchema gets information schema from domain.
func (*Domain) LoadPrivilegeLoop ¶
LoadPrivilegeLoop create a goroutine loads privilege tables in a loop, it should be called only once in BootstrapSession.
func (*Domain) NotifyUpdatePrivilege ¶
NotifyUpdatePrivilege updates privilege key in etcd, TiDB client that watches the key will get notification.
func (*Domain) PrivilegeHandle ¶
func (do *Domain) PrivilegeHandle() *privileges.Handle
PrivilegeHandle returns the MySQLPrivilege.
func (*Domain) StatsHandle ¶
func (do *Domain) StatsHandle() *statistics.Handle
StatsHandle returns the statistic handle.
func (*Domain) SysSessionPool ¶
func (do *Domain) SysSessionPool() *pools.ResourcePool
SysSessionPool returns the system session pool.
func (*Domain) UpdateTableStatsLoop ¶
UpdateTableStatsLoop creates a goroutine loads stats info and updates stats info in a loop. It will also start a goroutine to analyze tables automatically. It should be called only once in BootstrapSession.
type EtcdBackend ¶
EtcdBackend is used for judging a storage is a real TiKV.
type MockFailure ¶
MockFailure mocks reload failed. It's used for fixing data race in tests.
func (*MockFailure) SetValue ¶
func (m *MockFailure) SetValue(isFailed bool)
SetValue sets whether we need to mock reload failed.
type SchemaValidator ¶
type SchemaValidator interface { // Update the schema validator, add a new item, delete the expired detalItemInfos. // The latest schemaVer is valid within leaseGrantTime plus lease duration. // Add the changed table IDs to the new schema information, // which is produced when the oldSchemaVer is updated to the newSchemaVer. Update(leaseGrantTime uint64, oldSchemaVer, newSchemaVer int64, changedTableIDs []int64) // Check is it valid for a transaction to use schemaVer, at timestamp txnTS. Check(txnTS uint64, schemaVer int64) bool // Latest returns the latest schema version it knows, but not necessary a valid one. Latest() int64 // IsRelatedTablesChanged returns the result whether relatedTableIDs is changed from usedVer to the latest schema version, // and an error. IsRelatedTablesChanged(txnTS uint64, usedVer int64, relatedTableIDs []int64) (bool, error) // Stop stops checking the valid of transaction. Stop() // Restart restarts the schema validator after it is stopped. Restart() }
SchemaValidator is the interface for checking the validity of schema version.
func NewSchemaValidator ¶
func NewSchemaValidator(lease time.Duration) SchemaValidator
NewSchemaValidator returns a SchemaValidator structure.