aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgalaxycrab <UgnineSirdis@ydb.tech>2022-08-03 15:44:08 +0300
committergalaxycrab <UgnineSirdis@ydb.tech>2022-08-03 15:44:08 +0300
commit206563ccf21f5ad7f23d3743fc702bb05a288858 (patch)
tree33247aafadcb4519fe6e3e021967e6cf56abdb13
parentf7663cc5ffe69ef8bb4e921755c8439847ee6347 (diff)
downloadydb-206563ccf21f5ad7f23d3743fc702bb05a288858.tar.gz
Allow YQ to work without rate limiter enabled in config
-rw-r--r--ydb/core/yq/libs/actors/pending_fetcher.cpp6
-rw-r--r--ydb/core/yq/libs/actors/proxy.h1
-rw-r--r--ydb/core/yq/libs/actors/run_actor.cpp12
-rw-r--r--ydb/core/yq/libs/actors/run_actor_params.cpp2
-rw-r--r--ydb/core/yq/libs/actors/run_actor_params.h2
-rw-r--r--ydb/core/yq/libs/init/init.cpp2
6 files changed, 20 insertions, 5 deletions
diff --git a/ydb/core/yq/libs/actors/pending_fetcher.cpp b/ydb/core/yq/libs/actors/pending_fetcher.cpp
index 9673894fda..acdb6edbfd 100644
--- a/ydb/core/yq/libs/actors/pending_fetcher.cpp
+++ b/ydb/core/yq/libs/actors/pending_fetcher.cpp
@@ -121,6 +121,7 @@ public:
const ::NYq::NConfig::TPrivateApiConfig& privateApiConfig,
const ::NYq::NConfig::TGatewaysConfig& gatewaysConfig,
const ::NYq::NConfig::TPingerConfig& pingerConfig,
+ const ::NYq::NConfig::TRateLimiterConfig& rateLimiterConfig,
const NKikimr::NMiniKQL::IFunctionRegistry* functionRegistry,
TIntrusivePtr<ITimeProvider> timeProvider,
TIntrusivePtr<IRandomProvider> randomProvider,
@@ -139,6 +140,7 @@ public:
, PrivateApiConfig(privateApiConfig)
, GatewaysConfig(gatewaysConfig)
, PingerConfig(pingerConfig)
+ , RateLimiterConfig(rateLimiterConfig)
, FunctionRegistry(functionRegistry)
, TimeProvider(timeProvider)
, RandomProvider(randomProvider)
@@ -321,6 +323,7 @@ private:
DqCompFactory, PqCmConnections,
CommonConfig, CheckpointCoordinatorConfig,
PrivateApiConfig, GatewaysConfig, PingerConfig,
+ RateLimiterConfig,
task.text(), task.scope(), task.user_token(),
DatabaseResolver, queryId,
task.user_id(), GetOwnerId(), task.generation(),
@@ -373,6 +376,7 @@ private:
NYq::NConfig::TPrivateApiConfig PrivateApiConfig;
NYq::NConfig::TGatewaysConfig GatewaysConfig;
NYq::NConfig::TPingerConfig PingerConfig;
+ NYq::NConfig::TRateLimiterConfig RateLimiterConfig;
const NKikimr::NMiniKQL::IFunctionRegistry* FunctionRegistry;
TIntrusivePtr<ITimeProvider> TimeProvider;
@@ -419,6 +423,7 @@ NActors::IActor* CreatePendingFetcher(
const ::NYq::NConfig::TPrivateApiConfig& privateApiConfig,
const ::NYq::NConfig::TGatewaysConfig& gatewaysConfig,
const ::NYq::NConfig::TPingerConfig& pingerConfig,
+ const ::NYq::NConfig::TRateLimiterConfig& rateLimiterConfig,
const NKikimr::NMiniKQL::IFunctionRegistry* functionRegistry,
TIntrusivePtr<ITimeProvider> timeProvider,
TIntrusivePtr<IRandomProvider> randomProvider,
@@ -438,6 +443,7 @@ NActors::IActor* CreatePendingFetcher(
privateApiConfig,
gatewaysConfig,
pingerConfig,
+ rateLimiterConfig,
functionRegistry,
timeProvider,
randomProvider,
diff --git a/ydb/core/yq/libs/actors/proxy.h b/ydb/core/yq/libs/actors/proxy.h
index a366aff5a5..8a65a9c987 100644
--- a/ydb/core/yq/libs/actors/proxy.h
+++ b/ydb/core/yq/libs/actors/proxy.h
@@ -41,6 +41,7 @@ NActors::IActor* CreatePendingFetcher(
const ::NYq::NConfig::TPrivateApiConfig& privateApiConfig,
const ::NYq::NConfig::TGatewaysConfig& gatewaysConfig,
const ::NYq::NConfig::TPingerConfig& pingerConfig,
+ const ::NYq::NConfig::TRateLimiterConfig& rateLimiterConfig,
const NKikimr::NMiniKQL::IFunctionRegistry* functionRegistry,
TIntrusivePtr<ITimeProvider> timeProvider,
TIntrusivePtr<IRandomProvider> randomProvider,
diff --git a/ydb/core/yq/libs/actors/run_actor.cpp b/ydb/core/yq/libs/actors/run_actor.cpp
index 7d928f0e84..5222d60c7f 100644
--- a/ydb/core/yq/libs/actors/run_actor.cpp
+++ b/ydb/core/yq/libs/actors/run_actor.cpp
@@ -1132,7 +1132,7 @@ private:
}
bool StartRateLimiterResourceCreatorIfNeeded() {
- if (!RateLimiterResourceWasCreated && !RateLimiterResourceCreatorId) {
+ if (!RateLimiterResourceWasCreated && !RateLimiterResourceCreatorId && Params.RateLimiterConfig.GetEnabled()) {
LOG_D("Start rate limiter resource creator");
RateLimiterResourceCreatorId = Register(CreateRateLimiterResourceCreator(SelfId(), Params.Owner, Params.QueryId));
return true;
@@ -1141,7 +1141,7 @@ private:
}
bool StartRateLimiterResourceDeleterIfCan() {
- if (!RateLimiterResourceDeleterId && !RateLimiterResourceCreatorId && FinalizingStatusIsWritten && QueryResponseArrived) {
+ if (!RateLimiterResourceDeleterId && !RateLimiterResourceCreatorId && FinalizingStatusIsWritten && QueryResponseArrived && Params.RateLimiterConfig.GetEnabled()) {
LOG_D("Start rate limiter resource deleter");
RateLimiterResourceDeleterId = Register(CreateRateLimiterResourceDeleter(SelfId(), Params.Owner, Params.QueryId));
return true;
@@ -1150,8 +1150,10 @@ private:
}
void RunDqGraphs() {
- if (StartRateLimiterResourceCreatorIfNeeded() || !RateLimiterResourceWasCreated) {
- return;
+ if (Params.RateLimiterConfig.GetEnabled()) {
+ if (StartRateLimiterResourceCreatorIfNeeded() || !RateLimiterResourceWasCreated) {
+ return;
+ }
}
if (DqGraphParams.empty()) {
@@ -1435,7 +1437,7 @@ private:
notFinished = true;
}
- if (!RateLimiterResourceWasDeleted) {
+ if (!RateLimiterResourceWasDeleted && Params.RateLimiterConfig.GetEnabled()) {
StartRateLimiterResourceDeleterIfCan();
notFinished = true;
}
diff --git a/ydb/core/yq/libs/actors/run_actor_params.cpp b/ydb/core/yq/libs/actors/run_actor_params.cpp
index 93c96406b7..9dcbd8fb04 100644
--- a/ydb/core/yq/libs/actors/run_actor_params.cpp
+++ b/ydb/core/yq/libs/actors/run_actor_params.cpp
@@ -19,6 +19,7 @@ TRunActorParams::TRunActorParams(
const ::NYq::NConfig::TPrivateApiConfig& privateApiConfig,
const ::NYq::NConfig::TGatewaysConfig& gatewaysConfig,
const ::NYq::NConfig::TPingerConfig& pingerConfig,
+ const ::NYq::NConfig::TRateLimiterConfig& rateLimiterConfig,
const TString& sql,
const TScope& scope,
const TString& authToken,
@@ -66,6 +67,7 @@ TRunActorParams::TRunActorParams(
, PrivateApiConfig(privateApiConfig)
, GatewaysConfig(gatewaysConfig)
, PingerConfig(pingerConfig)
+ , RateLimiterConfig(rateLimiterConfig)
, Sql(sql)
, Scope(scope)
, AuthToken(authToken)
diff --git a/ydb/core/yq/libs/actors/run_actor_params.h b/ydb/core/yq/libs/actors/run_actor_params.h
index 8e3e32ea59..3e095104b4 100644
--- a/ydb/core/yq/libs/actors/run_actor_params.h
+++ b/ydb/core/yq/libs/actors/run_actor_params.h
@@ -34,6 +34,7 @@ struct TRunActorParams { // TODO2 : Change name
const ::NYq::NConfig::TPrivateApiConfig& privateApiConfig,
const ::NYq::NConfig::TGatewaysConfig& gatewaysConfig,
const ::NYq::NConfig::TPingerConfig& pingerConfig,
+ const ::NYq::NConfig::TRateLimiterConfig& rateLimiterConfig,
const TString& sql,
const TScope& scope,
const TString& authToken,
@@ -86,6 +87,7 @@ struct TRunActorParams { // TODO2 : Change name
const ::NYq::NConfig::TPrivateApiConfig PrivateApiConfig;
const ::NYq::NConfig::TGatewaysConfig GatewaysConfig;
const ::NYq::NConfig::TPingerConfig PingerConfig;
+ const ::NYq::NConfig::TRateLimiterConfig RateLimiterConfig;
const TString Sql;
const TScope Scope;
const TString AuthToken;
diff --git a/ydb/core/yq/libs/init/init.cpp b/ydb/core/yq/libs/init/init.cpp
index bbf5b79536..68bcaece17 100644
--- a/ydb/core/yq/libs/init/init.cpp
+++ b/ydb/core/yq/libs/init/init.cpp
@@ -88,6 +88,7 @@ void Init(
}
if (protoConfig.GetRateLimiter().GetControlPlaneEnabled()) {
+ Y_VERIFY(protoConfig.GetQuotasManager().GetEnabled()); // Rate limiter resources want to know CPU quota on creation
NActors::IActor* rateLimiterService = NYq::CreateRateLimiterControlPlaneService(protoConfig.GetRateLimiter(), yqSharedResources, credentialsProviderFactory);
actorRegistrator(NYq::RateLimiterControlPlaneServiceId(), rateLimiterService);
}
@@ -247,6 +248,7 @@ void Init(
protoConfig.GetPrivateApi(),
protoConfig.GetGateways(),
protoConfig.GetPinger(),
+ protoConfig.GetRateLimiter(),
appData->FunctionRegistry,
TAppData::TimeProvider,
TAppData::RandomProvider,