Skip to content

Commit 4e55354

Browse files
author
babenko
committed
YT-23011: Fix regression introduced in rXXXXXX; re-enable RPC-over-HTTP tests
commit_hash:062b0d3f8ee24766c3894dc9502dc538515616eb
1 parent e79e931 commit 4e55354

File tree

6 files changed

+31
-12
lines changed

6 files changed

+31
-12
lines changed

yt/yt/core/crypto/tls.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,12 @@ class TTlsConnection
340340

341341
bool IsIdle() const override
342342
{
343-
return
344-
Underlying_->IsIdle() &&
345-
ActiveIOCount_ == 0 &&
346-
!Failed_;
343+
return ActiveIOCount_ == 0 && !Failed_;
344+
}
345+
346+
bool IsReusable() const override
347+
{
348+
return IsIdle() && Underlying_->IsReusable();
347349
}
348350

349351
TFuture<void> Abort() override

yt/yt/core/http/connection_reuse_helpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ TReusableConnectionState::TReusableConnectionState(
1717

1818
TReusableConnectionState::~TReusableConnectionState()
1919
{
20-
if (Reusable && OwningPool && Connection->IsIdle()) {
20+
if (Reusable && OwningPool && Connection->IsReusable()) {
2121
OwningPool->Release(std::move(Connection));
2222
}
2323
}

yt/yt/core/http/unittests/http_ut.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ struct TFakeConnection
206206
return true;
207207
}
208208

209+
bool IsReusable() const override
210+
{
211+
return true;
212+
}
213+
209214
TFuture<void> Abort() override
210215
{
211216
THROW_ERROR_EXCEPTION("Not implemented");

yt/yt/core/net/connection.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,11 @@ class TFDConnectionImpl
645645
!PeerDisconnectedList_.IsFired();
646646
}
647647

648+
bool IsReusable()
649+
{
650+
return IsIdle();
651+
}
652+
648653
TFuture<void> Abort(const TError& error)
649654
{
650655
YT_LOG_DEBUG(error, "Aborting connection");
@@ -1213,6 +1218,11 @@ class TFDConnection
12131218
return Impl_->IsIdle();
12141219
}
12151220

1221+
bool IsReusable() const override
1222+
{
1223+
return Impl_->IsReusable();
1224+
}
1225+
12161226
TFuture<void> Abort() override
12171227
{
12181228
return Impl_->Abort(TError(EErrorCode::Aborted, "Connection aborted"));

yt/yt/core/net/connection.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,19 @@ struct IConnection
7373
virtual const TNetworkAddress& GetLocalAddress() const = 0;
7474
virtual const TNetworkAddress& GetRemoteAddress() const = 0;
7575

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

80+
//! Returns true if connection can be reused by a pool.
81+
virtual bool IsReusable() const = 0;
82+
8083
virtual bool SetNoDelay() = 0;
8184
virtual bool SetKeepAlive() = 0;
8285

8386
TFuture<void> Abort() override = 0;
8487

85-
// SubscribePeerDisconnect is best effort and is not guaranteed to fire.
88+
//! This callback is best effort and is not guaranteed to fire.
8689
virtual void SubscribePeerDisconnect(TCallback<void()> callback) = 0;
8790
};
8891

yt/yt/core/rpc/unittests/lib/common.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,9 @@ using TAllTransports = ::testing::Types<
523523
TRpcOverGrpcImpl<false, false>,
524524
TRpcOverGrpcImpl<false, true>,
525525
TRpcOverGrpcImpl<true, false>,
526-
TRpcOverGrpcImpl<true, true>
527-
// XXX(babenko): temporarily off
528-
// TRpcOverHttpImpl<false>,
529-
// TRpcOverHttpImpl<true>
526+
TRpcOverGrpcImpl<true, true>,
527+
TRpcOverHttpImpl<false>,
528+
TRpcOverHttpImpl<true>
530529
>;
531530

532531
using TWithAttachments = ::testing::Types<

0 commit comments

Comments
 (0)