task

package
v4.0.11+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefineBackupFlags

func DefineBackupFlags(flags *pflag.FlagSet)

DefineBackupFlags defines common flags for the backup command.

func DefineCommonFlags

func DefineCommonFlags(flags *pflag.FlagSet)

DefineCommonFlags defines the flags common to all BRIE commands.

func DefineDatabaseFlags

func DefineDatabaseFlags(command *cobra.Command)

DefineDatabaseFlags defines the required --db flag for `db` subcommand.

func DefineFilterFlags

func DefineFilterFlags(command *cobra.Command)

DefineFilterFlags defines the --filter and --case-sensitive flags for `full` subcommand.

func DefineLogRestoreFlags

func DefineLogRestoreFlags(command *cobra.Command)

DefineLogRestoreFlags defines common flags for the backup command.

func DefineRawBackupFlags

func DefineRawBackupFlags(command *cobra.Command)

DefineRawBackupFlags defines common flags for the backup command.

func DefineRawRestoreFlags

func DefineRawRestoreFlags(command *cobra.Command)

DefineRawRestoreFlags defines common flags for the backup command.

func DefineRestoreFlags

func DefineRestoreFlags(flags *pflag.FlagSet)

DefineRestoreFlags defines common flags for the restore command.

func DefineTableFlags

func DefineTableFlags(command *cobra.Command)

DefineTableFlags defines the required --db and --table flags for `table` subcommand.

func GetKeepalive

func GetKeepalive(cfg *Config) keepalive.ClientParameters

GetKeepalive get the keepalive info from the config.

func GetStorage

GetStorage gets the storage backend from the config.

func LogArguments

func LogArguments(cmd *cobra.Command)

LogArguments prints origin command arguments.

func NewMgr

func NewMgr(ctx context.Context,
	g glue.Glue, pds []string,
	tlsConfig TLSConfig,
	keepalive keepalive.ClientParameters,
	checkRequirements bool) (*conn.Mgr, error)

NewMgr creates a new mgr at the given PD address.

func ReadBackupMeta

func ReadBackupMeta(
	ctx context.Context,
	fileName string,
	cfg *Config,
) (*backup.StorageBackend, storage.ExternalStorage, *backup.BackupMeta, error)

ReadBackupMeta reads the backupmeta file from the storage.

func RunBackup

func RunBackup(c context.Context, g glue.Glue, cmdName string, cfg *BackupConfig) error

RunBackup starts a backup task inside the current goroutine.

func RunBackupRaw

func RunBackupRaw(c context.Context, g glue.Glue, cmdName string, cfg *RawKvConfig) error

RunBackupRaw starts a backup task inside the current goroutine.

func RunLogRestore

func RunLogRestore(c context.Context, g glue.Glue, cfg *LogRestoreConfig) error

RunLogRestore starts a restore task inside the current goroutine.

func RunRestore

func RunRestore(c context.Context, g glue.Glue, cmdName string, cfg *RestoreConfig) error

RunRestore starts a restore task inside the current goroutine.

func RunRestoreRaw

func RunRestoreRaw(c context.Context, g glue.Glue, cmdName string, cfg *RestoreRawConfig) (err error)

RunRestoreRaw starts a raw kv restore task inside the current goroutine.

Types

type BackupConfig

type BackupConfig struct {
	Config

	TimeAgo          time.Duration `json:"time-ago" toml:"time-ago"`
	BackupTS         uint64        `json:"backup-ts" toml:"backup-ts"`
	LastBackupTS     uint64        `json:"last-backup-ts" toml:"last-backup-ts"`
	GCTTL            int64         `json:"gc-ttl" toml:"gc-ttl"`
	RemoveSchedulers bool          `json:"remove-schedulers" toml:"remove-schedulers"`
	IgnoreStats      bool          `json:"ignore-stats" toml:"ignore-stats"`
	CompressionConfig
}

BackupConfig is the configuration specific for backup tasks.

func (*BackupConfig) ParseFromFlags

func (cfg *BackupConfig) ParseFromFlags(flags *pflag.FlagSet) error

ParseFromFlags parses the backup-related flags from the flag set.

type CompressionConfig

type CompressionConfig struct {
	CompressionType  kvproto.CompressionType `json:"compression-type" toml:"compression-type"`
	CompressionLevel int32                   `json:"compression-level" toml:"compression-level"`
}

CompressionConfig is the configuration for sst file compression.

type Config

type Config struct {
	storage.BackendOptions

	Storage             string    `json:"storage" toml:"storage"`
	PD                  []string  `json:"pd" toml:"pd"`
	TLS                 TLSConfig `json:"tls" toml:"tls"`
	RateLimit           uint64    `json:"rate-limit" toml:"rate-limit"`
	ChecksumConcurrency uint      `json:"checksum-concurrency" toml:"checksum-concurrency"`
	Concurrency         uint32    `json:"concurrency" toml:"concurrency"`
	Checksum            bool      `json:"checksum" toml:"checksum"`
	SendCreds           bool      `json:"send-credentials-to-tikv" toml:"send-credentials-to-tikv"`
	// LogProgress is true means the progress bar is printed to the log instead of stdout.
	LogProgress bool `json:"log-progress" toml:"log-progress"`

	// CaseSensitive should not be used.
	//
	// Deprecated: This field is kept only to satisfy the cyclic dependency with TiDB. This field
	// should be removed after TiDB upgrades the BR dependency.
	CaseSensitive bool
	// Filter should not be used, use TableFilter instead.
	//
	// Deprecated: This field is kept only to satisfy the cyclic dependency with TiDB. This field
	// should be removed after TiDB upgrades the BR dependency.
	Filter filter.MySQLReplicationRules

	TableFilter        filter.Filter `json:"-" toml:"-"`
	CheckRequirements  bool          `json:"check-requirements" toml:"check-requirements"`
	SwitchModeInterval time.Duration `json:"switch-mode-interval" toml:"switch-mode-interval"`

	// GrpcKeepaliveTime is the interval of pinging the server.
	GRPCKeepaliveTime time.Duration `json:"grpc-keepalive-time" toml:"grpc-keepalive-time"`
	// GrpcKeepaliveTimeout is the max time a grpc conn can keep idel before killed.
	GRPCKeepaliveTimeout time.Duration `json:"grpc-keepalive-timeout" toml:"grpc-keepalive-timeout"`
}

Config is the common configuration for all BRIE tasks.

func (*Config) ParseFromFlags

func (cfg *Config) ParseFromFlags(flags *pflag.FlagSet) error

ParseFromFlags parses the config from the flag set.

type LogRestoreConfig

type LogRestoreConfig struct {
	Config

	StartTS uint64
	EndTS   uint64

	BatchFlushKVPairs int
	BatchFlushKVSize  int64
	BatchWriteKVPairs int
}

LogRestoreConfig is the configuration specific for restore tasks.

func (*LogRestoreConfig) ParseFromFlags

func (cfg *LogRestoreConfig) ParseFromFlags(flags *pflag.FlagSet) error

ParseFromFlags parses the restore-related flags from the flag set.

type RawKvConfig

type RawKvConfig struct {
	Config

	StartKey []byte `json:"start-key" toml:"start-key"`
	EndKey   []byte `json:"end-key" toml:"end-key"`
	CF       string `json:"cf" toml:"cf"`
	CompressionConfig
	RemoveSchedulers bool `json:"remove-schedulers" toml:"remove-schedulers"`
}

RawKvConfig is the common config for rawkv backup and restore.

func (*RawKvConfig) ParseBackupConfigFromFlags

func (cfg *RawKvConfig) ParseBackupConfigFromFlags(flags *pflag.FlagSet) error

ParseBackupConfigFromFlags parses the backup-related flags from the flag set.

func (*RawKvConfig) ParseFromFlags

func (cfg *RawKvConfig) ParseFromFlags(flags *pflag.FlagSet) error

ParseFromFlags parses the raw kv backup&restore common flags from the flag set.

type RestoreConfig

type RestoreConfig struct {
	Config

	Online   bool `json:"online" toml:"online"`
	NoSchema bool `json:"no-schema" toml:"no-schema"`
}

RestoreConfig is the configuration specific for restore tasks.

func (*RestoreConfig) ParseFromFlags

func (cfg *RestoreConfig) ParseFromFlags(flags *pflag.FlagSet) error

ParseFromFlags parses the restore-related flags from the flag set.

type RestoreRawConfig

type RestoreRawConfig struct {
	RawKvConfig

	Online bool `json:"online" toml:"online"`
}

RestoreRawConfig is the configuration specific for raw kv restore tasks.

func (*RestoreRawConfig) ParseFromFlags

func (cfg *RestoreRawConfig) ParseFromFlags(flags *pflag.FlagSet) error

ParseFromFlags parses the backup-related flags from the flag set.

type TLSConfig

type TLSConfig struct {
	CA   string `json:"ca" toml:"ca"`
	Cert string `json:"cert" toml:"cert"`
	Key  string `json:"key" toml:"key"`
}

TLSConfig is the common configuration for TLS connection.

func (*TLSConfig) IsEnabled

func (tls *TLSConfig) IsEnabled() bool

IsEnabled checks if TLS open or not.

func (*TLSConfig) ParseFromFlags

func (tls *TLSConfig) ParseFromFlags(flags *pflag.FlagSet) error

ParseFromFlags parses the TLS config from the flag set.

func (*TLSConfig) ToTLSConfig

func (tls *TLSConfig) ToTLSConfig() (*tls.Config, error)

ToTLSConfig generate tls.Config.

Jump to

Keyboard shortcuts

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