aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-02-02 21:28:02 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-02-02 21:40:11 +0300
commit7975803ac2bf9fa5ee89888743a50cd3b382d7c7 (patch)
treedb93ac85834736bac72a80ead96c08dd59eb0745
parent4c6d9b5352a2b70287e27a9ff29ef751a5bc8d08 (diff)
downloadydb-7975803ac2bf9fa5ee89888743a50cd3b382d7c7.tar.gz
Intermediate changes
-rw-r--r--library/cpp/yt/misc/property.h65
-rw-r--r--yt/yt/client/bundle_controller_client/bundle_controller_client.cpp4
-rw-r--r--yt/yt/client/bundle_controller_client/bundle_controller_client.h3
-rw-r--r--yt/yt/client/bundle_controller_client/bundle_controller_settings.cpp92
-rw-r--r--yt/yt/client/bundle_controller_client/bundle_controller_settings.h56
-rw-r--r--yt/yt/client/bundle_controller_client/public.h6
-rw-r--r--yt/yt_proto/yt/client/bundle_controller/proto/bundle_controller_service.proto20
7 files changed, 240 insertions, 6 deletions
diff --git a/library/cpp/yt/misc/property.h b/library/cpp/yt/misc/property.h
index d172fcdcfb..4d0577f464 100644
--- a/library/cpp/yt/misc/property.h
+++ b/library/cpp/yt/misc/property.h
@@ -46,6 +46,24 @@ public: \
} \
static_assert(true)
+//! Defines a trivial public read-write property override that is passed by reference
+//! and is not inline-initialized.
+#define DEFINE_BYREF_RW_PROPERTY_NO_INIT_OVERRIDE(type, name) \
+protected: \
+ type name##_; \
+ \
+public: \
+ Y_FORCE_INLINE type& name() noexcept override \
+ { \
+ return name##_; \
+ } \
+ \
+ Y_FORCE_INLINE const type& name() const noexcept override \
+ { \
+ return name##_; \
+ } \
+ static_assert(true)
+
//! Forwards a trivial public read-write property that is passed by reference.
#define DELEGATE_BYREF_RW_PROPERTY(declaringType, type, name, delegateTo) \
type& declaringType::name() noexcept \
@@ -92,6 +110,19 @@ public: \
} \
static_assert(true)
+//! Defines a trivial public read-only property override that is passed by reference
+//! and is not inline-initialized.
+#define DEFINE_BYREF_RO_PROPERTY_NO_INIT_OVERRIDE(type, name) \
+protected: \
+ type name##_; \
+ \
+public: \
+ Y_FORCE_INLINE const type& name() const noexcept override \
+ { \
+ return name##_; \
+ } \
+ static_assert(true)
+
//! Forwards a trivial public read-only property that is passed by reference.
#define DELEGATE_BYREF_RO_PROPERTY(declaringType, type, name, delegateTo) \
const type& declaringType::name() const noexcept \
@@ -153,7 +184,7 @@ public: \
//! Defines a trivial public read-write property that is passed by value
//! and is not inline-initialized.
-#define DEFINE_BYVAL_RW_PROPERTY_NO_INIT(type, name, ...) \
+#define DEFINE_BYVAL_RW_PROPERTY_NO_INIT(type, name) \
protected: \
type name##_; \
\
@@ -169,6 +200,24 @@ public: \
} \
static_assert(true)
+//! Defines a trivial public read-write property override that is passed by value
+//! and is not inline-initialized.
+#define DEFINE_BYVAL_RW_PROPERTY_NO_INIT_OVERRIDE(type, name) \
+protected: \
+ type name##_; \
+ \
+public: \
+ Y_FORCE_INLINE type Get##name() const override \
+ { \
+ return name##_; \
+ } \
+ \
+ Y_FORCE_INLINE void Set##name(type value) override \
+ { \
+ name##_ = value; \
+ } \
+ static_assert(true)
+
//! Forwards a trivial public read-write property that is passed by value.
#define DELEGATE_BYVAL_RW_PROPERTY(declaringType, type, name, delegateTo) \
type declaringType::Get##name() const \
@@ -202,7 +251,6 @@ public: \
} \
static_assert(true)
-
//! Defines a trivial public read-only property that is passed by value
//! and is not inline-initialized.
#define DEFINE_BYVAL_RO_PROPERTY_NO_INIT(type, name) \
@@ -216,6 +264,19 @@ public: \
} \
static_assert(true)
+//! Defines a trivial public read-only property override that is passed by value
+//! and is not inline-initialized.
+#define DEFINE_BYVAL_RO_PROPERTY_NO_INIT_OVERRIDE(type, name) \
+protected: \
+ type name##_; \
+ \
+public: \
+ Y_FORCE_INLINE type Get##name() const override \
+ { \
+ return name##_; \
+ } \
+ static_assert(true)
+
//! Forwards a trivial public read-only property that is passed by value.
#define DELEGATE_BYVAL_RO_PROPERTY(declaringType, type, name, delegateTo) \
type declaringType::Get##name() \
diff --git a/yt/yt/client/bundle_controller_client/bundle_controller_client.cpp b/yt/yt/client/bundle_controller_client/bundle_controller_client.cpp
index 557e1cc1dc..b0eb346bf2 100644
--- a/yt/yt/client/bundle_controller_client/bundle_controller_client.cpp
+++ b/yt/yt/client/bundle_controller_client/bundle_controller_client.cpp
@@ -8,7 +8,9 @@ void TBundleConfigDescriptor::Register(TRegistrar registrar)
{
registrar.Parameter("bundle_name", &TThis::BundleName)
.Default();
- registrar.Parameter("bundle_config", &TThis::BundleConfig)
+ registrar.Parameter("bundle_config", &TThis::Config)
+ .DefaultNew();
+ registrar.Parameter("bundle_constraints", &TThis::ConfigConstraints)
.DefaultNew();
}
diff --git a/yt/yt/client/bundle_controller_client/bundle_controller_client.h b/yt/yt/client/bundle_controller_client/bundle_controller_client.h
index 99515b0c62..3c1ad6ffc2 100644
--- a/yt/yt/client/bundle_controller_client/bundle_controller_client.h
+++ b/yt/yt/client/bundle_controller_client/bundle_controller_client.h
@@ -24,7 +24,8 @@ struct TBundleConfigDescriptor
{
TString BundleName;
- NBundleControllerClient::TBundleTargetConfigPtr BundleConfig;
+ TBundleTargetConfigPtr Config;
+ TBundleConfigConstraintsPtr ConfigConstraints;
REGISTER_YSON_STRUCT(TBundleConfigDescriptor);
diff --git a/yt/yt/client/bundle_controller_client/bundle_controller_settings.cpp b/yt/yt/client/bundle_controller_client/bundle_controller_settings.cpp
index 6803470041..0c0c03329c 100644
--- a/yt/yt/client/bundle_controller_client/bundle_controller_settings.cpp
+++ b/yt/yt/client/bundle_controller_client/bundle_controller_settings.cpp
@@ -30,6 +30,8 @@ void TMemoryLimits::Register(TRegistrar registrar)
.Optional();
registrar.Parameter("lookup_row_cache", &TThis::LookupRowCache)
.Optional();
+ registrar.Parameter("reserved", &TThis::Reserved)
+ .Optional();
}
void TInstanceResources::Register(TRegistrar registrar)
@@ -57,6 +59,22 @@ bool TInstanceResources::operator==(const TInstanceResources& other) const
return std::tie(Vcpu, Memory, Net) == std::tie(other.Vcpu, other.Memory, other.Net);
}
+void TDefaultInstanceConfig::Register(TRegistrar registrar)
+{
+ registrar.Parameter("cpu_limits", &TThis::CpuLimits)
+ .DefaultNew();
+ registrar.Parameter("memory_limits", &TThis::MemoryLimits)
+ .DefaultNew();
+}
+
+void TInstanceSize::Register(TRegistrar registrar)
+{
+ registrar.Parameter("resource_guarantee", &TThis::ResourceGuarantee)
+ .DefaultNew();
+ registrar.Parameter("default_config", &TThis::DefaultConfig)
+ .DefaultNew();
+}
+
void TBundleTargetConfig::Register(TRegistrar registrar)
{
registrar.Parameter("cpu_limits", &TThis::CpuLimits)
@@ -73,6 +91,13 @@ void TBundleTargetConfig::Register(TRegistrar registrar)
.Default();
}
+void TBundleConfigConstraints::Register(TRegistrar registrar)
+{
+ registrar.Parameter("rpc_proxy_sizes", &TThis::RpcProxySizes)
+ .Default();
+ registrar.Parameter("tablet_node_sizes", &TThis::TabletNodeSizes)
+ .Default();
+}
////////////////////////////////////////////////////////////////////////////////
namespace NProto {
@@ -112,6 +137,8 @@ void ToProto(NBundleController::NProto::TMemoryLimits* protoMemoryLimits, const
YT_TOPROTO_OPTIONAL_PTR(protoMemoryLimits, uncompressed_block_cache, memoryLimits, UncompressedBlockCache);
YT_TOPROTO_OPTIONAL_PTR(protoMemoryLimits, versioned_chunk_meta, memoryLimits, VersionedChunkMeta);
+
+ YT_TOPROTO_OPTIONAL_PTR(protoMemoryLimits, reserved, memoryLimits, Reserved);
}
void FromProto(NBundleControllerClient::TMemoryLimitsPtr memoryLimits, const NBundleController::NProto::TMemoryLimits* protoMemoryLimits)
@@ -126,6 +153,8 @@ void FromProto(NBundleControllerClient::TMemoryLimitsPtr memoryLimits, const NBu
YT_FROMPROTO_OPTIONAL_PTR(protoMemoryLimits, uncompressed_block_cache, memoryLimits, UncompressedBlockCache);
YT_FROMPROTO_OPTIONAL_PTR(protoMemoryLimits, versioned_chunk_meta, memoryLimits, VersionedChunkMeta);
+
+ YT_FROMPROTO_OPTIONAL_PTR(protoMemoryLimits, reserved, memoryLimits, Reserved);
}
////////////////////////////////////////////////////////////////////////////////
@@ -149,6 +178,38 @@ void FromProto(NBundleControllerClient::TInstanceResourcesPtr instanceResources,
////////////////////////////////////////////////////////////////////////////////
+void ToProto(NBundleController::NProto::TDefaultInstanceConfig* protoDefaultInstanceConfig, const TDefaultInstanceConfigPtr defaultInstanceConfig)
+{
+ ToProto(protoDefaultInstanceConfig->mutable_cpu_limits(), defaultInstanceConfig->CpuLimits);
+ ToProto(protoDefaultInstanceConfig->mutable_memory_limits(), defaultInstanceConfig->MemoryLimits);
+}
+
+void FromProto(TDefaultInstanceConfigPtr defaultInstanceConfig, const NBundleController::NProto::TDefaultInstanceConfig* protoDefaultInstanceConfig)
+{
+ if (protoDefaultInstanceConfig->has_cpu_limits())
+ FromProto(defaultInstanceConfig->CpuLimits, &protoDefaultInstanceConfig->cpu_limits());
+ if (protoDefaultInstanceConfig->has_memory_limits())
+ FromProto(defaultInstanceConfig->MemoryLimits, &protoDefaultInstanceConfig->memory_limits());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+void ToProto(NBundleController::NProto::TInstanceSize* protoInstanceSize, const TInstanceSizePtr instanceSize)
+{
+ ToProto(protoInstanceSize->mutable_resource_guarantee(), instanceSize->ResourceGuarantee);
+ ToProto(protoInstanceSize->mutable_default_config(), instanceSize->DefaultConfig);
+}
+
+void FromProto(TInstanceSizePtr instanceSize, const NBundleController::NProto::TInstanceSize* protoInstanceSize)
+{
+ if (protoInstanceSize->has_resource_guarantee())
+ FromProto(instanceSize->ResourceGuarantee, &protoInstanceSize->resource_guarantee());
+ if (protoInstanceSize->has_default_config())
+ FromProto(instanceSize->DefaultConfig, &protoInstanceSize->default_config());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
void ToProto(NBundleController::NProto::TBundleConfig* protoBundleConfig, const NBundleControllerClient::TBundleTargetConfigPtr bundleConfig)
{
YT_TOPROTO_OPTIONAL_PTR(protoBundleConfig, rpc_proxy_count, bundleConfig, RpcProxyCount);
@@ -175,6 +236,37 @@ void FromProto(NBundleControllerClient::TBundleTargetConfigPtr bundleConfig, con
////////////////////////////////////////////////////////////////////////////////
+void ToProto(NBundleController::NProto::TBundleConfigConstraints* protoBundleConfigConstraints, const TBundleConfigConstraintsPtr bundleConfigConstraints)
+{
+ for (auto instance : bundleConfigConstraints->RpcProxySizes) {
+ ToProto(protoBundleConfigConstraints->add_rpc_proxy_sizes(), instance);
+ }
+ for (auto instance : bundleConfigConstraints->TabletNodeSizes) {
+ ToProto(protoBundleConfigConstraints->add_tablet_node_sizes(), instance);
+ }
+}
+
+void FromProto(TBundleConfigConstraintsPtr bundleConfigConstraints, const NBundleController::NProto::TBundleConfigConstraints* protoBundleConfigConstraints)
+{
+ auto rpcProxySizes = protoBundleConfigConstraints->get_arr_rpc_proxy_sizes();
+
+ for (auto instance : rpcProxySizes) {
+ auto newInstance = New<TInstanceSize>();
+ FromProto(newInstance, &instance);
+ bundleConfigConstraints->RpcProxySizes.push_back(newInstance);
+ }
+
+ auto tabletNodeSizes = protoBundleConfigConstraints->get_arr_tablet_node_sizes();
+
+ for (auto instance : tabletNodeSizes) {
+ auto newInstance = New<TInstanceSize>();
+ FromProto(newInstance, &instance);
+ bundleConfigConstraints->TabletNodeSizes.push_back(newInstance);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
} // namespace NProto
} // namespace NYT::NBundleControllerClient
diff --git a/yt/yt/client/bundle_controller_client/bundle_controller_settings.h b/yt/yt/client/bundle_controller_client/bundle_controller_settings.h
index 92d2358a07..952a2eb1ce 100644
--- a/yt/yt/client/bundle_controller_client/bundle_controller_settings.h
+++ b/yt/yt/client/bundle_controller_client/bundle_controller_settings.h
@@ -40,6 +40,7 @@ struct TMemoryLimits
std::optional<i64> TabletStatic;
std::optional<i64> UncompressedBlockCache;
std::optional<i64> VersionedChunkMeta;
+ std::optional<i64> Reserved;
REGISTER_YSON_STRUCT(TMemoryLimits);
@@ -72,6 +73,36 @@ DEFINE_REFCOUNTED_TYPE(TInstanceResources)
////////////////////////////////////////////////////////////////////////////////
+struct TDefaultInstanceConfig
+ : public NYTree::TYsonStruct
+{
+ TCpuLimitsPtr CpuLimits;
+ TMemoryLimitsPtr MemoryLimits;
+
+ REGISTER_YSON_STRUCT(TDefaultInstanceConfig);
+
+ static void Register(TRegistrar registrar);
+};
+
+DEFINE_REFCOUNTED_TYPE(TDefaultInstanceConfig)
+
+////////////////////////////////////////////////////////////////////////////////
+
+struct TInstanceSize
+ : public NYTree::TYsonStruct
+{
+ TInstanceResourcesPtr ResourceGuarantee;
+ TDefaultInstanceConfigPtr DefaultConfig;
+
+ REGISTER_YSON_STRUCT(TInstanceSize);
+
+ static void Register(TRegistrar registrar);
+};
+
+DEFINE_REFCOUNTED_TYPE(TInstanceSize)
+
+////////////////////////////////////////////////////////////////////////////////
+
struct TBundleTargetConfig
: public NYTree::TYsonStruct
{
@@ -91,6 +122,21 @@ DEFINE_REFCOUNTED_TYPE(TBundleTargetConfig)
////////////////////////////////////////////////////////////////////////////////
+struct TBundleConfigConstraints
+ : public NYTree::TYsonStruct
+{
+ std::vector<TInstanceSizePtr> RpcProxySizes;
+ std::vector<TInstanceSizePtr> TabletNodeSizes;
+
+ REGISTER_YSON_STRUCT(TBundleConfigConstraints);
+
+ static void Register(TRegistrar registrar);
+};
+
+DEFINE_REFCOUNTED_TYPE(TBundleConfigConstraints)
+
+////////////////////////////////////////////////////////////////////////////////
+
namespace NProto {
////////////////////////////////////////////////////////////////////////////////
@@ -104,12 +150,18 @@ void FromProto(TMemoryLimitsPtr memoryLimits, const NBundleController::NProto::T
void ToProto(NBundleController::NProto::TInstanceResources* protoInstanceResources, const TInstanceResourcesPtr instanceResources);
void FromProto(TInstanceResourcesPtr instanceResources, const NBundleController::NProto::TInstanceResources* protoInstanceResources);
-void ToProto(NBundleController::NProto::TInstanceResources* protoInstanceResources, const TInstanceResourcesPtr instanceResources);
-void FromProto(TInstanceResourcesPtr instanceResources, const NBundleController::NProto::TInstanceResources* protoInstanceResources);
+void ToProto(NBundleController::NProto::TDefaultInstanceConfig* protoDefaultInstanceConfig, const TDefaultInstanceConfigPtr defaultInstanceConfig);
+void FromProto(TDefaultInstanceConfigPtr defaultInstanceConfig, const NBundleController::NProto::TDefaultInstanceConfig* protoDefaultInstanceConfig);
+
+void ToProto(NBundleController::NProto::TInstanceSize* protoInstanceSize, const TInstanceSizePtr instanceSize);
+void FromProto(TInstanceSizePtr instanceSize, const NBundleController::NProto::TInstanceSize* protoInstanceSize);
void ToProto(NBundleController::NProto::TBundleConfig* protoBundleConfig, const TBundleTargetConfigPtr bundleConfig);
void FromProto(TBundleTargetConfigPtr bundleConfig, const NBundleController::NProto::TBundleConfig* protoBundleConfig);
+void ToProto(NBundleController::NProto::TBundleConfigConstraints* protoBundleConfigConstraints, const TBundleConfigConstraintsPtr bundleConfigConstraints);
+void FromProto(TBundleConfigConstraintsPtr bundleConfigConstraints, const NBundleController::NProto::TBundleConfigConstraints* protoBundleConfigConstraints);
+
////////////////////////////////////////////////////////////////////////////////
} // namespace NProto
diff --git a/yt/yt/client/bundle_controller_client/public.h b/yt/yt/client/bundle_controller_client/public.h
index d9732d34cb..aeeea9312d 100644
--- a/yt/yt/client/bundle_controller_client/public.h
+++ b/yt/yt/client/bundle_controller_client/public.h
@@ -13,15 +13,21 @@ namespace NYT::NBundleControllerClient {
DECLARE_REFCOUNTED_STRUCT(TCpuLimits)
DECLARE_REFCOUNTED_STRUCT(TMemoryLimits)
DECLARE_REFCOUNTED_STRUCT(TInstanceResources)
+DECLARE_REFCOUNTED_STRUCT(TDefaultInstanceConfig)
+DECLARE_REFCOUNTED_STRUCT(TInstanceSize)
DECLARE_REFCOUNTED_STRUCT(TBundleTargetConfig)
DECLARE_REFCOUNTED_STRUCT(TBundleConfigDescriptor)
+DECLARE_REFCOUNTED_STRUCT(TBundleConfigConstraints)
struct TBundleConfigDescriptor;
struct TCpuLimits;
struct TMemoryLimits;
struct TInstanceResources;
+struct TDefaultInstanceConfig;
+struct TInstanceSize;
struct TBundleTargetConfig;
+struct TBundleConfigConstraints;
////////////////////////////////////////////////////////////////////////////////
diff --git a/yt/yt_proto/yt/client/bundle_controller/proto/bundle_controller_service.proto b/yt/yt_proto/yt/client/bundle_controller/proto/bundle_controller_service.proto
index 2b9e8ae21f..a88e8fd2ba 100644
--- a/yt/yt_proto/yt/client/bundle_controller/proto/bundle_controller_service.proto
+++ b/yt/yt_proto/yt/client/bundle_controller/proto/bundle_controller_service.proto
@@ -20,6 +20,7 @@ message TMemoryLimits
optional int64 uncompressed_block_cache = 6;
optional int64 versioned_chunk_meta = 7;
+ optional int64 reserved = 8;
}
message TInstanceResources
@@ -30,6 +31,24 @@ message TInstanceResources
optional int32 vcpu = 4;
}
+message TDefaultInstanceConfig
+{
+ optional TCpuLimits cpu_limits = 1;
+ optional TMemoryLimits memory_limits = 2;
+}
+
+message TInstanceSize
+{
+ optional TInstanceResources resource_guarantee = 1;
+ optional TDefaultInstanceConfig default_config = 2;
+}
+
+message TBundleConfigConstraints
+{
+ repeated TInstanceSize rpc_proxy_sizes = 1;
+ repeated TInstanceSize tablet_node_sizes = 2;
+}
+
message TBundleConfig
{
optional TCpuLimits cpu_limits = 1;
@@ -51,6 +70,7 @@ message TRspGetBundleConfig
{
optional string bundle_name = 1;
optional TBundleConfig bundle_config = 2;
+ optional TBundleConfigConstraints bundle_constraints = 3;
}
message TReqSetBundleConfig