From 9653af90135c077e2ee02aa24761a4228d920980 Mon Sep 17 00:00:00 2001 From: Jianjun Liao Date: Fri, 5 Jul 2024 14:18:24 +0800 Subject: [PATCH] fix integration test Signed-off-by: Jianjun Liao --- br/pkg/task/backup.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/br/pkg/task/backup.go b/br/pkg/task/backup.go index 0e95fc4c16e0b..bd5c479076ece 100644 --- a/br/pkg/task/backup.go +++ b/br/pkg/task/backup.go @@ -630,22 +630,22 @@ func RunBackup(c context.Context, g glue.Glue, cmdName string, cfg *BackupConfig progressCallBack := func(callBackUnit backup.ProgressUnit) { if progressUnit == callBackUnit { updateCh.Inc() - } - failpoint.Inject("progress-call-back", func(v failpoint.Value) { - log.Info("failpoint progress-call-back injected") - atomic.AddUint64(&progressCount, 1) - if fileName, ok := v.(string); ok { - f, osErr := os.OpenFile(fileName, os.O_CREATE|os.O_WRONLY, os.ModePerm) - if osErr != nil { - log.Warn("failed to create file", zap.Error(osErr)) - } - msg := []byte(fmt.Sprintf("region:%d\n", atomic.LoadUint64(&progressCount))) - _, err = f.Write(msg) - if err != nil { - log.Warn("failed to write data to file", zap.Error(err)) + failpoint.Inject("progress-call-back", func(v failpoint.Value) { + log.Info("failpoint progress-call-back injected") + atomic.AddUint64(&progressCount, 1) + if fileName, ok := v.(string); ok { + f, osErr := os.OpenFile(fileName, os.O_CREATE|os.O_WRONLY, os.ModePerm) + if osErr != nil { + log.Warn("failed to create file", zap.Error(osErr)) + } + msg := []byte(fmt.Sprintf("%s:%d\n", progressUnit, atomic.LoadUint64(&progressCount))) + _, err = f.Write(msg) + if err != nil { + log.Warn("failed to write data to file", zap.Error(err)) + } } - } - }) + }) + } } if cfg.UseCheckpoint {