Skip to content

Commit

Permalink
fix integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Jianjun Liao <[email protected]>
  • Loading branch information
Leavrth committed Jul 5, 2024
1 parent ad64084 commit 9653af9
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions br/pkg/task/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9653af9

Please sign in to comment.