Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YQ-2898 fix query failed with unknown uncommitted upload issue #2240

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions ydb/library/yql/providers/s3/actors/yql_s3_applicator_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ class TS3ApplicatorActor;
using TObjectStorageRequest = std::function<void(TS3ApplicatorActor& actor)>;

class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor> {
static constexpr ui64 GLOBAL_RETRY_LIMIT = 100;

public:
using NActors::TActorBootstrapped<TS3ApplicatorActor>::Send;

Expand All @@ -230,7 +232,7 @@ class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor
, ExternalEffect(externalEffect)
, ActorSystem(NActors::TActivationContext::ActorSystem())
, RetryPolicy(NYql::GetHTTPDefaultRetryPolicy(TDuration::Zero(), 3))
, RetryCount(100) {
, RetryCount(GLOBAL_RETRY_LIMIT) {
// ^^^ 3 retries in HTTP GW per operation
// up to 100 retries at app level for all operations ^^^
}
Expand Down Expand Up @@ -271,12 +273,15 @@ class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor
hFunc(TEvPrivate::TEvListParts, Handle);
)

bool RetryOperation(CURLcode curlResponseCode, ui32 httpResponseCode) {
bool RetryOperation(CURLcode curlResponseCode, ui32 httpResponseCode, const TString& url, const TString& operationName) {
auto result = RetryCount && RetryPolicy->CreateRetryState()->GetNextRetryDelay(curlResponseCode, httpResponseCode);
Issues.AddIssue(TStringBuilder() << "Retry operation " << operationName << ", curl error: " << curl_easy_strerror(curlResponseCode) << ", http code: " << httpResponseCode << ", url: " << url);
if (result) {
RetryCount--;
} else {
Finish(true);
Finish(true, RetryCount
? TString("Number of retries exceeded limit per operation")
: TStringBuilder() << "Number of retries exceeded global limit in " << GLOBAL_RETRY_LIMIT << " retries");
}
return result;
}
Expand Down Expand Up @@ -370,8 +375,9 @@ class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor
return;
}
}
LOG_D("CommitMultipartUpload ERROR " << ev->Get()->State->BuildUrl());
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode)) {
const TString& url = ev->Get()->State->BuildUrl();
LOG_D("CommitMultipartUpload ERROR " << url);
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode, url, "CommitMultipartUpload")) {
PushCommitMultipartUpload(ev->Get()->State);
}
}
Expand Down Expand Up @@ -444,8 +450,9 @@ class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor
}
return;
}
LOG_D("ListMultipartUploads ERROR " << ev->Get()->State->BuildUrl());
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode)) {
const TString& url = ev->Get()->State->BuildUrl();
LOG_D("ListMultipartUploads ERROR " << url);
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode, url, "ListMultipartUploads")) {
PushListMultipartUploads(ev->Get()->State);
}
}
Expand All @@ -467,8 +474,9 @@ class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor
return;
}
}
LOG_D("AbortMultipartUpload ERROR " << ev->Get()->State->BuildUrl());
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode)) {
const TString& url = ev->Get()->State->BuildUrl();
LOG_D("AbortMultipartUpload ERROR " << url);
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode, url, "AbortMultipartUpload")) {
PushAbortMultipartUpload(ev->Get()->State);
}
}
Expand Down Expand Up @@ -507,8 +515,9 @@ class TS3ApplicatorActor : public NActors::TActorBootstrapped<TS3ApplicatorActor
}
return;
}
LOG_D("ListParts ERROR " << ev->Get()->State->BuildUrl());
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode)) {
const TString& url = ev->Get()->State->BuildUrl();
LOG_D("ListParts ERROR " << url);
if (RetryOperation(result.CurlResponseCode, result.Content.HttpResponseCode, url, "ListParts")) {
PushListParts(ev->Get()->State);
}
}
Expand Down
Loading