Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disk_snap_restore: remove checking store number #51886

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
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
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 @@ -128,26 +127,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
Loading