diff options
| author | gryzlov-ad <[email protected]> | 2025-07-15 13:15:09 +0300 |
|---|---|---|
| committer | gryzlov-ad <[email protected]> | 2025-07-15 13:34:29 +0300 |
| commit | 8c60f3e5e0f1c852c96b3b97a6e74b64b0c82798 (patch) | |
| tree | e8b6d6de73c01b44f93be89201be535f56c82f36 | |
| parent | 075c594d949914f3f4cebd82ed5e4d2059fdf9a3 (diff) | |
Fix babenko-issues
commit_hash:a2f8b3bf111539203493bd87ad3c244e36a9f9ef
| -rw-r--r-- | yt/yt/client/api/chaos_lease_base.cpp | 14 | ||||
| -rw-r--r-- | yt/yt/client/api/rpc_proxy/chaos_lease.cpp | 10 | ||||
| -rw-r--r-- | yt/yt/client/api/rpc_proxy/client_impl.cpp | 13 |
3 files changed, 19 insertions, 18 deletions
diff --git a/yt/yt/client/api/chaos_lease_base.cpp b/yt/yt/client/api/chaos_lease_base.cpp index 8a9db89fc7d..375051d7b75 100644 --- a/yt/yt/client/api/chaos_lease_base.cpp +++ b/yt/yt/client/api/chaos_lease_base.cpp @@ -3,10 +3,14 @@ #include "connection.h" #include "client.h" +#include <yt/yt/client/object_client/helpers.h> + #include <yt/yt/core/rpc/public.h> namespace NYT::NApi { +using namespace NObjectClient; + //////////////////////////////////////////////////////////////////////////////// TChaosLeaseBase::TChaosLeaseBase( @@ -23,7 +27,7 @@ TChaosLeaseBase::TChaosLeaseBase( , Timeout_(timeout) , PingAncestors_(pingAncestors) , PingPeriod_(pingPeriod) - , Logger(logger.WithTag("ChaosLease: %v, %v", + , Logger(logger.WithTag("ChaosLeaseId: %v, %v", Id_, Client_->GetConnection()->GetLoggingTag())) { } @@ -83,7 +87,7 @@ TFuture<void> TChaosLeaseBase::Abort(const TPrerequisiteAbortOptions& options) AbortPromise_ = NewPromise<void>(); } - auto chaosLeasePath = Format("#%v", GetId()); + auto chaosLeasePath = FromObjectId(GetId()); auto removeOptions = TRemoveNodeOptions{ .Force = options.Force, }; @@ -110,12 +114,12 @@ TFuture<void> TChaosLeaseBase::Abort(const TPrerequisiteAbortOptions& options) auto abortPromise = std::exchange(AbortPromise_, TPromise<void>()); - if (abortError.IsOK() && !Aborted_.IsFired()) { + guard.Release(); + + if (abortError.IsOK()) { Aborted_.Fire(TError("Chaos lease aborted by user request")); } - guard.Release(); - abortPromise.Set(std::move(abortError)); } })); diff --git a/yt/yt/client/api/rpc_proxy/chaos_lease.cpp b/yt/yt/client/api/rpc_proxy/chaos_lease.cpp index 46906be8367..36c4a612977 100644 --- a/yt/yt/client/api/rpc_proxy/chaos_lease.cpp +++ b/yt/yt/client/api/rpc_proxy/chaos_lease.cpp @@ -33,6 +33,9 @@ public: , Proxy_(Channel_) { } +private: + TApiServiceProxy Proxy_; + TFuture<void> DoPing(const TPrerequisitePingOptions& /*options*/) override { auto req = Proxy_.PingChaosLease(); @@ -44,9 +47,6 @@ public: return req->Invoke().AsVoid(); } - -private: - TApiServiceProxy Proxy_; }; //////////////////////////////////////////////////////////////////////////////// @@ -59,15 +59,13 @@ IPrerequisitePtr CreateChaosLease( bool pingAncestors, std::optional<TDuration> pingPeriod) { - auto chaosLease = New<TChaosLease>( + return New<TChaosLease>( std::move(client), std::move(channel), chaosLeaseId, timeout, pingAncestors, pingPeriod); - - return chaosLease; } //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/api/rpc_proxy/client_impl.cpp b/yt/yt/client/api/rpc_proxy/client_impl.cpp index f700105216e..98c52fcc6dd 100644 --- a/yt/yt/client/api/rpc_proxy/client_impl.cpp +++ b/yt/yt/client/api/rpc_proxy/client_impl.cpp @@ -248,12 +248,11 @@ TFuture<IPrerequisitePtr> TClient::AttachChaosLease( auto client = GetRpcProxyClient(); auto channel = GetRetryingChannel(); - auto chaosLeasePath = Format("#%v/@", chaosLeaseId); + auto chaosLeasePath = Format("%v/@", FromObjectId(chaosLeaseId)); - return client->GetNode(chaosLeasePath, {}).Apply(BIND([=](const TYsonString& value) { + return client->GetNode(chaosLeasePath, {}).Apply(BIND([=] (const TYsonString& value) { auto attributes = ConvertToAttributes(value); - auto timeoutValue = attributes->Get<i64>("timeout"); - auto timeout = TDuration::MilliSeconds(timeoutValue); + auto timeout = attributes->Get<TDuration>("timeout"); auto chaosLease = CreateChaosLease( std::move(client), @@ -287,7 +286,7 @@ TFuture<IPrerequisitePtr> TClient::StartChaosLease(const TChaosLeaseStartOptions .OptionalItem("parent_id", options.ParentId) .EndMap()); - return client->CreateObject(EObjectType::ChaosLease, {}).Apply(BIND([=](const TChaosLeaseId& chaosLeaseId) { + return client->CreateObject(EObjectType::ChaosLease, {}).Apply(BIND([=] (const TChaosLeaseId& chaosLeaseId) { return CreateChaosLease( std::move(client), std::move(channel), @@ -1417,7 +1416,7 @@ TFuture<TGetJobStderrResponse> TClient::GetJobStderr( req->set_type(NProto::ConvertJobStderrTypeToProto(*options.Type)); } - return req->Invoke().Apply(BIND([req = req](const TApiServiceProxy::TRspGetJobStderrPtr& rsp) { + return req->Invoke().Apply(BIND([req = req] (const TApiServiceProxy::TRspGetJobStderrPtr& rsp) { YT_VERIFY(rsp->Attachments().size() == 1); TGetJobStderrOptions options{.Limit = req->limit(), .Offset = req->offset()}; return TGetJobStderrResponse::MakeJobStderr(rsp->Attachments().front(), options); @@ -2863,7 +2862,7 @@ TFuture<TFlowExecuteResult> TClient::FlowExecute( req->set_argument(ToProto(argument)); } - return req->Invoke().Apply(BIND([](const TApiServiceProxy::TRspFlowExecutePtr& rsp) { + return req->Invoke().Apply(BIND([] (const TApiServiceProxy::TRspFlowExecutePtr& rsp) { return TFlowExecuteResult{ .Result = rsp->has_result() ? TYsonString(rsp->result()) : TYsonString{}, }; |
