Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions br/cmd/br/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ func runBackupCommand(command *cobra.Command, cmdName string) error {
command.SilenceUsage = false
return errors.Trace(err)
}
overrideDefaultBackupConfigIfNeeded(&cfg, command)

if err := metricsutil.RegisterMetricsForBR(cfg.PD, cfg.KeyspaceName); err != nil {
return errors.Trace(err)
Expand Down Expand Up @@ -217,10 +216,3 @@ func newTxnBackupCommand() *cobra.Command {
task.DefineTxnBackupFlags(command)
return command
}

func overrideDefaultBackupConfigIfNeeded(config *task.BackupConfig, cmd *cobra.Command) {
// override only if flag not set by user
if !cmd.Flags().Changed(task.FlagChecksum) {
config.Checksum = false
}
}
9 changes: 5 additions & 4 deletions br/pkg/task/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const (
flagRateLimit = "ratelimit"
flagRateLimitUnit = "ratelimit-unit"
flagConcurrency = "concurrency"
FlagChecksum = "checksum"
flagChecksum = "checksum"
flagFilter = "filter"
flagCaseSensitive = "case-sensitive"
flagRemoveTiFlash = "remove-tiflash"
Expand Down Expand Up @@ -300,7 +300,8 @@ func DefineCommonFlags(flags *pflag.FlagSet) {
flags.Uint(flagChecksumConcurrency, vardef.DefChecksumTableConcurrency, "The concurrency of checksumming in one table")

flags.Uint64(flagRateLimit, unlimited, "The rate limit of the task, MB/s per node")
flags.Bool(FlagChecksum, true, "Run checksum at end of task")
// default to false as we think it's unnecessary to run in production as it's resource intensive
flags.Bool(flagChecksum, false, "Run checksum at end of task")
flags.Bool(flagRemoveTiFlash, true,
"Remove TiFlash replicas before backup or restore, for unsupported versions of TiFlash")

Expand Down Expand Up @@ -362,7 +363,7 @@ func DefineCommonFlags(flags *pflag.FlagSet) {

// HiddenFlagsForStream temporary hidden flags that stream cmd not support.
func HiddenFlagsForStream(flags *pflag.FlagSet) {
_ = flags.MarkHidden(FlagChecksum)
_ = flags.MarkHidden(flagChecksum)
_ = flags.MarkHidden(flagLoadStats)
_ = flags.MarkHidden(flagChecksumConcurrency)
_ = flags.MarkHidden(flagRateLimit)
Expand Down Expand Up @@ -616,7 +617,7 @@ func (cfg *Config) ParseFromFlags(flags *pflag.FlagSet) error {
return errors.Trace(err)
}

if cfg.Checksum, err = flags.GetBool(FlagChecksum); err != nil {
if cfg.Checksum, err = flags.GetBool(flagChecksum); err != nil {
return errors.Trace(err)
}
if cfg.ChecksumConcurrency, err = flags.GetUint(flagChecksumConcurrency); err != nil {
Expand Down
3 changes: 1 addition & 2 deletions br/pkg/task/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func expectedDefaultConfig() Config {
BackendOptions: storage.BackendOptions{S3: storage.S3BackendOptions{ForcePathStyle: true}},
PD: []string{"127.0.0.1:2379"},
ChecksumConcurrency: 4,
Checksum: true,
Checksum: false,
SendCreds: true,
CheckRequirements: true,
FilterStr: []string(nil),
Expand All @@ -287,7 +287,6 @@ func expectedDefaultConfig() Config {

func expectedDefaultBackupConfig() BackupConfig {
defaultConfig := expectedDefaultConfig()
defaultConfig.Checksum = false
return BackupConfig{
Config: defaultConfig,
GCTTL: utils.DefaultBRGCSafePointTTL,
Expand Down
8 changes: 1 addition & 7 deletions pkg/executor/brie.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,8 @@ func (b *executorBuilder) buildBRIE(s *ast.BRIEStmt, schema *expression.Schema)
}
pds := strings.Split(tidbCfg.Path, ",")

// build common config and override for specific task if needed
// build common config
cfg := task.DefaultConfig()
switch s.Kind {
case ast.BRIEKindBackup:
cfg.OverrideDefaultForBackup()
default:
}

cfg.PD = pds
cfg.TLS = tlsCfg

Expand Down
2 changes: 1 addition & 1 deletion pkg/executor/brie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func TestBRIEBuilderOptions(t *testing.T) {
e, ok = exec.(*BRIEExec)
require.True(t, ok)
require.Equal(t, uint(4), e.restoreCfg.ChecksumConcurrency)
require.True(t, e.restoreCfg.Checksum)
require.False(t, e.restoreCfg.Checksum)
require.True(t, e.restoreCfg.WaitTiflashReady)
require.True(t, e.restoreCfg.WithSysTable)
require.True(t, e.restoreCfg.LoadStats)
Expand Down