aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbabenko <babenko@yandex-team.com>2024-10-16 00:10:36 +0300
committerbabenko <babenko@yandex-team.com>2024-10-16 00:22:06 +0300
commit4e55354ca040f2770a2c41be59e1187ef9a0da90 (patch)
treebfa64fd5dafd29f75384db8d4a4afe2d7eb40175
parente79e931e30386d3c7b688616b22bb8eaf7ce8b58 (diff)
downloadydb-4e55354ca040f2770a2c41be59e1187ef9a0da90.tar.gz
YT-23011: Fix regression introduced in rXXXXXX; re-enable RPC-over-HTTP tests
commit_hash:062b0d3f8ee24766c3894dc9502dc538515616eb
-rw-r--r--yt/yt/core/crypto/tls.cpp10
-rw-r--r--yt/yt/core/http/connection_reuse_helpers.cpp2
-rw-r--r--yt/yt/core/http/unittests/http_ut.cpp5
-rw-r--r--yt/yt/core/net/connection.cpp10
-rw-r--r--yt/yt/core/net/connection.h9
-rw-r--r--yt/yt/core/rpc/unittests/lib/common.h7
6 files changed, 31 insertions, 12 deletions
diff --git a/yt/yt/core/crypto/tls.cpp b/yt/yt/core/crypto/tls.cpp
index 9acfb26180..0eb910fbab 100644
--- a/yt/yt/core/crypto/tls.cpp
+++ b/yt/yt/core/crypto/tls.cpp
@@ -340,10 +340,12 @@ public:
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
diff --git a/yt/yt/core/http/connection_reuse_helpers.cpp b/yt/yt/core/http/connection_reuse_helpers.cpp
index 55ba238a5e..a0e1de77be 100644
--- a/yt/yt/core/http/connection_reuse_helpers.cpp
+++ b/yt/yt/core/http/connection_reuse_helpers.cpp
@@ -17,7 +17,7 @@ TReusableConnectionState::TReusableConnectionState(
TReusableConnectionState::~TReusableConnectionState()
{
- if (Reusable && OwningPool && Connection->IsIdle()) {
+ if (Reusable && OwningPool && Connection->IsReusable()) {
OwningPool->Release(std::move(Connection));
}
}
diff --git a/yt/yt/core/http/unittests/http_ut.cpp b/yt/yt/core/http/unittests/http_ut.cpp
index cda7dea65f..7030a2350f 100644
--- a/yt/yt/core/http/unittests/http_ut.cpp
+++ b/yt/yt/core/http/unittests/http_ut.cpp
@@ -206,6 +206,11 @@ struct TFakeConnection
return true;
}
+ bool IsReusable() const override
+ {
+ return true;
+ }
+
TFuture<void> Abort() override
{
THROW_ERROR_EXCEPTION("Not implemented");
diff --git a/yt/yt/core/net/connection.cpp b/yt/yt/core/net/connection.cpp
index af4e5f0a7e..ea52305bda 100644
--- a/yt/yt/core/net/connection.cpp
+++ b/yt/yt/core/net/connection.cpp
@@ -645,6 +645,11 @@ public:
!PeerDisconnectedList_.IsFired();
}
+ bool IsReusable()
+ {
+ return IsIdle();
+ }
+
TFuture<void> Abort(const TError& error)
{
YT_LOG_DEBUG(error, "Aborting connection");
@@ -1213,6 +1218,11 @@ public:
return Impl_->IsIdle();
}
+ bool IsReusable() const override
+ {
+ return Impl_->IsReusable();
+ }
+
TFuture<void> Abort() override
{
return Impl_->Abort(TError(EErrorCode::Aborted, "Connection aborted"));
diff --git a/yt/yt/core/net/connection.h b/yt/yt/core/net/connection.h
index 4078e11460..3c9998e1d0 100644
--- a/yt/yt/core/net/connection.h
+++ b/yt/yt/core/net/connection.h
@@ -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;
};
diff --git a/yt/yt/core/rpc/unittests/lib/common.h b/yt/yt/core/rpc/unittests/lib/common.h
index a3b26f570c..4f24a3b964 100644
--- a/yt/yt/core/rpc/unittests/lib/common.h
+++ b/yt/yt/core/rpc/unittests/lib/common.h
@@ -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<