Skip to content

Commit d034c71

Browse files
authored
Merge bdad7d5 into ba3d69d
2 parents ba3d69d + bdad7d5 commit d034c71

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

ydb/core/fq/libs/init/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ void Init(
195195

196196
if (protoConfig.GetPrivateApi().GetEnabled()) {
197197
const auto& s3readConfig = protoConfig.GetReadActorsFactoryConfig().GetS3ReadActorFactoryConfig();
198-
auto s3HttpRetryPolicy = NYql::GetHTTPDefaultRetryPolicy(TDuration::Max());
198+
auto s3HttpRetryPolicy = NYql::GetHTTPDefaultRetryPolicy(NYql::THttpRetryPolicyOptions{.MaxTime = TDuration::Max(), .ExtendedRetriedCodes = {CURLE_GOT_NOTHING}});
199199
NYql::NDq::TS3ReadActorFactoryConfig readActorFactoryCfg;
200200
if (const ui64 rowsInBatch = s3readConfig.GetRowsInBatch()) {
201201
readActorFactoryCfg.RowsInBatch = rowsInBatch;

ydb/library/yql/providers/common/http_gateway/yql_http_default_retry_policy.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace NYql {
44

5-
IHTTPGateway::TRetryPolicy::TPtr GetHTTPDefaultRetryPolicy(TDuration maxTime, size_t maxRetries) {
6-
if (!maxTime) {
7-
maxTime = TDuration::Minutes(5);
5+
IHTTPGateway::TRetryPolicy::TPtr GetHTTPDefaultRetryPolicy(THttpRetryPolicyOptions&& options) {
6+
if (!options.MaxTime) {
7+
options.MaxTime = TDuration::Minutes(5);
88
}
9-
return IHTTPGateway::TRetryPolicy::GetExponentialBackoffPolicy([](CURLcode curlCode, long httpCode) {
9+
return IHTTPGateway::TRetryPolicy::GetExponentialBackoffPolicy([options](CURLcode curlCode, long httpCode) {
1010

1111
switch (curlCode) {
1212
case CURLE_OK:
@@ -25,8 +25,13 @@ IHTTPGateway::TRetryPolicy::TPtr GetHTTPDefaultRetryPolicy(TDuration maxTime, si
2525
// retry small number of known errors
2626
return ERetryErrorClass::ShortRetry;
2727
default:
28-
// do not retry others
29-
return ERetryErrorClass::NoRetry;
28+
if (options.ExtendedRetriedCodes.contains(curlCode)) {
29+
// retry explicitly enumerated codes
30+
return ERetryErrorClass::ShortRetry;
31+
} else {
32+
// do not retry others
33+
return ERetryErrorClass::NoRetry;
34+
}
3035
}
3136

3237
switch (httpCode) {
@@ -48,8 +53,12 @@ IHTTPGateway::TRetryPolicy::TPtr GetHTTPDefaultRetryPolicy(TDuration maxTime, si
4853
TDuration::MilliSeconds(10), // minDelay
4954
TDuration::MilliSeconds(200), // minLongRetryDelay
5055
TDuration::Seconds(30), // maxDelay
51-
maxRetries, // maxRetries
52-
maxTime); // maxTime
56+
options.MaxRetries, // maxRetries
57+
options.MaxTime); // maxTime
58+
}
59+
60+
IHTTPGateway::TRetryPolicy::TPtr GetHTTPDefaultRetryPolicy(TDuration maxTime, size_t maxRetries) {
61+
return GetHTTPDefaultRetryPolicy(THttpRetryPolicyOptions{.MaxTime = maxTime, .MaxRetries = maxRetries});
5362
}
5463

5564
}

ydb/library/yql/providers/common/http_gateway/yql_http_default_retry_policy.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
namespace NYql {
66

7+
struct THttpRetryPolicyOptions {
8+
TDuration MaxTime = TDuration::Zero(); // Zero means default maxTime
9+
size_t MaxRetries = std::numeric_limits<size_t>::max();
10+
std::unordered_set<CURLcode> ExtendedRetriedCodes;
11+
};
12+
13+
IHTTPGateway::TRetryPolicy::TPtr GetHTTPDefaultRetryPolicy(THttpRetryPolicyOptions&& options);
14+
715
IHTTPGateway::TRetryPolicy::TPtr GetHTTPDefaultRetryPolicy(TDuration maxTime = TDuration::Zero(), size_t maxRetries = std::numeric_limits<size_t>::max()); // Zero means default maxTime
816

917
}

0 commit comments

Comments
 (0)