Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

backup: set concurrency to 1 when ratelimit enabled #1015

Merged
merged 6 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions pkg/task/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ func (cfg *BackupConfig) adjustBackupConfig() {
if cfg.Config.Concurrency > maxBackupConcurrency {
cfg.Config.Concurrency = maxBackupConcurrency
}
if cfg.RateLimit != unlimited {
// TiKV limits the upload rate by each backup request.
// When the backup requests are sent concurrently,
// the ratelimit couldn't work as intended.
// Degenerating to sequentially sending backup requests to avoid this.
cfg.Config.Concurrency = 1
}

if cfg.GCTTL == 0 {
cfg.GCTTL = utils.DefaultBRGCSafePointTTL
Expand Down
4 changes: 3 additions & 1 deletion pkg/task/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ const (
defaultSwitchInterval = 5 * time.Minute
defaultGRPCKeepaliveTime = 10 * time.Second
defaultGRPCKeepaliveTimeout = 3 * time.Second

unlimited = 0
)

// TLSConfig is the common configuration for TLS connection.
Expand Down Expand Up @@ -155,7 +157,7 @@ func DefineCommonFlags(flags *pflag.FlagSet) {
flags.Uint(flagChecksumConcurrency, variable.DefChecksumTableConcurrency, "The concurrency of table checksumming")
_ = flags.MarkHidden(flagChecksumConcurrency)

flags.Uint64(flagRateLimit, 0, "The rate limit of the task, MB/s per node")
flags.Uint64(flagRateLimit, unlimited, "The rate limit of the task, MB/s per node")
flags.Bool(flagChecksum, true, "Run checksum at end of task")
flags.Bool(flagRemoveTiFlash, true,
"Remove TiFlash replicas before backup or restore, for unsupported versions of TiFlash")
Expand Down