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

Commit

Permalink
restore: set lower bound of batch size (#276) (#286)
Browse files Browse the repository at this point in the history
* restore: add warn when set concurrency to low

* set lower bound for batch size

Co-authored-by: luancheng <luancheng@pingcap.com>
  • Loading branch information
sre-bot and 3pointer authored May 14, 2020
1 parent bdedff6 commit 2d64507
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/task/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func (cfg *RestoreConfig) ParseFromFlags(flags *pflag.FlagSet) error {
if err != nil {
return errors.Trace(err)
}

if cfg.Config.Concurrency == 0 {
cfg.Config.Concurrency = defaultRestoreConcurrency
}
Expand Down Expand Up @@ -247,7 +248,11 @@ func RunRestore(c context.Context, g glue.Glue, cmdName string, cfg *RestoreConf
}

// Restore sst files in batch.
batchSize := utils.MinInt(int(cfg.Concurrency), maxRestoreBatchSizeLimit)
batchSize := int(cfg.Concurrency)
if batchSize < defaultRestoreConcurrency {
batchSize = defaultRestoreConcurrency
}
batchSize = utils.MinInt(batchSize, maxRestoreBatchSizeLimit)

tiflashStores, err := conn.GetAllTiKVStores(ctx, client.GetPDClient(), conn.TiFlashOnly)
if err != nil {
Expand Down

0 comments on commit 2d64507

Please sign in to comment.