aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornadya73 <nadya73@yandex-team.com>2024-12-03 10:53:54 +0300
committernadya73 <nadya73@yandex-team.com>2024-12-03 11:42:27 +0300
commit9139eccde1e2b98b45e949b4da2e73af59eec1e6 (patch)
tree18c7101809cba1964fd10c6fd7ba25fe373d1f75
parentee6fb9c6075c7ace663657969cd59005b5d0b656 (diff)
downloadydb-9139eccde1e2b98b45e949b4da2e73af59eec1e6.tar.gz
YT-23651: Make retriable memory pressure RPC client error
* Changelog entry Type: fix Component: proxy If there is no enough memory to handle RPC responses, retryable error (`Unavailable`) will be returned (instead of non-retryable error `*MemoryPressure`). commit_hash:b97aed2add67f1c9261b2485fe89dd698a18d84b
-rw-r--r--yt/python/yt/common.py4
-rw-r--r--yt/yt/core/rpc/bus/channel.cpp2
-rw-r--r--yt/yt/core/rpc/public.h3
-rw-r--r--yt/yt/core/rpc/service_detail.cpp2
-rw-r--r--yt/yt/core/rpc/unittests/rpc_ut.cpp4
5 files changed, 10 insertions, 5 deletions
diff --git a/yt/python/yt/common.py b/yt/python/yt/common.py
index 5d251f17d0..08c41bc810 100644
--- a/yt/python/yt/common.py
+++ b/yt/python/yt/common.py
@@ -260,6 +260,10 @@ class YtError(Exception):
"""Rpc unavailable."""
return self.contains_code(105)
+ def is_rpc_response_memory_pressure(self):
+ """Rpc response memory pressure."""
+ return self.contains_code(122)
+
def is_master_communication_error(self):
"""Master communication error."""
return self.contains_code(712)
diff --git a/yt/yt/core/rpc/bus/channel.cpp b/yt/yt/core/rpc/bus/channel.cpp
index 50ac07d5cb..28def5ea26 100644
--- a/yt/yt/core/rpc/bus/channel.cpp
+++ b/yt/yt/core/rpc/bus/channel.cpp
@@ -951,7 +951,7 @@ private:
message = TrackMemory(MemoryUsageTracker_, std::move(message));
if (MemoryUsageTracker_->IsExceeded()) {
auto error = TError(
- NRpc::EErrorCode::MemoryPressure,
+ NRpc::EErrorCode::ResponseMemoryPressure,
"Response is dropped due to high memory pressure");
requestControl->ProfileError(error);
NotifyError(
diff --git a/yt/yt/core/rpc/public.h b/yt/yt/core/rpc/public.h
index ed16f1c247..42933a8774 100644
--- a/yt/yt/core/rpc/public.h
+++ b/yt/yt/core/rpc/public.h
@@ -186,8 +186,9 @@ YT_DEFINE_ERROR_ENUM(
((Overloaded) (118)) // The server is currently overloaded and unable to handle additional requests.
// The client should try to reduce their request rate until the server has had a chance to recover.
((SslError) (static_cast<int>(NBus::EErrorCode::SslError)))
- ((MemoryPressure) (120))
+ ((RequestMemoryPressure) (120)) // There is no enough memory to handle RPC request.
((GlobalDiscoveryError) (121)) // Single peer discovery interrupts discovery session.
+ ((ResponseMemoryPressure) (122)) // There is no enouth memory to handle RPC response.
);
DEFINE_ENUM(EMessageFormat,
diff --git a/yt/yt/core/rpc/service_detail.cpp b/yt/yt/core/rpc/service_detail.cpp
index 11d3927fae..0fa6cdab4b 100644
--- a/yt/yt/core/rpc/service_detail.cpp
+++ b/yt/yt/core/rpc/service_detail.cpp
@@ -1780,7 +1780,7 @@ void TServiceBase::DoHandleRequest(TIncomingRequest&& incomingRequest)
if (MemoryUsageTracker_ && MemoryUsageTracker_->IsExceeded()) {
ReplyError(
- TError(NRpc::EErrorCode::MemoryPressure, "Request is dropped due to high memory pressure"),
+ TError(NRpc::EErrorCode::RequestMemoryPressure, "Request is dropped due to high memory pressure"),
std::move(incomingRequest));
return;
}
diff --git a/yt/yt/core/rpc/unittests/rpc_ut.cpp b/yt/yt/core/rpc/unittests/rpc_ut.cpp
index c887795911..7b64dd6da9 100644
--- a/yt/yt/core/rpc/unittests/rpc_ut.cpp
+++ b/yt/yt/core/rpc/unittests/rpc_ut.cpp
@@ -795,7 +795,7 @@ TYPED_TEST(TNotGrpcTest, RequestQueueSizeLimit)
Cerr << Format("End of the RequestQueueSizeLimit test (Id: %v)", testId) << '\n';
}
-TYPED_TEST(TNotGrpcTest, RequesMemoryPressureException)
+TYPED_TEST(TNotGrpcTest, RequestMemoryPressureException)
{
auto memoryUsageTracker = this->GetMemoryUsageTracker();
memoryUsageTracker->ClearTotalUsage();
@@ -810,7 +810,7 @@ TYPED_TEST(TNotGrpcTest, RequesMemoryPressureException)
auto result = WaitFor(req->Invoke().AsVoid());
// Limit of memory is 32 MB.
- EXPECT_EQ(NRpc::EErrorCode::MemoryPressure, req->Invoke().Get().GetCode());
+ EXPECT_EQ(NRpc::EErrorCode::RequestMemoryPressure, req->Invoke().Get().GetCode());
}
TYPED_TEST(TNotGrpcTest, MemoryTracking)