aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2023-11-20 12:40:44 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2023-11-20 13:03:09 +0300
commit453036a7f0bc2a6d930f1432185df6bada7840f9 (patch)
treeb6010554520a6700e47cd658321f100bc8efdda2
parent4227de2e7097a5dfff01c245ea3ae508356286ed (diff)
downloadydb-453036a7f0bc2a6d930f1432185df6bada7840f9.tar.gz
Intermediate changes
-rw-r--r--yt/yt/core/rpc/grpc/helpers.cpp11
-rw-r--r--yt/yt/core/rpc/unittests/rpc_ut.cpp10
2 files changed, 20 insertions, 1 deletions
diff --git a/yt/yt/core/rpc/grpc/helpers.cpp b/yt/yt/core/rpc/grpc/helpers.cpp
index 20b163e30ac..4279c5840de 100644
--- a/yt/yt/core/rpc/grpc/helpers.cpp
+++ b/yt/yt/core/rpc/grpc/helpers.cpp
@@ -418,8 +418,17 @@ TErrorCode StatusCodeToErrorCode(grpc_status_code statusCode)
case GRPC_STATUS_INVALID_ARGUMENT:
case GRPC_STATUS_RESOURCE_EXHAUSTED:
return NRpc::EErrorCode::ProtocolError;
- default:
+ case GRPC_STATUS_UNAUTHENTICATED:
+ return NRpc::EErrorCode::AuthenticationError;
+ case GRPC_STATUS_PERMISSION_DENIED:
+ return NRpc::EErrorCode::InvalidCredentials;
+ case GRPC_STATUS_UNIMPLEMENTED:
+ return NRpc::EErrorCode::NoSuchMethod;
+ case GRPC_STATUS_UNAVAILABLE:
return NRpc::EErrorCode::TransportError;
+ default:
+ // Do not retry request after unclassified error.
+ return NYT::EErrorCode::Generic;
}
}
diff --git a/yt/yt/core/rpc/unittests/rpc_ut.cpp b/yt/yt/core/rpc/unittests/rpc_ut.cpp
index 61bc65f72d3..ffc59a05a1e 100644
--- a/yt/yt/core/rpc/unittests/rpc_ut.cpp
+++ b/yt/yt/core/rpc/unittests/rpc_ut.cpp
@@ -797,6 +797,16 @@ TYPED_TEST(TRpcTest, CustomErrorMessage)
EXPECT_EQ("Some Error", rspOrError.GetMessage());
}
+TYPED_TEST(TRpcTest, ServerStopped)
+{
+ this->Server_->Stop().Get().ThrowOnError();
+ TTestProxy proxy(this->CreateChannel());
+ auto req = proxy.SomeCall();
+ req->set_a(42);
+ auto rspOrError = req->Invoke().Get();
+ EXPECT_EQ(NRpc::EErrorCode::TransportError, rspOrError.GetCode());
+}
+
TYPED_TEST(TRpcTest, ConnectionLost)
{
TTestProxy proxy(this->CreateChannel());