Skip to content

Commit

Permalink
Increase retry delays
Browse files Browse the repository at this point in the history
We can sometimes see a short period of issues from storj, our existing retries were very close together (a few seconds in total) so would only catch extremely short periods of problems.

Also removing the fatal logging since it prints huge goroutine traces into our logging
  • Loading branch information
mjh1 committed Feb 14, 2024
1 parent 567aec3 commit ce56e5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions catalyst-uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ func main() {
func run() int {
err := flag.Set("logtostderr", "true")
if err != nil {
glog.Fatal(err)
glog.Error(err)
return 1

Check warning on line 28 in catalyst-uploader.go

View check run for this annotation

Codecov / codecov/patch

catalyst-uploader.go#L27-L28

Added lines #L27 - L28 were not covered by tests
}
// cmd line args
describe := flag.Bool("j", false, "Describe supported storage services in JSON format and exit")
Expand All @@ -38,7 +39,7 @@ func run() int {
}

if flag.NArg() == 0 {
glog.Fatal("Destination URI is not specified. See -h for usage.")
glog.Error("Destination URI is not specified. See -h for usage.")

Check warning on line 42 in catalyst-uploader.go

View check run for this annotation

Codecov / codecov/patch

catalyst-uploader.go#L42

Added line #L42 was not covered by tests
return 1
}

Expand All @@ -48,19 +49,19 @@ func run() int {

output := flag.Arg(0)
if output == "" {
glog.Fatal("Object store URI was empty")
glog.Error("Object store URI was empty")

Check warning on line 52 in catalyst-uploader.go

View check run for this annotation

Codecov / codecov/patch

catalyst-uploader.go#L52

Added line #L52 was not covered by tests
return 1
}

uri, err := url.Parse(output)
if err != nil {
glog.Fatalf("Failed to parse URI: %s", err)
glog.Errorf("Failed to parse URI: %s", err)

Check warning on line 58 in catalyst-uploader.go

View check run for this annotation

Codecov / codecov/patch

catalyst-uploader.go#L58

Added line #L58 was not covered by tests
return 1
}

out, err := core.Upload(os.Stdin, uri, WaitBetweenWrites, *timeout)
if err != nil {
glog.Fatalf("Uploader failed for %s: %s", uri.Redacted(), err)
glog.Errorf("Uploader failed for %s: %s", uri.Redacted(), err)

Check warning on line 64 in catalyst-uploader.go

View check run for this annotation

Codecov / codecov/patch

catalyst-uploader.go#L64

Added line #L64 was not covered by tests
return 1
}

Expand All @@ -73,7 +74,7 @@ func run() int {
if glog.V(5) {
err = json.NewEncoder(stdout).Encode(map[string]string{"uri": uri.Redacted()})
if err != nil {
glog.Fatal(err)
glog.Error(err)

Check warning on line 77 in catalyst-uploader.go

View check run for this annotation

Codecov / codecov/patch

catalyst-uploader.go#L77

Added line #L77 was not covered by tests
return 1
}
}
Expand Down
6 changes: 3 additions & 3 deletions core/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ func (bc *ByteCounter) Write(p []byte) (n int, err error) {

func newExponentialBackOffExecutor() *backoff.ExponentialBackOff {
backOff := backoff.NewExponentialBackOff()
backOff.InitialInterval = 200 * time.Millisecond
backOff.MaxInterval = 5 * time.Second
backOff.InitialInterval = 10 * time.Second
backOff.MaxInterval = 1 * time.Minute

Check warning on line 33 in core/uploader.go

View check run for this annotation

Codecov / codecov/patch

core/uploader.go#L32-L33

Added lines #L32 - L33 were not covered by tests
backOff.MaxElapsedTime = 0 // don't impose a timeout as part of the retries

return backOff
}

func UploadRetryBackoff() backoff.BackOff {
return backoff.WithMaxRetries(newExponentialBackOffExecutor(), 3)
return backoff.WithMaxRetries(newExponentialBackOffExecutor(), 7)

Check warning on line 40 in core/uploader.go

View check run for this annotation

Codecov / codecov/patch

core/uploader.go#L40

Added line #L40 was not covered by tests
}

const segmentWriteTimeout = 5 * time.Minute
Expand Down

0 comments on commit ce56e5c

Please sign in to comment.