Documentation ¶
Index ¶
- Constants
- func CalcChecksumAndRangeFromBackupMeta(ctx context.Context, backupMeta *backuppb.BackupMeta, ...) (rawkv.RawChecksum, []*utils.KeyRange)
- func CheckBackupAPIVersion(gate *feature.Gate, storageAPIVersion, dstAPIVersion kvrpcpb.APIVersion) bool
- func DefineBackupFlags(flags *pflag.FlagSet)
- func DefineCommonFlags(flags *pflag.FlagSet)
- func DefineRawBackupFlags(command *cobra.Command)
- func DefineRawRestoreFlags(command *cobra.Command)
- func DefineRestoreCommonFlags(flags *pflag.FlagSet)
- func DefineRestoreFlags(flags *pflag.FlagSet)
- func GetKeepalive(cfg *Config) keepalive.ClientParameters
- func GetStorage(ctx context.Context, cfg *Config) (*backuppb.StorageBackend, storage.ExternalStorage, error)
- func LogArguments(cmd *cobra.Command)
- func NewMgr(ctx context.Context, g glue.Glue, pds []string, tlsConfig utils.TLSConfig, ...) (*conn.Mgr, error)
- func ReadBackupMeta(ctx context.Context, fileName string, cfg *Config) (*backuppb.StorageBackend, storage.ExternalStorage, *backuppb.BackupMeta, error)
- func RunBackupRaw(c context.Context, g glue.Glue, cmdName string, cfg *RawKvConfig) error
- func RunRestoreRaw(c context.Context, g glue.Glue, cmdName string, cfg *RestoreRawConfig) (err error)
- type CompressionConfig
- type Config
- type RawKvConfig
- type RestoreCommonConfig
- type RestoreRawConfig
Constants ¶
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 ¶
DefineBackupFlags defines common flags for the backup command.
func DefineCommonFlags ¶
DefineCommonFlags defines the flags common to all BRIE commands.
func DefineRawBackupFlags ¶
DefineRawBackupFlags defines common flags for the backup command.
func DefineRawRestoreFlags ¶
DefineRawRestoreFlags defines common flags for the backup command.
func DefineRestoreCommonFlags ¶
DefineRestoreCommonFlags defines common flags for the restore command.
func DefineRestoreFlags ¶
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 ¶
func GetStorage( ctx context.Context, cfg *Config, ) (*backuppb.StorageBackend, storage.ExternalStorage, error)
GetStorage gets the storage backend from the config.
func LogArguments ¶
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 ¶
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.
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.