task

package
v0.0.0-...-1b33b2a Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0, Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// FlagMergeRegionSizeBytes is the flag name of merge small regions by size
	FlagMergeRegionSizeBytes = "merge-region-size-bytes"
	// FlagMergeRegionKeyCount is the flag name of merge small regions by key count
	FlagMergeRegionKeyCount = "merge-region-key-count"
	// FlagPDConcurrency controls concurrency pd-relative operations like split & scatter.
	FlagPDConcurrency = "pd-concurrency"
	// FlagBatchFlushInterval controls after how long the restore batch would be auto sended.
	FlagBatchFlushInterval = "batch-flush-interval"
)

Variables

This section is empty.

Functions

func CalcChecksumAndRangeFromBackupMeta

func CalcChecksumAndRangeFromBackupMeta(ctx context.Context, backupMeta *backuppb.BackupMeta, curAPIVersion kvrpcpb.APIVersion) (rawkv.RawChecksum, []*utils.KeyRange)

CalcChecksumFromBackupMeta read the backup meta and return Checksum

func CheckBackupAPIVersion

func CheckBackupAPIVersion(gate *feature.Gate, storageAPIVersion, dstAPIVersion kvrpcpb.APIVersion) bool

CheckBackupAPIVersion return false if backup api version is not supported.

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 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 DefineRestoreCommonFlags

func DefineRestoreCommonFlags(flags *pflag.FlagSet)

DefineRestoreCommonFlags defines common flags for the restore command.

func DefineRestoreFlags

func DefineRestoreFlags(flags *pflag.FlagSet)

DefineRestoreFlags defines common flags for the restore tidb command.

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 utils.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,
) (*backuppb.StorageBackend, storage.ExternalStorage, *backuppb.BackupMeta, error)

ReadBackupMeta reads the backupmeta file from the storage.

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 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 CompressionConfig

type CompressionConfig struct {
	CompressionType  backuppb.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                 utils.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

	// NoCreds means don't try to load cloud credentials
	NoCreds bool `json:"no-credentials" toml:"no-credentials"`

	CheckRequirements bool `json:"check-requirements" toml:"check-requirements"`
	// EnableOpenTracing is whether to enable opentracing
	EnableOpenTracing bool `json:"enable-opentracing" toml:"enable-opentracing"`
	// SkipCheckPath skips verifying the path
	// deprecated
	SkipCheckPath bool `json:"skip-check-path" toml:"skip-check-path"`

	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"`

	CipherInfo backuppb.CipherInfo `json:"-" toml:"-"`
}

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 RawKvConfig

type RawKvConfig struct {
	Config

	StartKey      []byte `json:"start-key" toml:"start-key"`
	EndKey        []byte `json:"end-key" toml:"end-key"`
	DstAPIVersion string `json:"dst-api-version" toml:"dst-api-version"`
	CompressionConfig
	RemoveSchedulers bool          `json:"remove-schedulers" toml:"remove-schedulers"`
	SafeInterval     time.Duration `json:"safe-interval" toml:"safe-interval"`
	GCTTL            time.Duration `json:"gc-ttl" toml:"gc-ttl"`
}

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 RestoreCommonConfig

type RestoreCommonConfig struct {
	Online bool `json:"online" toml:"online"`

	// MergeSmallRegionSizeBytes is the threshold of merging small regions (Default 96MB, region split size).
	// MergeSmallRegionKeyCount is the threshold of merging smalle regions (Default 960_000, region split key count).
	// See https://github.com/tikv/tikv/blob/v4.0.8/components/raftstore/src/coprocessor/config.rs#L35-L38
	MergeSmallRegionSizeBytes uint64 `json:"merge-region-size-bytes" toml:"merge-region-size-bytes"`
	MergeSmallRegionKeyCount  uint64 `json:"merge-region-key-count" toml:"merge-region-key-count"`
}

RestoreCommonConfig is the common configuration for all BR restore tasks.

func (*RestoreCommonConfig) ParseFromFlags

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

ParseFromFlags parses the config from the flag set.

type RestoreRawConfig

type RestoreRawConfig struct {
	RawKvConfig
	RestoreCommonConfig
}

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.

Jump to

Keyboard shortcuts

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