loader

package
v0.0.0-...-be15534 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 39 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLightningConfig

func GetLightningConfig(globalCfg *lcfg.GlobalConfig, subtaskCfg *config.SubTaskConfig) (*lcfg.Config, error)

GetLightningConfig returns the lightning task config for the lightning global config and DM subtask config.

func GetTaskInfoSchemaName

func GetTaskInfoSchemaName(dmMetaSchema, taskName string) string

GetTaskInfoSchemaName is used to assign to TikvImporter.DuplicateResolution in lightning config.

func MakeGlobalConfig

func MakeGlobalConfig(cfg *config.SubTaskConfig) *lcfg.GlobalConfig

MakeGlobalConfig converts subtask config to lightning global config.

func RegisterMetrics

func RegisterMetrics(registry *prometheus.Registry)

RegisterMetrics registers metrics.

func SQLReplace

func SQLReplace(s, oldStr, newStr string, ansiquote bool) string

SQLReplace works like strings.Replace but only supports one replacement. It uses backquote pairs to quote the old and new word.

Types

type LightningCheckpointList

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

func NewLightningCheckpointList

func NewLightningCheckpointList(
	db *conn.BaseDB,
	taskName string,
	sourceName string,
	metaSchema string,
	logger log.Logger,
) *LightningCheckpointList

func (*LightningCheckpointList) Close

func (cp *LightningCheckpointList) Close()

Close implements CheckPoint.Close.

func (*LightningCheckpointList) Prepare

func (cp *LightningCheckpointList) Prepare(ctx context.Context) error

func (*LightningCheckpointList) RegisterCheckPoint

func (cp *LightningCheckpointList) RegisterCheckPoint(ctx context.Context) error

func (*LightningCheckpointList) UpdateStatus

func (cp *LightningCheckpointList) UpdateStatus(ctx context.Context, status lightingLoadStatus) error

type LightningLoader

type LightningLoader struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

LightningLoader can load your mydumper data into TiDB database.

func NewLightning

func NewLightning(cfg *config.SubTaskConfig, cli *clientv3.Client, workerName string) *LightningLoader

NewLightning creates a new Loader importing data with lightning.

func (*LightningLoader) Close

func (l *LightningLoader) Close()

Close does graceful shutdown.

func (*LightningLoader) Init

func (l *LightningLoader) Init(ctx context.Context) (err error)

Init initializes loader for a load task, but not start Process. if fail, it should not call l.Close.

func (*LightningLoader) IsFreshTask

func (l *LightningLoader) IsFreshTask(ctx context.Context) (bool, error)

IsFreshTask implements Unit.IsFreshTask.

func (*LightningLoader) Kill

func (l *LightningLoader) Kill()

Kill does ungraceful shutdown.

func (*LightningLoader) Pause

func (l *LightningLoader) Pause()

Pause pauses the process, and it can be resumed later should cancel context from external.

func (*LightningLoader) Process

func (l *LightningLoader) Process(ctx context.Context, pr chan pb.ProcessResult)

Process implements Unit.Process.

func (*LightningLoader) Resume

func (l *LightningLoader) Resume(ctx context.Context, pr chan pb.ProcessResult)

Resume resumes the paused process.

func (*LightningLoader) Status

func (l *LightningLoader) Status(_ *binlog.SourceStatus) interface{}

Status returns the unit's current status.

func (*LightningLoader) Type

func (l *LightningLoader) Type() pb.UnitType

Type implements Unit.Type.

func (*LightningLoader) Update

Update implements Unit.Update now, only support to update config for routes, filters, column-mappings, block-allow-list now no config diff implemented, so simply re-init use new config no binlog filter for loader need to update.

Jump to

Keyboard shortcuts

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