diff --git a/br/pkg/task/restore.go b/br/pkg/task/restore.go index 58df02811206b..d20a3c0820a30 100644 --- a/br/pkg/task/restore.go +++ b/br/pkg/task/restore.go @@ -1556,7 +1556,6 @@ func adjustTablesToRestoreAndCreateFilter( break } } - } } // store the filter into config diff --git a/br/pkg/task/stream.go b/br/pkg/task/stream.go index 6cb40c7120bdc..3a9d236208da5 100644 --- a/br/pkg/task/stream.go +++ b/br/pkg/task/stream.go @@ -1229,7 +1229,11 @@ func RunStreamRestore( return errors.Trace(err) } defer logClient.Close(ctx) + ddlFiles, err := logClient.LoadDDLFilesAndCountDMLFiles(ctx) + if err != nil { + return errors.Trace(err) + } logBackupTableHistory, err = logClient.LoadMetaKVFilesAndBuildTableRenameInfo(ctx, ddlFiles) if err != nil { return errors.Trace(err) @@ -1315,10 +1319,10 @@ func restoreStream( } client, err := createLogClient(ctx, g, cfg, mgr) - defer client.Close(ctx) if err != nil { return errors.Annotate(err, "failed to create log client") } + defer client.Close(ctx) if checkpointTaskInfo != nil && checkpointTaskInfo.Metadata != nil { // reuse the checkpoint task's rewrite ts @@ -1897,7 +1901,6 @@ func isNewRestoreTask(checkpointTaskInfo *checkpoint.CheckpointTaskInfoForLogRes func buildSchemaReplace(ctx context.Context, client *logclient.LogClient, cfg *RestoreConfig, isNewRestoreTask bool) ( *stream.SchemasReplace, error) { - // get full backup meta storage to generate rewrite rules. fullBackupStorage, err := parseFullBackupTablesStorage(cfg) if err != nil {