aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrigminakov <grigminakov@yandex-team.com>2023-12-04 13:40:15 +0300
committergrigminakov <grigminakov@yandex-team.com>2023-12-04 17:50:08 +0300
commitc670eacd23ae534fcc7115f139a70b0676973886 (patch)
tree7487742b732e71564233d15039c81602ec98a9cd
parent1b6467627c13fc73287f5535beb91db038a6ca60 (diff)
downloadydb-c670eacd23ae534fcc7115f139a70b0676973886.tar.gz
YT-20546: Add DisableBalancingOnSingleAddress option
-rw-r--r--yt/yt/core/rpc/balancing_channel.cpp5
-rw-r--r--yt/yt/core/rpc/config.cpp2
-rw-r--r--yt/yt/core/rpc/config.h1
3 files changed, 7 insertions, 1 deletions
diff --git a/yt/yt/core/rpc/balancing_channel.cpp b/yt/yt/core/rpc/balancing_channel.cpp
index f3e61afe78..549c4bcc1b 100644
--- a/yt/yt/core/rpc/balancing_channel.cpp
+++ b/yt/yt/core/rpc/balancing_channel.cpp
@@ -204,7 +204,10 @@ public:
TFuture<IChannelPtr> GetChannel(const IClientRequestPtr& request) override
{
- if (Config_->Addresses && Config_->Addresses->size() == 1) {
+ if (Config_->DisableBalancingOnSingleAddress &&
+ Config_->Addresses &&
+ Config_->Addresses->size() == 1)
+ {
// Disable 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.
diff --git a/yt/yt/core/rpc/config.cpp b/yt/yt/core/rpc/config.cpp
index 594b83636a..a5f1b03106 100644
--- a/yt/yt/core/rpc/config.cpp
+++ b/yt/yt/core/rpc/config.cpp
@@ -208,6 +208,8 @@ void TBalancingChannelConfig::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)
diff --git a/yt/yt/core/rpc/config.h b/yt/yt/core/rpc/config.h
index 709101f7c9..5cc7e2c115 100644
--- a/yt/yt/core/rpc/config.h
+++ b/yt/yt/core/rpc/config.h
@@ -292,6 +292,7 @@ class TBalancingChannelConfig
public:
//! First option: static list of addresses.
std::optional<std::vector<TString>> Addresses;
+ bool DisableBalancingOnSingleAddress;
//! Second option: SD endpoints.
TServiceDiscoveryEndpointsConfigPtr Endpoints;