From ac1c9816148b4becb1feb9bc742c4cebe194812a Mon Sep 17 00:00:00 2001 From: Leavrth Date: Mon, 16 Jan 2023 14:23:32 +0800 Subject: [PATCH] don't show the failed import on log Signed-off-by: Leavrth --- br/pkg/restore/client.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/br/pkg/restore/client.go b/br/pkg/restore/client.go index 1e494819d463c..e218ca7b014bc 100644 --- a/br/pkg/restore/client.go +++ b/br/pkg/restore/client.go @@ -2043,19 +2043,21 @@ func (rc *Client) RestoreKVFiles( log.Debug("skip file due to table id not matched", zap.Int64("table-id", files[0].TableId)) skipFile += len(files) } else { - rc.workerPool.ApplyOnErrorGroup(eg, func() error { + rc.workerPool.ApplyOnErrorGroup(eg, func() (err error) { fileStart := time.Now() defer func() { onProgress(int64(len(files))) updateStats(uint64(kvCount), size) summary.CollectInt("File", len(files)) - filenames := make([]string, 0, len(files)) - for _, f := range files { - filenames = append(filenames, f.Path+", ") + if err == nil { + filenames := make([]string, 0, len(files)) + for _, f := range files { + filenames = append(filenames, f.Path+", ") + } + log.Info("import files done", zap.Int("batch-count", len(files)), zap.Uint64("batch-size", size), + zap.Duration("take", time.Since(fileStart)), zap.Strings("files", filenames)) } - log.Info("import files done", zap.Int("batch-count", len(files)), zap.Uint64("batch-size", size), - zap.Duration("take", time.Since(fileStart)), zap.Strings("files", filenames)) }() return rc.fileImporter.ImportKVFiles(ectx, files, rule, rc.shiftStartTS, rc.startTS, rc.restoreTS, supportBatch)