|
@@ -43,6 +43,14 @@ TString TPoolSettings::TExtractor::operator()(TDuration* setting) const {
|
|
|
|
|
|
//// TPoolSettings
|
|
|
|
|
|
+TPoolSettings::TPoolSettings(const google::protobuf::Map<TString, TString>& properties) {
|
|
|
+ for (auto& [property, value] : GetPropertiesMap()) {
|
|
|
+ if (auto propertyIt = properties.find(property); propertyIt != properties.end()) {
|
|
|
+ std::visit(TPoolSettings::TParser{propertyIt->second}, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
std::unordered_map<TString, TPoolSettings::TProperty> TPoolSettings::GetPropertiesMap(bool restricted) {
|
|
|
std::unordered_map<TString, TProperty> properties = {
|
|
|
{"concurrent_query_limit", &ConcurrentQueryLimit},
|
|
@@ -57,4 +65,13 @@ std::unordered_map<TString, TPoolSettings::TProperty> TPoolSettings::GetProperti
|
|
|
return properties;
|
|
|
}
|
|
|
|
|
|
+void TPoolSettings::Validate() const {
|
|
|
+ if (ConcurrentQueryLimit > POOL_MAX_CONCURRENT_QUERY_LIMIT) {
|
|
|
+ throw yexception() << "Invalid resource pool configuration, concurrent_query_limit is " << ConcurrentQueryLimit << ", that exceeds limit in " << POOL_MAX_CONCURRENT_QUERY_LIMIT;
|
|
|
+ }
|
|
|
+ if (QueueSize != -1 && ConcurrentQueryLimit == -1 && DatabaseLoadCpuThreshold < 0.0) {
|
|
|
+ throw yexception() << "Invalid resource pool configuration, queue_size unsupported without concurrent_query_limit or database_load_cpu_threshold";
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
} // namespace NKikimr::NResourcePool
|