@@ -563,28 +563,14 @@ func (r *restoreResumer) sendDownloadWorker(
563
563
return err
564
564
}
565
565
566
- var err error
567
- for r := retry .StartWithCtx (ctx , retry.Options {
568
- InitialBackoff : time .Millisecond * 100 ,
569
- MaxBackoff : time .Second ,
570
- MaxRetries : maxDownloadAttempts - 1 ,
571
- }); r .Next (); {
572
- err = func () error {
573
- if testingKnobs != nil && testingKnobs .RunBeforeSendingDownloadSpan != nil {
574
- if err := testingKnobs .RunBeforeSendingDownloadSpan (); err != nil {
575
- return err
576
- }
577
- }
578
- return sendDownloadSpan (ctx , execCtx , spans )
579
- }()
580
- if err == nil {
581
- break
566
+ if testingKnobs != nil && testingKnobs .RunBeforeSendingDownloadSpan != nil {
567
+ if err := testingKnobs .RunBeforeSendingDownloadSpan (); err != nil {
568
+ return err
582
569
}
583
- log .VInfof (ctx , 1 , "attempt %d failed to download spans: %v" , r .CurrentAttempt (), err )
584
570
}
585
571
586
- if err != nil {
587
- return errors . Wrapf ( err , "retries exhausted for sending download spans" )
572
+ if err := sendDownloadSpan ( ctx , execCtx , spans ); err != nil {
573
+ return err
588
574
}
589
575
590
576
// Wait for the completion poller to signal that it has checked our work.
@@ -818,6 +804,24 @@ func getRemainingExternalFileBytes(
818
804
return remaining , nil
819
805
}
820
806
807
+ func (r * restoreResumer ) doDownloadFilesWithRetry (
808
+ ctx context.Context , execCtx sql.JobExecContext ,
809
+ ) error {
810
+ var err error
811
+ for rt := retry .StartWithCtx (ctx , retry.Options {
812
+ InitialBackoff : time .Millisecond * 100 ,
813
+ MaxBackoff : time .Second ,
814
+ MaxRetries : maxDownloadAttempts - 1 ,
815
+ }); rt .Next (); {
816
+ err = r .doDownloadFiles (ctx , execCtx )
817
+ if err == nil {
818
+ return nil
819
+ }
820
+ log .Warningf (ctx , "failed attempt #%d to download files: %v" , rt .CurrentAttempt (), err )
821
+ }
822
+ return errors .Wrapf (err , "retries exhausted for downloading files" )
823
+ }
824
+
821
825
func (r * restoreResumer ) doDownloadFiles (ctx context.Context , execCtx sql.JobExecContext ) error {
822
826
details := r .job .Details ().(jobspb.RestoreDetails )
823
827
0 commit comments