aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-09 15:20:41 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 15:58:17 +0300
commit8f2bd4321c0db18b41461261f2f2ba3434e32e44 (patch)
tree30455d2381d6fb711ca23230faae2c5235d4c34c
parent29fad848db72e0d01e449a957bc47da6f0051bee (diff)
downloadydb-8f2bd4321c0db18b41461261f2f2ba3434e32e44.tar.gz
RateLimiter should have access to all attributes on the schema. KIKIMR-14262
ref:3ee5e8f5b826aae93a4102fa35649d0a9f9ac5c4
-rw-r--r--ydb/core/grpc_services/grpc_request_check_actor.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/ydb/core/grpc_services/grpc_request_check_actor.h b/ydb/core/grpc_services/grpc_request_check_actor.h
index d4bef15c09..04c72abe6d 100644
--- a/ydb/core/grpc_services/grpc_request_check_actor.h
+++ b/ydb/core/grpc_services/grpc_request_check_actor.h
@@ -159,12 +159,9 @@ public:
// No rate limit config for this request
return SetTokenAndDie(CheckedDatabaseName_);
} else {
- // TODO(xenoxeno): get rid of unnecessary hash map
THashMap<TString, TString> attributes;
- for (const auto& entry : TBase::GetEntries()) {
- for (const auto& [attrName, attrValue] : entry.Attributes) {
- attributes[attrName] = attrValue;
- }
+ for (const auto& [attrName, attrValue] : Attributes_) {
+ attributes[attrName] = attrValue;
}
return ProcessRateLimit(attributes, ctx);
}
@@ -400,11 +397,15 @@ private:
IRequestProxyCtx* GrpcRequestBaseCtx_;
NRpcService::TRlConfig* RlConfig = nullptr;
bool SkipCheckConnectRigths_ = false;
+ std::vector<std::pair<TString, TString>> Attributes_;
};
// default behavior - attributes in schema
template <typename TEvent>
void TGrpcRequestCheckActor<TEvent>::InitializeAttributes(const TSchemeBoardEvents::TDescribeSchemeResult& schemeData) {
+ for (const auto& attr : schemeData.GetPathDescription().GetUserAttributes()) {
+ Attributes_.emplace_back(std::make_pair(attr.GetKey(), attr.GetValue()));
+ }
InitializeAttributesFromSchema(schemeData);
}