Documentation ¶
Index ¶
- Constants
- Variables
- func AlterAutoIncrement(ctx context.Context, g glue.SQLExecutor, tableName string, incr int64) error
- func AlterAutoRandom(ctx context.Context, g glue.SQLExecutor, tableName string, randomBase int64) error
- func DBFromConfig(dsn config.DBStore) (*sql.DB, error)
- func InitSchema(ctx context.Context, g glue.Glue, database string, ...) error
- func LoadSchemaInfo(ctx context.Context, schemas []*mydump.MDDatabaseMeta, ...) (map[string]*checkpoints.TidbDBInfo, error)
- func ObtainGCLifeTime(ctx context.Context, db *sql.DB) (string, error)
- func ObtainImportantVariables(ctx context.Context, g glue.SQLExecutor) map[string]string
- func ObtainNewCollationEnabled(ctx context.Context, g glue.SQLExecutor) bool
- func UpdateGCLifeTime(ctx context.Context, db *sql.DB, gcLifeTime string) error
- type ChecksumManager
- type Controller
- type RemoteChecksum
- type TableRestore
- type TiDBManager
Constants ¶
View Source
const ( FullLevelCompact = -1 Level1Compact = 1 )
Variables ¶
View Source
var DeliverPauser = common.NewPauser()
DeliverPauser is a shared pauser to pause progress to (*chunkRestore).encodeLoop
Functions ¶
func AlterAutoIncrement ¶
func AlterAutoIncrement(ctx context.Context, g glue.SQLExecutor, tableName string, incr int64) error
AlterAutoIncrement rebase the table auto increment id
NOTE: since tidb can make sure the auto id is always be rebase even if the `incr` value is smaller the the auto incremanet base in tidb side, we needn't fetch currently auto increment value here. See: https://github.com/pingcap/tidb/blob/64698ef9a3358bfd0fdc323996bb7928a56cadca/ddl/ddl_api.go#L2528-L2533
func AlterAutoRandom ¶
func InitSchema ¶
func LoadSchemaInfo ¶
func LoadSchemaInfo( ctx context.Context, schemas []*mydump.MDDatabaseMeta, getTables func(context.Context, string) ([]*model.TableInfo, error), ) (map[string]*checkpoints.TidbDBInfo, error)
func ObtainNewCollationEnabled ¶
func ObtainNewCollationEnabled(ctx context.Context, g glue.SQLExecutor) bool
Types ¶
type ChecksumManager ¶
type ChecksumManager interface {
Checksum(ctx context.Context, tableInfo *checkpoints.TidbTableInfo) (*RemoteChecksum, error)
}
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewRestoreController ¶
func NewRestoreController( ctx context.Context, dbMetas []*mydump.MDDatabaseMeta, cfg *config.Config, s storage.ExternalStorage, g glue.Glue, ) (*Controller, error)
func NewRestoreControllerWithPauser ¶
func NewRestoreControllerWithPauser( ctx context.Context, dbMetas []*mydump.MDDatabaseMeta, cfg *config.Config, s storage.ExternalStorage, pauser *common.Pauser, g glue.Glue, ) (*Controller, error)
func (*Controller) Close ¶
func (rc *Controller) Close()
type RemoteChecksum ¶
type RemoteChecksum struct { Schema string Table string Checksum uint64 TotalKVs uint64 TotalBytes uint64 }
RemoteChecksum represents a checksum result got from tidb.
func DoChecksum ¶
func DoChecksum(ctx context.Context, table *checkpoints.TidbTableInfo) (*RemoteChecksum, error)
DoChecksum do checksum for tables. table should be in <db>.<table>, format. e.g. foo.bar
type TableRestore ¶
type TableRestore struct {
// contains filtered or unexported fields
}
func NewTableRestore ¶
func NewTableRestore( tableName string, tableMeta *mydump.MDTableMeta, dbInfo *checkpoints.TidbDBInfo, tableInfo *checkpoints.TidbTableInfo, cp *checkpoints.TableCheckpoint, ) (*TableRestore, error)
func (*TableRestore) Close ¶
func (tr *TableRestore) Close()
type TiDBManager ¶
type TiDBManager struct {
// contains filtered or unexported fields
}
func NewTiDBManager ¶
func NewTiDBManagerWithDB ¶
func NewTiDBManagerWithDB(db *sql.DB, sqlMode mysql.SQLMode) *TiDBManager
NewTiDBManagerWithDB creates a new TiDB manager with an existing database connection.
func (*TiDBManager) Close ¶
func (timgr *TiDBManager) Close()
Click to show internal directories.
Click to hide internal directories.