Commit cc38aef 1 parent 19ab0c2 commit cc38aef Copy full SHA for cc38aef
File tree 2 files changed +11
-5
lines changed
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 42
42
#include " common/config.h"
43
43
#include " common/logging.h"
44
44
#include " common/status.h"
45
+ #include " cpp/obj_retry_strategy.h"
45
46
#include " cpp/sync_point.h"
46
47
#ifdef USE_AZURE
47
48
#include " io/fs/azure_obj_storage_client.h"
@@ -307,8 +308,8 @@ std::shared_ptr<io::ObjStorageClient> S3ClientFactory::_create_s3_client(
307
308
aws_config.scheme = Aws::Http::Scheme::HTTP;
308
309
}
309
310
310
- aws_config.retryStrategy =
311
- std::make_shared<Aws::Client::DefaultRetryStrategy>( config::max_s3_client_retry);
311
+ aws_config.retryStrategy = std::make_shared<S3CustomRetryStrategy>(
312
+ config::max_s3_client_retry /* scaleFactor = 25 */ );
312
313
std::shared_ptr<Aws::S3::S3Client> new_client;
313
314
if (!s3_conf.ak .empty () && !s3_conf.sk .empty ()) {
314
315
Aws::Auth::AWSCredentials aws_cred (s3_conf.ak , s3_conf.sk );
Original file line number Diff line number Diff line change 17
17
18
18
#include " obj_retry_strategy.h"
19
19
20
+ #include < aws/core/http/HttpResponse.h>
20
21
#include < bvar/reducer.h>
21
22
22
23
namespace doris {
@@ -29,12 +30,16 @@ S3CustomRetryStrategy::~S3CustomRetryStrategy() = default;
29
30
30
31
bool S3CustomRetryStrategy::ShouldRetry (const Aws::Client::AWSError<Aws::Client::CoreErrors>& error,
31
32
long attemptedRetries) const {
32
- if (attemptedRetries < m_maxRetries &&
33
- error.GetResponseCode () == Aws::Http::HttpResponseCode::TOO_MANY_REQUESTS) {
33
+ if (attemptedRetries >= m_maxRetries) {
34
+ return false ;
35
+ }
36
+
37
+ if (Aws::Http::IsRetryableHttpResponseCode (error.GetResponseCode ()) || error.ShouldRetry ()) {
34
38
s3_too_many_request_retry_cnt << 1 ;
35
39
return true ;
36
40
}
37
- return Aws::Client::DefaultRetryStrategy::ShouldRetry (error, attemptedRetries);
41
+
42
+ return false ;
38
43
}
39
44
#ifdef USE_AZURE
40
45
AzureRetryRecordPolicy::AzureRetryRecordPolicy (int retry_cnt) : retry_cnt(retry_cnt) {}
You can’t perform that action at this time.
0 commit comments