diff options
author | galaxycrab <UgnineSirdis@ydb.tech> | 2022-08-02 13:22:29 +0300 |
---|---|---|
committer | galaxycrab <UgnineSirdis@ydb.tech> | 2022-08-02 13:22:29 +0300 |
commit | dfcf8ab6b83053c721dc2a39d17e3060713b318c (patch) | |
tree | 88f45ede40f6ad66f6ddcfa151d53437545897b7 | |
parent | 0d67bde49365448d4746e77f6ac1b2773525cb97 (diff) | |
download | ydb-dfcf8ab6b83053c721dc2a39d17e3060713b318c.tar.gz |
Support CPU quota in quota manager
-rw-r--r-- | ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp | 4 | ||||
-rw-r--r-- | ydb/core/yq/libs/init/init.cpp | 3 | ||||
-rw-r--r-- | ydb/core/yq/libs/quota_manager/events/events.h | 5 |
3 files changed, 9 insertions, 3 deletions
diff --git a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp index 7b2354e0212..ef614066ac6 100644 --- a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp +++ b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp @@ -124,6 +124,10 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery } } + if (request.content().limits().vcpu_rate_limit() < 0) { + issues.AddIssue(MakeErrorIssue(TIssuesIds::BAD_REQUEST, "VCPU rate limit can't be less than zero")); + } + if (issues) { CPS_LOG_W("CreateQueryRequest: {" << request.DebugString() << "} " << MakeUserInfo(user, token) << "validation FAILED: " << issues.ToOneLineString()); const TDuration delta = TInstant::Now() - startTime; diff --git a/ydb/core/yq/libs/init/init.cpp b/ydb/core/yq/libs/init/init.cpp index c8d11788c98..bbf5b79536e 100644 --- a/ydb/core/yq/libs/init/init.cpp +++ b/ydb/core/yq/libs/init/init.cpp @@ -291,7 +291,8 @@ void Init( { TQuotaDescription(SUBJECT_TYPE_CLOUD, QUOTA_RESULT_LIMIT, 20_MB, 2_GB), TQuotaDescription(SUBJECT_TYPE_CLOUD, QUOTA_COUNT_LIMIT, 100, 200, NYq::ControlPlaneStorageServiceActorId()), - TQuotaDescription(SUBJECT_TYPE_CLOUD, QUOTA_TIME_LIMIT, 0) + TQuotaDescription(SUBJECT_TYPE_CLOUD, QUOTA_TIME_LIMIT, 0), + TQuotaDescription(SUBJECT_TYPE_CLOUD, QUOTA_CPU_LIMIT, 2, 32) }); actorRegistrator(NYq::MakeQuotaServiceActorId(nodeId), quotaService); diff --git a/ydb/core/yq/libs/quota_manager/events/events.h b/ydb/core/yq/libs/quota_manager/events/events.h index 21c1e061755..2dded44bcbb 100644 --- a/ydb/core/yq/libs/quota_manager/events/events.h +++ b/ydb/core/yq/libs/quota_manager/events/events.h @@ -16,10 +16,11 @@ namespace NYq { -constexpr auto SUBJECT_TYPE_CLOUD = "cloud"; -constexpr auto QUOTA_RESULT_LIMIT = "fq.queryResultLimit.bytes"; +constexpr auto SUBJECT_TYPE_CLOUD = "cloud"; +constexpr auto QUOTA_RESULT_LIMIT = "fq.queryResultLimit.bytes"; constexpr auto QUOTA_COUNT_LIMIT = "fq.queryLimit.count"; constexpr auto QUOTA_TIME_LIMIT = "fq.queryLimit.ttl"; +constexpr auto QUOTA_CPU_LIMIT = "fq.cpu.count"; struct TQuotaInfo { ui64 DefaultLimit; |