Skip to content

Commit

Permalink
YT-23011: Fix regression introduced in rXXXXXX; re-enable RPC-over-HT…
Browse files Browse the repository at this point in the history
…TP tests

commit_hash:062b0d3f8ee24766c3894dc9502dc538515616eb
  • Loading branch information
maxim-babenko committed Oct 15, 2024
1 parent a9f26da commit b533244
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
10 changes: 6 additions & 4 deletions yt/yt/core/crypto/tls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,12 @@ class TTlsConnection

bool IsIdle() const override
{
return
Underlying_->IsIdle() &&
ActiveIOCount_ == 0 &&
!Failed_;
return ActiveIOCount_ == 0 && !Failed_;
}

bool IsReusable() const override
{
return IsIdle() && Underlying_->IsReusable();
}

TFuture<void> Abort() override
Expand Down
2 changes: 1 addition & 1 deletion yt/yt/core/http/connection_reuse_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TReusableConnectionState::TReusableConnectionState(

TReusableConnectionState::~TReusableConnectionState()
{
if (Reusable && OwningPool && Connection->IsIdle()) {
if (Reusable && OwningPool && Connection->IsReusable()) {
OwningPool->Release(std::move(Connection));
}
}
Expand Down
5 changes: 5 additions & 0 deletions yt/yt/core/http/unittests/http_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ struct TFakeConnection
return true;
}

bool IsReusable() const override
{
return true;
}

TFuture<void> Abort() override
{
THROW_ERROR_EXCEPTION("Not implemented");
Expand Down
10 changes: 10 additions & 0 deletions yt/yt/core/net/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,11 @@ class TFDConnectionImpl
!PeerDisconnectedList_.IsFired();
}

bool IsReusable()
{
return IsIdle();
}

TFuture<void> Abort(const TError& error)
{
YT_LOG_DEBUG(error, "Aborting connection");
Expand Down Expand Up @@ -1213,6 +1218,11 @@ class TFDConnection
return Impl_->IsIdle();
}

bool IsReusable() const override
{
return Impl_->IsReusable();
}

TFuture<void> Abort() override
{
return Impl_->Abort(TError(EErrorCode::Aborted, "Connection aborted"));
Expand Down
9 changes: 6 additions & 3 deletions yt/yt/core/net/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,19 @@ struct IConnection
virtual const TNetworkAddress& GetLocalAddress() const = 0;
virtual const TNetworkAddress& GetRemoteAddress() const = 0;

// Returns true if connection is not is failed state and has no
// active IO operations.
//! Returns true if connection is not is failed state and has no
//! active IO operations.
virtual bool IsIdle() const = 0;

//! Returns true if connection can be reused by a pool.
virtual bool IsReusable() const = 0;

virtual bool SetNoDelay() = 0;
virtual bool SetKeepAlive() = 0;

TFuture<void> Abort() override = 0;

// SubscribePeerDisconnect is best effort and is not guaranteed to fire.
//! This callback is best effort and is not guaranteed to fire.
virtual void SubscribePeerDisconnect(TCallback<void()> callback) = 0;
};

Expand Down
7 changes: 3 additions & 4 deletions yt/yt/core/rpc/unittests/lib/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,9 @@ using TAllTransports = ::testing::Types<
TRpcOverGrpcImpl<false, false>,
TRpcOverGrpcImpl<false, true>,
TRpcOverGrpcImpl<true, false>,
TRpcOverGrpcImpl<true, true>
// XXX(babenko): temporarily off
// TRpcOverHttpImpl<false>,
// TRpcOverHttpImpl<true>
TRpcOverGrpcImpl<true, true>,
TRpcOverHttpImpl<false>,
TRpcOverHttpImpl<true>
>;

using TWithAttachments = ::testing::Types<
Expand Down

0 comments on commit b533244

Please sign in to comment.