diff --git a/be/src/util/s3_util.cpp b/be/src/util/s3_util.cpp index 18058469ee4566..f87389b6b3e119 100644 --- a/be/src/util/s3_util.cpp +++ b/be/src/util/s3_util.cpp @@ -42,6 +42,7 @@ #include "common/config.h" #include "common/logging.h" #include "common/status.h" +#include "cpp/obj_retry_strategy.h" #include "cpp/sync_point.h" #ifdef USE_AZURE #include "io/fs/azure_obj_storage_client.h" @@ -307,8 +308,8 @@ std::shared_ptr S3ClientFactory::_create_s3_client( aws_config.scheme = Aws::Http::Scheme::HTTP; } - aws_config.retryStrategy = - std::make_shared(config::max_s3_client_retry); + aws_config.retryStrategy = std::make_shared( + config::max_s3_client_retry /*scaleFactor = 25*/); std::shared_ptr new_client; if (!s3_conf.ak.empty() && !s3_conf.sk.empty()) { Aws::Auth::AWSCredentials aws_cred(s3_conf.ak, s3_conf.sk); diff --git a/common/cpp/obj_retry_strategy.cpp b/common/cpp/obj_retry_strategy.cpp index 4daa31dc588493..0226d1af28f038 100644 --- a/common/cpp/obj_retry_strategy.cpp +++ b/common/cpp/obj_retry_strategy.cpp @@ -17,6 +17,7 @@ #include "obj_retry_strategy.h" +#include #include namespace doris { @@ -29,12 +30,16 @@ S3CustomRetryStrategy::~S3CustomRetryStrategy() = default; bool S3CustomRetryStrategy::ShouldRetry(const Aws::Client::AWSError& error, long attemptedRetries) const { - if (attemptedRetries < m_maxRetries && - error.GetResponseCode() == Aws::Http::HttpResponseCode::TOO_MANY_REQUESTS) { + if (attemptedRetries >= m_maxRetries) { + return false; + } + + if (Aws::Http::IsRetryableHttpResponseCode(error.GetResponseCode()) || error.ShouldRetry()) { s3_too_many_request_retry_cnt << 1; return true; } - return Aws::Client::DefaultRetryStrategy::ShouldRetry(error, attemptedRetries); + + return false; } #ifdef USE_AZURE AzureRetryRecordPolicy::AzureRetryRecordPolicy(int retry_cnt) : retry_cnt(retry_cnt) {}