summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/http/http.cpp
diff options
context:
space:
mode:
authorhiddenpath <[email protected]>2025-02-17 10:07:07 +0300
committerhiddenpath <[email protected]>2025-02-17 10:32:13 +0300
commit9295facf69eb8c6ee7bbb5bdfd55aac74c850432 (patch)
tree5d06860b576b3fe45467ba669a7dd0f7e68f5128 /yt/cpp/mapreduce/http/http.cpp
parent8c9859fab05712911b835114e4a6c8ad57a36834 (diff)
YT-23616: Do not rely on specific http codes upon request retry
commit_hash:6567d772f1cc5091a75ad5249c2a97a73dc5e6cd
Diffstat (limited to 'yt/cpp/mapreduce/http/http.cpp')
-rw-r--r--yt/cpp/mapreduce/http/http.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/yt/cpp/mapreduce/http/http.cpp b/yt/cpp/mapreduce/http/http.cpp
index 765a96f0420..4bddeab86d1 100644
--- a/yt/cpp/mapreduce/http/http.cpp
+++ b/yt/cpp/mapreduce/http/http.cpp
@@ -768,21 +768,21 @@ THttpResponse::THttpResponse(
ErrorResponse_ = TErrorResponse(HttpCode_, Context_.RequestId);
- auto logAndSetError = [&] (const TString& rawError) {
+ auto logAndSetError = [&] (int code, const TString& rawError) {
YT_LOG_ERROR("RSP %v - HTTP %v - %v",
Context_.RequestId,
HttpCode_,
rawError.data());
- ErrorResponse_->SetRawError(rawError);
+ ErrorResponse_->SetError(TYtError(code, rawError));
};
switch (HttpCode_) {
case 429:
- logAndSetError("request rate limit exceeded");
+ logAndSetError(NClusterErrorCodes::NSecurityClient::RequestQueueSizeLimitExceeded, "request rate limit exceeded");
break;
case 500:
- logAndSetError(::TStringBuilder() << "internal error in proxy " << Context_.HostName);
+ logAndSetError(NClusterErrorCodes::NRpc::Unavailable, ::TStringBuilder() << "internal error in proxy " << Context_.HostName);
break;
default: {
@@ -803,6 +803,9 @@ THttpResponse::THttpResponse(
if (auto parsedResponse = ParseError(HttpInput_->Headers())) {
ErrorResponse_ = parsedResponse.GetRef();
+ if (HttpCode_ == 503) {
+ ExtendGenericError(*ErrorResponse_, NClusterErrorCodes::NBus::TransportError, "transport error");
+ }
} else {
ErrorResponse_->SetRawError(
errorString + " - X-YT-Error is missing in headers");