Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: hillium <yujuncen@pingcap.com>
  • Loading branch information
YuJuncen committed Aug 18, 2023
1 parent 0c4e9d8 commit 99308df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 6 additions & 4 deletions br/pkg/restore/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ func (bo *recoveryBackoffer) Attempt() int {
// 5. prepare the flashback
// 6. flashback to resolveTS
func RecoverData(ctx context.Context, resolveTS uint64, allStores []*metapb.Store, mgr *conn.Mgr, progress glue.Progress, restoreTS uint64, concurrency uint32) (int, error) {
// Roughly handle the case that some TiKVs are rebooted during making plan.
// Generally, retry the whole procedure will be fine for most cases. But perhaps we can do finer-grained retry,
// say, we may reuse the recovery plan, and probably no need to rebase PD allocation ID once we have done it.
return utils.WithRetryV2(ctx, newRecoveryBackoffer(), func(ctx context.Context) (int, error) {
return doRecoveryData(ctx, resolveTS, allStores, mgr, progress, restoreTS, concurrency)
})

Check warning on line 112 in br/pkg/restore/data.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/restore/data.go#L107-L112

Added lines #L107 - L112 were not covered by tests
Expand All @@ -121,8 +124,7 @@ func doRecoveryData(ctx context.Context, resolveTS uint64, allStores []*metapb.S

totalRegions := recovery.GetTotalRegions()

err := recovery.MakeRecoveryPlan()
if err != nil {
if err := recovery.MakeRecoveryPlan(); err != nil {
return totalRegions, recoveryError{error: err, atStage: StageMakingRecoveryPlan}

Check warning on line 128 in br/pkg/restore/data.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/restore/data.go#L128

Added line #L128 was not covered by tests
}

Expand All @@ -141,8 +143,8 @@ func doRecoveryData(ctx context.Context, resolveTS uint64, allStores []*metapb.S
if err := recovery.WaitApply(ctx); err != nil {
return totalRegions, recoveryError{error: err, atStage: StageRecovering}

Check warning on line 144 in br/pkg/restore/data.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/restore/data.go#L144

Added line #L144 was not covered by tests
}
err = recovery.PrepareFlashbackToVersion(ctx, resolveTS, restoreTS-1)
if err != nil {

if err := recovery.PrepareFlashbackToVersion(ctx, resolveTS, restoreTS-1); err != nil {
return totalRegions, recoveryError{error: err, atStage: StageFlashback}

Check warning on line 148 in br/pkg/restore/data.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/restore/data.go#L148

Added line #L148 was not covered by tests
}

Expand Down
2 changes: 0 additions & 2 deletions br/pkg/task/restore_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ func RunResolveKvData(c context.Context, g glue.Glue, cmdName string, cfg *Resto
// restore tikv data from a snapshot volume
var totalRegions int

// Roughly handle the case that some TiKVs are rebooted during making plan.
// Generally,
totalRegions, err = restore.RecoverData(ctx, resolveTS, allStores, mgr, progress, restoreTS, cfg.Concurrency)
if err != nil {
return errors.Trace(err)
Expand Down

0 comments on commit 99308df

Please sign in to comment.