restore

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: Apache-2.0, Apache-2.0 Imports: 89 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FullLevelCompact = -1
	Level1Compact    = 1
)
View Source
const (
	TaskMetaTableName  = "task_meta"
	TableMetaTableName = "table_meta"
	// CreateTableMetadataTable stores the per-table sub jobs information used by TiDB Lightning
	CreateTableMetadataTable = `` /* 690-byte string literal not displayed */

	// CreateTaskMetaTable stores the pre-lightning metadata used by TiDB Lightning
	CreateTaskMetaTable = `` /* 373-byte string literal not displayed */

)

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 uint64) 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 than the auto increment base in tidb side, we needn't fetch currently auto increment value here. See: https://github.com/wuhuizuo/tidb6/blob/64698ef9a3358bfd0fdc323996bb7928a56cadca/ddl/ddl_api.go#L2528-L2533

func AlterAutoRandom

func AlterAutoRandom(ctx context.Context, g glue.SQLExecutor, tableName string, randomBase uint64, maxAutoRandom uint64) error

AlterAutoRandom rebase the table auto random id.

func DBFromConfig

func DBFromConfig(ctx context.Context, dsn config.DBStore) (*sql.DB, error)

func InitSchema

func InitSchema(ctx context.Context, g glue.Glue, database string, tablesSchema map[string]string) error

func LoadSchemaInfo

func LoadSchemaInfo(
	ctx context.Context,
	schemas []*mydump.MDDatabaseMeta,
	getTables func(context.Context, string) ([]*model.TableInfo, error),
) (map[string]*checkpoints.TidbDBInfo, error)

func MaybeCleanupAllMetas

func MaybeCleanupAllMetas(
	ctx context.Context,
	logger log.Logger,
	db *sql.DB,
	schemaName string,
	tableMetaExist bool,
) error

MaybeCleanupAllMetas remove the meta schema if there is no unfinished tables

func ObtainGCLifeTime

func ObtainGCLifeTime(ctx context.Context, db *sql.DB) (string, error)

func ObtainImportantVariables

func ObtainImportantVariables(ctx context.Context, g glue.SQLExecutor, needTiDBVars bool) map[string]string

func ObtainNewCollationEnabled

func ObtainNewCollationEnabled(ctx context.Context, g glue.SQLExecutor) (bool, error)

func RemoveTableMetaByTableName

func RemoveTableMetaByTableName(ctx context.Context, db *sql.DB, metaTable, tableName string) error

func UpdateGCLifeTime

func UpdateGCLifeTime(ctx context.Context, db *sql.DB, gcLifeTime string) error

func WithPreInfoGetterDBMetas

func WithPreInfoGetterDBMetas(ctx context.Context, dbMetas []*mydump.MDDatabaseMeta) context.Context

func WithPrecheckKey

func WithPrecheckKey(ctx context.Context, key precheckContextKey, val any) context.Context

Types

type CDCPITRCheckItem

type CDCPITRCheckItem struct {
	Instruction string
	// contains filtered or unexported fields
}

CDCPITRCheckItem check downstream has enabled CDC or PiTR. It's exposed to let caller override the Instruction message.

func (*CDCPITRCheckItem) Check

func (ci *CDCPITRCheckItem) Check(ctx context.Context) (*CheckResult, error)

Check implements PrecheckItem interface.

func (*CDCPITRCheckItem) GetCheckItemID

func (ci *CDCPITRCheckItem) GetCheckItemID() CheckItemID

GetCheckItemID implements PrecheckItem interface.

type CheckItemID

type CheckItemID string
const (
	CheckLargeDataFile            CheckItemID = "CHECK_LARGE_DATA_FILES"
	CheckSourcePermission         CheckItemID = "CHECK_SOURCE_PERMISSION"
	CheckTargetTableEmpty         CheckItemID = "CHECK_TARGET_TABLE_EMPTY"
	CheckSourceSchemaValid        CheckItemID = "CHECK_SOURCE_SCHEMA_VALID"
	CheckCheckpoints              CheckItemID = "CHECK_CHECKPOINTS"
	CheckCSVHeader                CheckItemID = "CHECK_CSV_HEADER"
	CheckTargetClusterSize        CheckItemID = "CHECK_TARGET_CLUSTER_SIZE"
	CheckTargetClusterEmptyRegion CheckItemID = "CHECK_TARGET_CLUSTER_EMPTY_REGION"
	CheckTargetClusterRegionDist  CheckItemID = "CHECK_TARGET_CLUSTER_REGION_DISTRIBUTION"
	CheckTargetClusterVersion     CheckItemID = "CHECK_TARGET_CLUSTER_VERSION"
	CheckLocalDiskPlacement       CheckItemID = "CHECK_LOCAL_DISK_PLACEMENT"
	CheckLocalTempKVDir           CheckItemID = "CHECK_LOCAL_TEMP_KV_DIR"
	CheckTargetUsingCDCPITR       CheckItemID = "CHECK_TARGET_USING_CDC_PITR"
)

type CheckResult

type CheckResult struct {
	Item     CheckItemID
	Severity CheckType
	Passed   bool
	Message  string
}

type CheckType

type CheckType string
const (
	Critical CheckType = "critical"
	Warn     CheckType = "performance"
)

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,
	cfg *config.Config,
	param *ControllerParam,
) (*Controller, error)

func NewRestoreControllerWithPauser

func NewRestoreControllerWithPauser(
	ctx context.Context,
	cfg *config.Config,
	p *ControllerParam,
) (*Controller, error)

func (*Controller) Close

func (rc *Controller) Close()

func (*Controller) ClusterIsAvailable

func (rc *Controller) ClusterIsAvailable(ctx context.Context) error

ClusterIsAvailable check cluster is available to import data. this test can be skipped.

func (*Controller) DataCheck

func (rc *Controller) DataCheck(ctx context.Context) error

DataCheck checks the data schema which needs #rc.restoreSchema finished.

func (*Controller) HasLargeCSV

func (rc *Controller) HasLargeCSV(ctx context.Context) error

HasLargeCSV checks whether input csvs is fit for Lightning import. If strictFormat is false, and csv file is large. Lightning will have performance issue. this test cannot be skipped.

func (*Controller) Run

func (rc *Controller) Run(ctx context.Context) error

func (*Controller) StoragePermission

func (rc *Controller) StoragePermission(ctx context.Context) error

StoragePermission checks whether Lightning has enough permission to storage.

type ControllerParam

type ControllerParam struct {
	// databases that dumper created
	DBMetas []*mydump.MDDatabaseMeta
	// a pointer to status to report it to caller
	Status *LightningStatus
	// storage interface to read the dump data
	DumpFileStorage storage.ExternalStorage
	// true if DumpFileStorage is created by lightning. In some cases where lightning is a library, the framework may pass an DumpFileStorage
	OwnExtStorage bool
	// used by lightning server mode to pause tasks
	Pauser *common.Pauser
	// lightning via SQL will implement its glue, to let lightning use host TiDB's environment
	Glue glue.Glue
	// storage interface to write file checkpoints
	CheckpointStorage storage.ExternalStorage
	// when CheckpointStorage is not nil, save file checkpoint to it with this name
	CheckpointName string
	// DupIndicator can expose the duplicate detection result to the caller
	DupIndicator *atomic.Bool
}

ControllerParam contains many parameters for creating a Controller.

type EstimateSourceDataSizeResult

type EstimateSourceDataSizeResult struct {
	// SizeWithIndex is the size with the index.
	SizeWithIndex int64
	// SizeWithoutIndex is the size without the index.
	SizeWithoutIndex int64
	// HasUnsortedBigTables indicates whether the source data has unsorted big tables or not.
	HasUnsortedBigTables bool
}

EstimateSourceDataSizeResult is the object for estimated data size result.

type LightningStatus

type LightningStatus struct {
	FinishedFileSize atomic.Int64
	TotalFileSize    atomic.Int64
	// contains filtered or unexported fields
}

LightningStatus provides the finished bytes and total bytes of the current task. It should keep the value after restart from checkpoint. When it is tidb backend, FinishedFileSize can be counted after chunk data is restored to tidb. When it is local backend it's counted after whole engine is imported. TotalFileSize may be an estimated value, so when the task is finished, it may not equal to FinishedFileSize.

type PreRestoreInfoGetter

type PreRestoreInfoGetter interface {
	TargetInfoGetter
	// GetAllTableStructures gets all the table structures with the information from both the source and the target.
	GetAllTableStructures(ctx context.Context, opts ...ropts.GetPreInfoOption) (map[string]*checkpoints.TidbDBInfo, error)
	// ReadFirstNRowsByTableName reads the first N rows of data of an importing source table.
	ReadFirstNRowsByTableName(ctx context.Context, schemaName string, tableName string, n int) (cols []string, rows [][]types.Datum, err error)
	// ReadFirstNRowsByFileMeta reads the first N rows of an data file.
	ReadFirstNRowsByFileMeta(ctx context.Context, dataFileMeta mydump.SourceFileMeta, n int) (cols []string, rows [][]types.Datum, err error)
	// EstimateSourceDataSize estimates the datasize to generate during the import as well as some other sub-informaiton.
	// It will return:
	// * the estimated data size to generate during the import,
	//   which might include some extra index data to generate besides the source file data
	// * the total data size of all the source files,
	// * whether there are some unsorted big tables
	EstimateSourceDataSize(ctx context.Context, opts ...ropts.GetPreInfoOption) (*EstimateSourceDataSizeResult, error)
}

PreRestoreInfoGetter defines the operations to get information from sources and target. These information are used in the preparation of the import ( like precheck ).

type PreRestoreInfoGetterImpl

type PreRestoreInfoGetterImpl struct {
	// contains filtered or unexported fields
}

PreRestoreInfoGetterImpl implements the operations to get information used in importing preparation.

func NewPreRestoreInfoGetter

func NewPreRestoreInfoGetter(
	cfg *config.Config,
	dbMetas []*mydump.MDDatabaseMeta,
	srcStorage storage.ExternalStorage,
	targetInfoGetter TargetInfoGetter,
	ioWorkers *worker.Pool,
	encBuilder backend.EncodingBuilder,
	opts ...ropts.GetPreInfoOption,
) (*PreRestoreInfoGetterImpl, error)

NewPreRestoreInfoGetter creates a PreRestoreInfoGetterImpl object.

func (*PreRestoreInfoGetterImpl) CheckVersionRequirements

func (p *PreRestoreInfoGetterImpl) CheckVersionRequirements(ctx context.Context) error

CheckVersionRequirements performs the check whether the target satisfies the version requirements. It implements the PreRestoreInfoGetter interface. Mydump database metas are retrieved from the context.

func (*PreRestoreInfoGetterImpl) EstimateSourceDataSize

EstimateSourceDataSize estimates the datasize to generate during the import as well as some other sub-informaiton. It implements the PreRestoreInfoGetter interface. It has a cache mechanism. The estimated size will only calculated once. The caching behavior can be changed by appending the `ForceReloadCache(true)` option.

func (*PreRestoreInfoGetterImpl) FetchRemoteTableModels

func (p *PreRestoreInfoGetterImpl) FetchRemoteTableModels(ctx context.Context, schemaName string) ([]*model.TableInfo, error)

FetchRemoteTableModels fetches the table structures from the remote target. It implements the PreRestoreInfoGetter interface.

func (*PreRestoreInfoGetterImpl) GetAllTableStructures

func (p *PreRestoreInfoGetterImpl) GetAllTableStructures(ctx context.Context, opts ...ropts.GetPreInfoOption) (map[string]*checkpoints.TidbDBInfo, error)

GetAllTableStructures gets all the table structures with the information from both the source and the target. It implements the PreRestoreInfoGetter interface. It has a caching mechanism: the table structures will be obtained from the source only once.

func (*PreRestoreInfoGetterImpl) GetEmptyRegionsInfo

func (p *PreRestoreInfoGetterImpl) GetEmptyRegionsInfo(ctx context.Context) (*pdtypes.RegionsInfo, error)

GetEmptyRegionsInfo gets the region information of all the empty regions on the target. It implements the PreRestoreInfoGetter interface.

func (*PreRestoreInfoGetterImpl) GetReplicationConfig

func (p *PreRestoreInfoGetterImpl) GetReplicationConfig(ctx context.Context) (*pdtypes.ReplicationConfig, error)

GetReplicationConfig gets the replication config on the target. It implements the PreRestoreInfoGetter interface.

func (*PreRestoreInfoGetterImpl) GetStorageInfo

func (p *PreRestoreInfoGetterImpl) GetStorageInfo(ctx context.Context) (*pdtypes.StoresInfo, error)

GetStorageInfo gets the storage information on the target. It implements the PreRestoreInfoGetter interface.

func (*PreRestoreInfoGetterImpl) GetTargetSysVariablesForImport

func (p *PreRestoreInfoGetterImpl) GetTargetSysVariablesForImport(ctx context.Context, opts ...ropts.GetPreInfoOption) map[string]string

GetTargetSysVariablesForImport gets some important systam variables for importing on the target. It implements the PreRestoreInfoGetter interface. It has caching mechanism.

func (*PreRestoreInfoGetterImpl) Init

func (p *PreRestoreInfoGetterImpl) Init()

Init initializes some internal data and states for PreRestoreInfoGetterImpl.

func (*PreRestoreInfoGetterImpl) IsTableEmpty

func (p *PreRestoreInfoGetterImpl) IsTableEmpty(ctx context.Context, schemaName string, tableName string) (*bool, error)

IsTableEmpty checks whether the specified table on the target DB contains data or not. It implements the PreRestoreInfoGetter interface.

func (*PreRestoreInfoGetterImpl) ReadFirstNRowsByFileMeta

func (p *PreRestoreInfoGetterImpl) ReadFirstNRowsByFileMeta(ctx context.Context, dataFileMeta mydump.SourceFileMeta, n int) ([]string, [][]types.Datum, error)

ReadFirstNRowsByFileMeta reads the first N rows of an data file. It implements the PreRestoreInfoGetter interface.

func (*PreRestoreInfoGetterImpl) ReadFirstNRowsByTableName

func (p *PreRestoreInfoGetterImpl) ReadFirstNRowsByTableName(ctx context.Context, schemaName string, tableName string, n int) ([]string, [][]types.Datum, error)

ReadFirstNRowsByTableName reads the first N rows of data of an importing source table. It implements the PreRestoreInfoGetter interface.

type PrecheckItem

type PrecheckItem interface {
	// Check checks whether it meet some prerequisites for importing
	// If the check is skipped, the returned `CheckResult` is nil
	Check(ctx context.Context) (*CheckResult, error)
	GetCheckItemID() CheckItemID
}

func NewCDCPITRCheckItem

func NewCDCPITRCheckItem(cfg *config.Config) PrecheckItem

NewCDCPITRCheckItem creates a checker to check downstream has enabled CDC or PiTR.

func NewCSVHeaderCheckItem

func NewCSVHeaderCheckItem(cfg *config.Config, preInfoGetter PreRestoreInfoGetter, dbMetas []*mydump.MDDatabaseMeta) PrecheckItem

func NewCheckpointCheckItem

func NewCheckpointCheckItem(cfg *config.Config, preInfoGetter PreRestoreInfoGetter, dbMetas []*mydump.MDDatabaseMeta, checkpointsDB checkpoints.DB) PrecheckItem

func NewClusterResourceCheckItem

func NewClusterResourceCheckItem(preInfoGetter PreRestoreInfoGetter) PrecheckItem

func NewClusterVersionCheckItem

func NewClusterVersionCheckItem(preInfoGetter PreRestoreInfoGetter, dbMetas []*mydump.MDDatabaseMeta) PrecheckItem

func NewEmptyRegionCheckItem

func NewEmptyRegionCheckItem(preInfoGetter PreRestoreInfoGetter, dbMetas []*mydump.MDDatabaseMeta) PrecheckItem

func NewLargeFileCheckItem

func NewLargeFileCheckItem(cfg *config.Config, dbMetas []*mydump.MDDatabaseMeta) PrecheckItem

func NewLocalDiskPlacementCheckItem

func NewLocalDiskPlacementCheckItem(cfg *config.Config) PrecheckItem

func NewLocalTempKVDirCheckItem

func NewLocalTempKVDirCheckItem(cfg *config.Config, preInfoGetter PreRestoreInfoGetter) PrecheckItem

func NewRegionDistributionCheckItem

func NewRegionDistributionCheckItem(preInfoGetter PreRestoreInfoGetter, dbMetas []*mydump.MDDatabaseMeta) PrecheckItem

func NewSchemaCheckItem

func NewSchemaCheckItem(cfg *config.Config, preInfoGetter PreRestoreInfoGetter, dbMetas []*mydump.MDDatabaseMeta, cpdb checkpoints.DB) PrecheckItem

func NewStoragePermissionCheckItem

func NewStoragePermissionCheckItem(cfg *config.Config) PrecheckItem

func NewTableEmptyCheckItem

func NewTableEmptyCheckItem(cfg *config.Config, preInfoGetter PreRestoreInfoGetter, dbMetas []*mydump.MDDatabaseMeta, cpdb checkpoints.DB) PrecheckItem

type PrecheckItemBuilder

type PrecheckItemBuilder struct {
	// contains filtered or unexported fields
}

func NewPrecheckItemBuilder

func NewPrecheckItemBuilder(
	cfg *config.Config,
	dbMetas []*mydump.MDDatabaseMeta,
	preInfoGetter PreRestoreInfoGetter,
	checkpointsDB checkpoints.DB,
) *PrecheckItemBuilder

func NewPrecheckItemBuilderFromConfig

func NewPrecheckItemBuilderFromConfig(ctx context.Context, cfg *config.Config, pdCli pd.Client, opts ...ropts.PrecheckItemBuilderOption) (*PrecheckItemBuilder, error)

func (*PrecheckItemBuilder) BuildPrecheckItem

func (b *PrecheckItemBuilder) BuildPrecheckItem(checkID CheckItemID) (PrecheckItem, error)

func (*PrecheckItemBuilder) GetPreInfoGetter

func (b *PrecheckItemBuilder) GetPreInfoGetter() PreRestoreInfoGetter

GetPreInfoGetter gets the pre restore info getter from the builder.

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 SimpleTemplate

type SimpleTemplate struct {
	// contains filtered or unexported fields
}

func (*SimpleTemplate) Collect

func (c *SimpleTemplate) Collect(t CheckType, passed bool, msg string)

func (*SimpleTemplate) FailedCount

func (c *SimpleTemplate) FailedCount(t CheckType) int

func (*SimpleTemplate) FailedMsg

func (c *SimpleTemplate) FailedMsg() string

func (*SimpleTemplate) Output

func (c *SimpleTemplate) Output() string

func (*SimpleTemplate) Success

func (c *SimpleTemplate) Success() bool

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,
	ignoreColumns map[string]struct{},
	kvStore tidbkv.Storage,
	logger log.Logger,
) (*TableRestore, error)

func (*TableRestore) Close

func (tr *TableRestore) Close()

func (*TableRestore) RebaseChunkRowIDs

func (tr *TableRestore) RebaseChunkRowIDs(cp *checkpoints.TableCheckpoint, rowIDBase int64)

type TargetInfoGetter

type TargetInfoGetter interface {
	// FetchRemoteTableModels fetches the table structures from the remote target.
	FetchRemoteTableModels(ctx context.Context, schemaName string) ([]*model.TableInfo, error)
	// CheckVersionRequirements performs the check whether the target satisfies the version requirements.
	CheckVersionRequirements(ctx context.Context) error
	// IsTableEmpty checks whether the specified table on the target DB contains data or not.
	IsTableEmpty(ctx context.Context, schemaName string, tableName string) (*bool, error)
	// GetTargetSysVariablesForImport gets some important systam variables for importing on the target.
	GetTargetSysVariablesForImport(ctx context.Context, opts ...ropts.GetPreInfoOption) map[string]string
	// GetReplicationConfig gets the replication config on the target.
	GetReplicationConfig(ctx context.Context) (*pdtypes.ReplicationConfig, error)
	// GetStorageInfo gets the storage information on the target.
	GetStorageInfo(ctx context.Context) (*pdtypes.StoresInfo, error)
	// GetEmptyRegionsInfo gets the region information of all the empty regions on the target.
	GetEmptyRegionsInfo(ctx context.Context) (*pdtypes.RegionsInfo, error)
}

TargetInfoGetter defines the operations to get information from target.

type TargetInfoGetterImpl

type TargetInfoGetterImpl struct {
	// contains filtered or unexported fields
}

TargetInfoGetterImpl implements the operations to get information from the target.

func NewTargetInfoGetterImpl

func NewTargetInfoGetterImpl(
	cfg *config.Config,
	targetDB *sql.DB,
	pdCli pd.Client,
) (*TargetInfoGetterImpl, error)

NewTargetInfoGetterImpl creates a TargetInfoGetterImpl object.

func (*TargetInfoGetterImpl) CheckVersionRequirements

func (g *TargetInfoGetterImpl) CheckVersionRequirements(ctx context.Context) error

CheckVersionRequirements performs the check whether the target satisfies the version requirements. It implements the TargetInfoGetter interface. Mydump database metas are retrieved from the context.

func (*TargetInfoGetterImpl) FetchRemoteTableModels

func (g *TargetInfoGetterImpl) FetchRemoteTableModels(ctx context.Context, schemaName string) ([]*model.TableInfo, error)

FetchRemoteTableModels fetches the table structures from the remote target. It implements the TargetInfoGetter interface.

func (*TargetInfoGetterImpl) GetEmptyRegionsInfo

func (g *TargetInfoGetterImpl) GetEmptyRegionsInfo(ctx context.Context) (*pdtypes.RegionsInfo, error)

GetEmptyRegionsInfo gets the region information of all the empty regions on the target. It implements the TargetInfoGetter interface. It uses the PD interface through TLS to get the information.

func (*TargetInfoGetterImpl) GetReplicationConfig

func (g *TargetInfoGetterImpl) GetReplicationConfig(ctx context.Context) (*pdtypes.ReplicationConfig, error)

GetReplicationConfig gets the replication config on the target. It implements the TargetInfoGetter interface. It uses the PD interface through TLS to get the information.

func (*TargetInfoGetterImpl) GetStorageInfo

func (g *TargetInfoGetterImpl) GetStorageInfo(ctx context.Context) (*pdtypes.StoresInfo, error)

GetStorageInfo gets the storage information on the target. It implements the TargetInfoGetter interface. It uses the PD interface through TLS to get the information.

func (*TargetInfoGetterImpl) GetTargetSysVariablesForImport

func (g *TargetInfoGetterImpl) GetTargetSysVariablesForImport(ctx context.Context, _ ...ropts.GetPreInfoOption) map[string]string

GetTargetSysVariablesForImport gets some important system variables for importing on the target. It implements the TargetInfoGetter interface. It uses the SQL to fetch sys variables from the target.

func (*TargetInfoGetterImpl) IsTableEmpty

func (g *TargetInfoGetterImpl) IsTableEmpty(ctx context.Context, schemaName string, tableName string) (*bool, error)

IsTableEmpty checks whether the specified table on the target DB contains data or not. It implements the TargetInfoGetter interface. It tries to select the row count from the target DB.

type Template

type Template interface {
	// Collect mainly collect performance related checks' results and critical level checks' results.
	// If the performance is not as expect or one of critical check not passed. it will stop import task.
	Collect(t CheckType, passed bool, msg string)

	// Success represents the whole check has passed or not.
	Success() bool

	// FailedCount represents (the warn check failed count, the critical check failed count)
	FailedCount(t CheckType) int

	// Output print all checks results.
	Output() string

	// FailedMsg represents the error msg for the failed check.
	FailedMsg() string
}

func NewSimpleTemplate

func NewSimpleTemplate() Template

type TiDBManager

type TiDBManager struct {
	// contains filtered or unexported fields
}

func NewTiDBManager

func NewTiDBManager(ctx context.Context, dsn config.DBStore, tls *common.TLS) (*TiDBManager, error)

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()

func (*TiDBManager) DropTable

func (timgr *TiDBManager) DropTable(ctx context.Context, tableName string) error

Directories

Path Synopsis
opts contains all kinds of options definitions that can affect the behavior of restore & get infos.
opts contains all kinds of options definitions that can affect the behavior of restore & get infos.

Jump to

Keyboard shortcuts

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