aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraneporada <aneporada@yandex-team.com>2025-06-06 12:00:28 +0300
committeraneporada <aneporada@yandex-team.com>2025-06-06 12:35:08 +0300
commitd46faefd308c5000b4d3b74562e96d8bbd16afab (patch)
tree2dc4e748e2b8f14a58813888b4f3448f0abe584a
parentaf077348a4f8897285cd9033f53d8a5cb04d61de (diff)
downloadydb-d46faefd308c5000b4d3b74562e96d8bbd16afab.tar.gz
Enable YQL_BETTER_CONF_SETTING_API
commit_hash:cee72176174f3e997c24d395aeef14424217fcab
-rw-r--r--yql/essentials/providers/common/config/yql_dispatch.h42
-rw-r--r--yql/essentials/providers/common/config/yql_setting.h17
-rw-r--r--yt/yql/providers/yt/common/yql_yt_settings.h14
3 files changed, 1 insertions, 72 deletions
diff --git a/yql/essentials/providers/common/config/yql_dispatch.h b/yql/essentials/providers/common/config/yql_dispatch.h
index b4d63aecf11..fd74a29f62f 100644
--- a/yql/essentials/providers/common/config/yql_dispatch.h
+++ b/yql/essentials/providers/common/config/yql_dispatch.h
@@ -76,7 +76,6 @@ TParser<TInstant> GetDefaultParser<TInstant>();
YQL_PRIMITIVE_SETTING_PARSER_TYPES(YQL_DECLARE_SETTING_PARSER)
YQL_CONTAINER_SETTING_PARSER_TYPES(YQL_DECLARE_SETTING_PARSER)
-#ifdef YQL_BETTER_CONF_SETTING_API
template<typename TType>
TMaybe<TType> GetValue(const NCommon::TConfSetting<TType, NCommon::EConfSettingType::StaticPerCluster>& setting, const TString& cluster) {
return setting.Get(cluster);
@@ -92,28 +91,6 @@ TMaybe<TType> GetValue(const NCommon::TConfSetting<TType, NCommon::EConfSettingT
Y_UNUSED(cluster);
return setting.Get();
}
-#else
-template<typename TType>
-TMaybe<TType> GetValue(const NCommon::TConfSetting<TType, true, false>& setting, const TString& cluster) {
- return setting.Get(cluster);
-}
-
-template<typename TType>
-TMaybe<TType> GetValue(const NCommon::TConfSetting<TType, true, true>& setting, const TString& cluster) {
- return setting.Get(cluster);
-}
-
-template<typename TType>
-TMaybe<TType> GetValue(const NCommon::TConfSetting<TType, false, true>& setting, const TString& cluster) {
- return setting.Get(cluster);
-}
-
-template<typename TType>
-TMaybe<TType> GetValue(const NCommon::TConfSetting<TType, false, false>& setting, const TString& cluster) {
- Y_UNUSED(cluster);
- return setting.Get();
-}
-#endif
}
@@ -154,11 +131,7 @@ public:
TString Name_;
};
-#ifdef YQL_BETTER_CONF_SETTING_API
template <typename TType, EConfSettingType SettingType>
-#else
- template <typename TType, bool RUNTIME, bool PERCLUSTER>
-#endif
class TSettingHandlerImpl : public TSettingHandler {
public:
using TValueCallback = std::function<void(const TString&, TType)>;
@@ -166,11 +139,7 @@ public:
private:
friend class TSettingDispatcher;
-#ifdef YQL_BETTER_CONF_SETTING_API
TSettingHandlerImpl(const TString& name, TConfSetting<TType, SettingType>& setting)
-#else
- TSettingHandlerImpl(const TString& name, TConfSetting<TType, RUNTIME, PERCLUSTER>& setting)
-#endif
: TSettingHandler(name)
, Setting_(setting)
, Parser_(::NYql::NPrivate::GetDefaultParser<TType>())
@@ -353,13 +322,8 @@ public:
}
private:
-#ifdef YQL_BETTER_CONF_SETTING_API
TConfSetting<TType, SettingType>& Setting_;
TMaybe<TConfSetting<TType, SettingType>> Defaul_;
-#else
- TConfSetting<TType, RUNTIME, PERCLUSTER>& Setting_;
- TMaybe<TConfSetting<TType, RUNTIME, PERCLUSTER>> Defaul_;
-#endif
::NYql::NPrivate::TParser<TType> Parser_;
TValueCallback ValueSetter_;
TVector<TValueCallback> Validators_;
@@ -385,15 +349,9 @@ public:
ValidClusters.insert(cluster);
}
-#ifdef YQL_BETTER_CONF_SETTING_API
template <typename TType, EConfSettingType SettingType>
TSettingHandlerImpl<TType, SettingType>& AddSetting(const TString& name, TConfSetting<TType, SettingType>& setting) {
TIntrusivePtr<TSettingHandlerImpl<TType, SettingType>> handler = new TSettingHandlerImpl<TType, SettingType>(name, setting);
-#else
- template <typename TType, bool RUNTIME, bool PERCLUSTER>
- TSettingHandlerImpl<TType, RUNTIME, PERCLUSTER>& AddSetting(const TString& name, TConfSetting<TType, RUNTIME, PERCLUSTER>& setting) {
- TIntrusivePtr<TSettingHandlerImpl<TType, RUNTIME, PERCLUSTER>> handler = new TSettingHandlerImpl<TType, RUNTIME, PERCLUSTER>(name, setting);
-#endif
if (!Handlers.insert({NormalizeName(name), handler}).second) {
ythrow yexception() << "Duplicate configuration setting name " << name.Quote();
}
diff --git a/yql/essentials/providers/common/config/yql_setting.h b/yql/essentials/providers/common/config/yql_setting.h
index 64f15af88dd..a912510791b 100644
--- a/yql/essentials/providers/common/config/yql_setting.h
+++ b/yql/essentials/providers/common/config/yql_setting.h
@@ -18,11 +18,8 @@ enum class EConfSettingType {
Dynamic,
};
-#ifdef YQL_BETTER_CONF_SETTING_API
+#define YQL_BETTER_CONF_SETTING_API
template <typename TType, EConfSettingType SettingType = EConfSettingType::Dynamic>
-#else
-template <typename TType, bool RUNTIME = true, bool PERCLUSTER = false>
-#endif
class TConfSetting {
public:
TConfSetting() = default;
@@ -34,19 +31,11 @@ public:
~TConfSetting() = default;
bool IsRuntime() const {
-#ifdef YQL_BETTER_CONF_SETTING_API
return SettingType == EConfSettingType::Dynamic;
-#else
- return RUNTIME;
-#endif
}
bool IsPerCluster() const {
-#ifdef YQL_BETTER_CONF_SETTING_API
return SettingType == EConfSettingType::Dynamic || SettingType == EConfSettingType::StaticPerCluster;
-#else
- return RUNTIME || PERCLUSTER;
-#endif
}
TType& operator[](const TString& cluster) {
@@ -102,11 +91,7 @@ private:
};
template <typename TType>
-#ifdef YQL_BETTER_CONF_SETTING_API
class TConfSetting<TType, EConfSettingType::Static> {
-#else
-class TConfSetting<TType, false, false> {
-#endif
public:
TConfSetting() = default;
TConfSetting(const TType& value)
diff --git a/yt/yql/providers/yt/common/yql_yt_settings.h b/yt/yql/providers/yt/common/yql_yt_settings.h
index 2505a22f034..c4a3b47c908 100644
--- a/yt/yql/providers/yt/common/yql_yt_settings.h
+++ b/yt/yql/providers/yt/common/yql_yt_settings.h
@@ -84,14 +84,9 @@ enum class ERuntimeClusterSelectionMode {
struct TYtSettings {
private:
-#ifdef YQL_BETTER_CONF_SETTING_API
static constexpr NCommon::EConfSettingType Static = NCommon::EConfSettingType::Static;
static constexpr NCommon::EConfSettingType Dynamic = NCommon::EConfSettingType::Dynamic;
static constexpr NCommon::EConfSettingType StaticPerCluster = NCommon::EConfSettingType::StaticPerCluster;
-#else
- static constexpr bool Static = false;
- static constexpr bool Dynamic = true;
-#endif
public:
using TConstPtr = std::shared_ptr<const TYtSettings>;
@@ -99,21 +94,12 @@ public:
// should be static, because are used on earlier stages
// static per-cluster
-#ifdef YQL_BETTER_CONF_SETTING_API
NCommon::TConfSetting<TGUID, StaticPerCluster> ExternalTx;
NCommon::TConfSetting<TString, StaticPerCluster> TmpFolder;
NCommon::TConfSetting<TString, StaticPerCluster> TablesTmpFolder;
NCommon::TConfSetting<TString, StaticPerCluster> BinaryTmpFolder;
NCommon::TConfSetting<TString, StaticPerCluster> StaticPool;
NCommon::TConfSetting<TString, StaticPerCluster> CoreDumpPath;
-#else
- NCommon::TConfSetting<TGUID, false, true> ExternalTx;
- NCommon::TConfSetting<TString, false, true> TmpFolder;
- NCommon::TConfSetting<TString, false, true> TablesTmpFolder;
- NCommon::TConfSetting<TString, false, true> BinaryTmpFolder;
- NCommon::TConfSetting<TString, false, true> StaticPool;
- NCommon::TConfSetting<TString, false, true> CoreDumpPath;
-#endif
// static global
NCommon::TConfSetting<TString, Static> Auth;