aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbabenko <babenko@yandex-team.com>2024-09-11 10:00:23 +0300
committerbabenko <babenko@yandex-team.com>2024-09-11 10:15:08 +0300
commit791acdc0eb1c623ee243d50b9a2545daca2f5be9 (patch)
treee0f86bd081fb62c91f2bced1978a01a88e280ada
parentfd5ce57a120baa3f8bf042bb7dacb3819750a71d (diff)
downloadydb-791acdc0eb1c623ee243d50b9a2545daca2f5be9.tar.gz
Fix passing options to channels instantiated via Cell Directory
ddc941f0f949cc7bbd9bd2d2b70d807b7754c0ab
-rw-r--r--yt/yt/core/rpc/config.cpp24
-rw-r--r--yt/yt/core/rpc/config.h50
-rw-r--r--yt/yt/core/rpc/public.h1
3 files changed, 39 insertions, 36 deletions
diff --git a/yt/yt/core/rpc/config.cpp b/yt/yt/core/rpc/config.cpp
index ded7137a24..50030c0c3b 100644
--- a/yt/yt/core/rpc/config.cpp
+++ b/yt/yt/core/rpc/config.cpp
@@ -148,7 +148,7 @@ void TRetryingChannelConfig::Register(TRegistrar registrar)
////////////////////////////////////////////////////////////////////////////////
-void TBalancingChannelConfigBase::Register(TRegistrar registrar)
+void TViablePeerRegistryConfig::Register(TRegistrar registrar)
{
registrar.Parameter("discover_timeout", &TThis::DiscoverTimeout)
.Default(TDuration::Seconds(15));
@@ -162,12 +162,6 @@ void TBalancingChannelConfigBase::Register(TRegistrar registrar)
.Default(TDuration::Seconds(60));
registrar.Parameter("soft_backoff_time", &TThis::SoftBackoffTime)
.Default(TDuration::Seconds(15));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-void TViablePeerRegistryConfig::Register(TRegistrar registrar)
-{
registrar.Parameter("max_peer_count", &TThis::MaxPeerCount)
.GreaterThan(1)
.Default(100);
@@ -241,18 +235,24 @@ void TServiceDiscoveryEndpointsConfig::Register(TRegistrar registrar)
////////////////////////////////////////////////////////////////////////////////
-void TBalancingChannelConfig::Register(TRegistrar registrar)
+void TBalancingChannelConfigBase::Register(TRegistrar registrar)
{
- registrar.Parameter("addresses", &TThis::Addresses)
- .Optional();
registrar.Parameter("disable_balancing_on_single_address", &TThis::DisableBalancingOnSingleAddress)
.Default(true);
- registrar.Parameter("endpoints", &TThis::Endpoints)
- .Optional();
registrar.Parameter("hedging_delay", &TThis::HedgingDelay)
.Optional();
registrar.Parameter("cancel_primary_request_on_hedging", &TThis::CancelPrimaryRequestOnHedging)
.Default(false);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+void TBalancingChannelConfig::Register(TRegistrar registrar)
+{
+ registrar.Parameter("addresses", &TThis::Addresses)
+ .Optional();
+ registrar.Parameter("endpoints", &TThis::Endpoints)
+ .Optional();
registrar.Postprocessor([] (TThis* config) {
int endpointConfigCount = 0;
diff --git a/yt/yt/core/rpc/config.h b/yt/yt/core/rpc/config.h
index f77fb077d2..cc4e924ef1 100644
--- a/yt/yt/core/rpc/config.h
+++ b/yt/yt/core/rpc/config.h
@@ -195,7 +195,12 @@ DEFINE_REFCOUNTED_TYPE(TRetryingChannelConfig)
////////////////////////////////////////////////////////////////////////////////
-class TBalancingChannelConfigBase
+DEFINE_ENUM(EPeerPriorityStrategy,
+ (None)
+ (PreferLocal)
+);
+
+class TViablePeerRegistryConfig
: public virtual NYTree::TYsonStruct
{
public:
@@ -227,22 +232,6 @@ public:
//! returns a soft failure (i.e. "down" response) to |Discover| request.
TDuration SoftBackoffTime;
- REGISTER_YSON_STRUCT(TBalancingChannelConfigBase);
-
- static void Register(TRegistrar registrar);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
-DEFINE_ENUM(EPeerPriorityStrategy,
- (None)
- (PreferLocal)
-);
-
-class TViablePeerRegistryConfig
- : public TBalancingChannelConfigBase
-{
-public:
//! In case too many peers are known, the registry will only maintain this many peers active.
int MaxPeerCount;
@@ -322,27 +311,40 @@ DEFINE_REFCOUNTED_TYPE(TServiceDiscoveryEndpointsConfig)
////////////////////////////////////////////////////////////////////////////////
-class TBalancingChannelConfig
+class TBalancingChannelConfigBase
: public TDynamicChannelPoolConfig
{
public:
- //! First option: static list of addresses.
- std::optional<std::vector<std::string>> Addresses;
-
//! Disables discovery and balancing when just one address is given.
//! This is vital for jobs since node's redirector is incapable of handling
//! discover requests properly.
bool DisableBalancingOnSingleAddress;
- //! Second option: SD endpoints.
- TServiceDiscoveryEndpointsConfigPtr Endpoints;
-
//! Delay before sending a hedged request. If null then hedging is disabled.
std::optional<TDuration> HedgingDelay;
//! Whether to cancel the primary request when backup one is sent.
bool CancelPrimaryRequestOnHedging;
+ REGISTER_YSON_STRUCT(TBalancingChannelConfigBase);
+
+ static void Register(TRegistrar registrar);
+};
+
+DEFINE_REFCOUNTED_TYPE(TBalancingChannelConfigBase)
+
+////////////////////////////////////////////////////////////////////////////////
+
+class TBalancingChannelConfig
+ : public TBalancingChannelConfigBase
+{
+public:
+ //! First option: static list of addresses.
+ std::optional<std::vector<std::string>> Addresses;
+
+ //! Second option: SD endpoints.
+ TServiceDiscoveryEndpointsConfigPtr Endpoints;
+
REGISTER_YSON_STRUCT(TBalancingChannelConfig);
static void Register(TRegistrar registrar);
diff --git a/yt/yt/core/rpc/public.h b/yt/yt/core/rpc/public.h
index 45f6b44a82..b4f7694947 100644
--- a/yt/yt/core/rpc/public.h
+++ b/yt/yt/core/rpc/public.h
@@ -116,6 +116,7 @@ DECLARE_REFCOUNTED_CLASS(TRetryingChannelConfig)
DECLARE_REFCOUNTED_CLASS(TViablePeerRegistryConfig)
DECLARE_REFCOUNTED_CLASS(TDynamicChannelPoolConfig)
DECLARE_REFCOUNTED_CLASS(TServiceDiscoveryEndpointsConfig)
+DECLARE_REFCOUNTED_CLASS(TBalancingChannelConfigBase)
DECLARE_REFCOUNTED_CLASS(TBalancingChannelConfig)
DECLARE_REFCOUNTED_CLASS(TThrottlingChannelConfig)
DECLARE_REFCOUNTED_CLASS(TThrottlingChannelDynamicConfig)