Skip to content

Commit a236708

Browse files
authored
Merge e0302d4 into bae9923
2 parents bae9923 + e0302d4 commit a236708

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

ydb/library/yql/providers/s3/actors/yql_s3_applicator_actor.cpp

+20-11
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ class TS3ApplicatorActor;
204204
using TObjectStorageRequest = std::function<void(TS3ApplicatorActor& actor)>;
205205

206206
class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor> {
207+
static constexpr ui64 GLOBAL_RETRY_LIMIT = 100;
208+
207209
public:
208210
using NActors::TActorBootstrapped<TS3ApplicatorActor>::Send;
209211

@@ -230,7 +232,7 @@ class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor
230232
, ExternalEffect(externalEffect)
231233
, ActorSystem(NActors::TActivationContext::ActorSystem())
232234
, RetryPolicy(NYql::GetHTTPDefaultRetryPolicy(TDuration::Zero(), 3))
233-
, RetryCount(100) {
235+
, RetryCount(GLOBAL_RETRY_LIMIT) {
234236
// ^^^ 3 retries in HTTP GW per operation
235237
// up to 100 retries at app level for all operations ^^^
236238
}
@@ -271,12 +273,15 @@ class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor
271273
hFunc(TEvPrivate::TEvListParts, Handle);
272274
)
273275

274-
bool RetryOperation(CURLcode curlResponseCode, ui32 httpResponseCode) {
276+
bool RetryOperation(CURLcode curlResponseCode, ui32 httpResponseCode, const TString& url, const TString& operationName) {
275277
auto result = RetryCount && RetryPolicy->CreateRetryState()->GetNextRetryDelay(curlResponseCode, httpResponseCode);
278+
Issues.AddIssue(TStringBuilder() << "Retry operation " << operationName << ", curl error: " << curl_easy_strerror(curlResponseCode) << ", http code: " << httpResponseCode << ", url: " << url);
276279
if (result) {
277280
RetryCount--;
278281
} else {
279-
Finish(true);
282+
Finish(true, RetryCount
283+
? TString("Number of retries exceeded limit per operation")
284+
: TStringBuilder() << "Number of retries exceeded global limit in " << GLOBAL_RETRY_LIMIT << " retries");
280285
}
281286
return result;
282287
}
@@ -369,9 +374,10 @@ class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor
369374
}
370375
return;
371376
}
372-
}
373-
LOG_D("CommitMultipartUpload ERROR " << ev->Get()->State->BuildUrl());
374-
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode)) {
377+
}
378+
const TString& url = ev->Get()->State->BuildUrl();
379+
LOG_D("CommitMultipartUpload ERROR " << url);
380+
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode, url, "CommitMultipartUpload")) {
375381
PushCommitMultipartUpload(ev->Get()->State);
376382
}
377383
}
@@ -444,8 +450,9 @@ class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor
444450
}
445451
return;
446452
}
447-
LOG_D("ListMultipartUploads ERROR " << ev->Get()->State->BuildUrl());
448-
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode)) {
453+
const TString& url = ev->Get()->State->BuildUrl();
454+
LOG_D("ListMultipartUploads ERROR " << url);
455+
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode, url, "ListMultipartUploads")) {
449456
PushListMultipartUploads(ev->Get()->State);
450457
}
451458
}
@@ -467,8 +474,9 @@ class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor
467474
return;
468475
}
469476
}
470-
LOG_D("AbortMultipartUpload ERROR " << ev->Get()->State->BuildUrl());
471-
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode)) {
477+
const TString& url = ev->Get()->State->BuildUrl();
478+
LOG_D("AbortMultipartUpload ERROR " << url);
479+
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode, url, "AbortMultipartUpload")) {
472480
PushAbortMultipartUpload(ev->Get()->State);
473481
}
474482
}
@@ -507,8 +515,9 @@ class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor
507515
}
508516
return;
509517
}
518+
const TString& url = ev->Get()->State->BuildUrl();
510519
LOG_D("ListParts ERROR " << ev->Get()->State->BuildUrl());
511-
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode)) {
520+
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode, url, "ListParts")) {
512521
PushListParts(ev->Get()->State);
513522
}
514523
}

0 commit comments

Comments
 (0)