@@ -123,37 +123,6 @@ type s3Storage struct {
123
123
cached * s3Client
124
124
}
125
125
126
- // customRetryer implements the `request.Retryer` interface and allows for
127
- // customization of the retry behaviour of an AWS client.
128
- type customRetryer struct {}
129
-
130
- // isErrReadConnectionReset returns true if the underlying error is a read
131
- // connection reset error.
132
- //
133
- // NB: A read connection reset error is thrown when the SDK is unable to read
134
- // the response of an underlying API request due to a connection reset. The
135
- // DefaultRetryer in the AWS SDK does not treat this error as a retryable error
136
- // since the SDK does not have knowledge about the idempotence of the request,
137
- // and whether it is safe to retry -
138
- // https://github.com/aws/aws-sdk-go/pull/2926#issuecomment-553637658.
139
- //
140
- // In CRDB all operations with s3 (read, write, list) are considered idempotent,
141
- // and so we can treat the read connection reset error as retryable too.
142
- func isErrReadConnectionReset (err error ) bool {
143
- // The error string must match the one in
144
- // github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go. This is
145
- // unfortunate but the only solution until the SDK exposes a specialized error
146
- // code or type for this class of errors.
147
- return err != nil && strings .Contains (err .Error (), "read: connection reset" )
148
- }
149
-
150
- // IsErrorRetryable implements the retry.IsErrorRetryable interface.
151
- func (sr * customRetryer ) IsErrorRetryable (e error ) aws.Ternary {
152
- return aws .BoolTernary (isErrReadConnectionReset (e ))
153
- }
154
-
155
- var _ retry.IsErrorRetryable = & customRetryer {}
156
-
157
126
// s3Client wraps an SDK client and uploader for a given session.
158
127
type s3Client struct {
159
128
client * s3.Client
@@ -647,23 +616,18 @@ func (s *s3Storage) newClient(ctx context.Context) (s3Client, string, error) {
647
616
return s3Client {}, "" , err
648
617
}
649
618
addLoadOption (config .WithHTTPClient (client ))
650
-
651
- retryMaxAttempts := int (maxRetries .Get (& s .settings .SV ))
652
- addLoadOption (config .WithRetryMaxAttempts (retryMaxAttempts ))
653
-
654
619
addLoadOption (config .WithLogger (newLogAdapter (ctx )))
655
620
if s .opts .logMode != 0 {
656
621
addLoadOption (config .WithClientLogMode (s .opts .logMode ))
657
622
}
658
- config .WithRetryer (func () aws.Retryer {
623
+ addLoadOption ( config .WithRetryer (func () aws.Retryer {
659
624
return retry .NewStandard (func (opts * retry.StandardOptions ) {
660
- opts .MaxAttempts = retryMaxAttempts
661
- opts .Retryables = append (opts .Retryables , & customRetryer {})
625
+ opts .MaxAttempts = int (maxRetries .Get (& s .settings .SV ))
662
626
if ! enableClientRetryTokenBucket .Get (& s .settings .SV ) {
663
627
opts .RateLimiter = ratelimit .None
664
628
}
665
629
})
666
- })
630
+ }))
667
631
668
632
switch s .opts .auth {
669
633
case "" , cloud .AuthParamSpecified :
0 commit comments