Skip to content

Commit

Permalink
Merge pull request #4 from xu21yingan/patch-2
Browse files Browse the repository at this point in the history
Fine tuning dry-run in order to avoid recover-data
  • Loading branch information
fengou1 authored Jul 15, 2022
2 parents 0fe6c23 + 3d1f626 commit 6cb49ea
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions br/pkg/task/restore_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,17 @@ func RunRestoreData(c context.Context, g glue.Glue, cmdName string, cfg *Restore

var resolveTs uint64
var numOfStores int
if cfg.DryRun {
resolveTs = 46464574745
numOfStores = 3
} else {

_, externStorage, err := GetStorage(ctx, cfg.Config.Storage, &cfg.Config)
if err != nil {
return errors.Trace(err)
}

resolveTs, numOfStores, err = ReadBackupMetaData(ctx, externStorage)
if err != nil {
return errors.Trace(err)
}
_, externStorage, err := GetStorage(ctx, cfg.Config.Storage, &cfg.Config)
if err != nil {
return errors.Trace(err)
}

resolveTs, numOfStores, err = ReadBackupMetaData(ctx, externStorage)
if err != nil {
return errors.Trace(err)
}

restoreTS, err := client.GetTS(ctx)
if err != nil {
return errors.Trace(err)
Expand Down Expand Up @@ -172,10 +167,14 @@ func RunRestoreData(c context.Context, g glue.Glue, cmdName string, cfg *Restore

totalTiKV = numOfStores

totalRegions, err = restore.RecoverData(ctx, resolveTs, allStores, mgr.GetTLSConfig(), cfg.DumpRegionInfo)
if err != nil {
return errors.Trace(err)
}
if cfg.DryRun {
totalRegions = 1024
} else {
totalRegions, err = restore.RecoverData(ctx, resolveTs, allStores, mgr.GetTLSConfig(), cfg.DumpRegionInfo)
if err != nil {
return errors.Trace(err)
}
}

log.Info("unmark recovering to pd")
if err := mgr.UnmarkRecovering(ctx); err != nil {
Expand Down

0 comments on commit 6cb49ea

Please sign in to comment.