Skip to content

Commit

Permalink
log_backup: remove checking store number (#51886) (#51961)
Browse files Browse the repository at this point in the history
close #51957
  • Loading branch information
ti-chi-bot authored Mar 20, 2024
1 parent 9ad6f42 commit 183b430
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions br/pkg/task/restore_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/pingcap/tidb/br/pkg/config"
"github.com/pingcap/tidb/br/pkg/conn"
"github.com/pingcap/tidb/br/pkg/conn/util"
berrors "github.com/pingcap/tidb/br/pkg/errors"
"github.com/pingcap/tidb/br/pkg/glue"
"github.com/pingcap/tidb/br/pkg/restore"
"github.com/pingcap/tidb/br/pkg/storage"
Expand Down Expand Up @@ -58,7 +57,7 @@ func RunResolveKvData(c context.Context, g glue.Glue, cmdName string, cfg *Resto
return errors.Trace(err)
}

resolveTS, numBackupStore, err := ReadBackupMetaData(ctx, externStorage)
resolveTS, numStores, err := ReadBackupMetaData(ctx, externStorage)
if err != nil {
return errors.Trace(err)
}
Expand Down Expand Up @@ -122,26 +121,23 @@ func RunResolveKvData(c context.Context, g glue.Glue, cmdName string, cfg *Resto
if err != nil {
return errors.Trace(err)
}
numOnlineStore := len(allStores)
// in this version, it suppose to have the same number of tikvs between backup cluster and restore cluster
if numOnlineStore != numBackupStore {
log.Warn("the restore meta contains the number of tikvs inconsist with the resore cluster, retry ...", zap.Int("current stores", len(allStores)), zap.Int("backup stores", numBackupStore))
return errors.Annotatef(berrors.ErrRestoreTotalKVMismatch,
"number of tikvs mismatch")
}
return nil
},
utils.NewPDReqBackofferExt(),
)
restoreNumStores := len(allStores)
if restoreNumStores != numStores {
log.Warn("the number of stores in the cluster has changed", zap.Int("origin", numStores), zap.Int("current", restoreNumStores))
}

if err != nil {
return errors.Trace(err)
}

log.Debug("total tikv", zap.Int("total", numBackupStore), zap.String("progress file", cfg.ProgressFile))
log.Debug("total tikv", zap.Int("total", restoreNumStores), zap.String("progress file", cfg.ProgressFile))
// progress = read meta + send recovery + iterate tikv + (1 * prepareflashback + 1 * flashback)
progress := g.StartProgress(ctx, cmdName, int64(numBackupStore*3+2), !cfg.LogProgress)
go progressFileWriterRoutine(ctx, progress, int64(numBackupStore*3+2), cfg.ProgressFile)
progress := g.StartProgress(ctx, cmdName, int64(restoreNumStores*3+2), !cfg.LogProgress)
go progressFileWriterRoutine(ctx, progress, int64(restoreNumStores*3+2), cfg.ProgressFile)

// restore tikv data from a snapshot volume
var totalRegions int
Expand Down

0 comments on commit 183b430

Please sign in to comment.