Skip to content

Commit ca3bde3

Browse files
committed
Filled DatabaseName in SchemeCache requests P.2
1 parent 946dafd commit ca3bde3

File tree

16 files changed

+48
-21
lines changed

16 files changed

+48
-21
lines changed

ydb/core/fq/libs/actors/run_actor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,7 @@ class TRunActor : public NActors::TActorBootstrapped<TRunActor> {
930930
if (Params.Resources.rate_limiter_path()) {
931931
const TString rateLimiterResource = GetRateLimiterResourcePath(Params.CloudId, Params.Scope.ParseFolder(), Params.QueryId);
932932
for (auto& task : *ev->Get()->GraphParams.MutableTasks()) {
933+
task.SetRateLimiterDatabase(Params.TenantName);
933934
task.SetRateLimiter(Params.Resources.rate_limiter_path());
934935
task.SetRateLimiterResource(rateLimiterResource);
935936
}

ydb/core/grpc_services/rpc_rate_limiter_api.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,17 +621,20 @@ class TAcquireRateLimiterResourceRPC : public TRateLimiterRequest<TAcquireRateLi
621621

622622
void SendRequest() {
623623
UnsafeBecome(&TAcquireRateLimiterResourceRPC::StateFunc);
624+
const TString database = CanonizePath(Request().GetDatabaseName().GetOrElse(""));
624625

625626
if (GetProtoRequest()->units_case() == Ydb::RateLimiter::AcquireResourceRequest::UnitsCase::kRequired) {
626627
SendLeaf(
627-
TEvQuota::TResourceLeaf(GetProtoRequest()->coordination_node_path(),
628+
TEvQuota::TResourceLeaf(database,
629+
GetProtoRequest()->coordination_node_path(),
628630
GetProtoRequest()->resource_path(),
629631
GetProtoRequest()->required()));
630632
return;
631633
}
632634

633635
SendLeaf(
634-
TEvQuota::TResourceLeaf(GetProtoRequest()->coordination_node_path(),
636+
TEvQuota::TResourceLeaf(database,
637+
GetProtoRequest()->coordination_node_path(),
635638
GetProtoRequest()->resource_path(),
636639
GetProtoRequest()->used(),
637640
true));

ydb/core/kesus/proxy/events.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ struct TEvKesusProxy {
2828
"expected EvEnd <= EventSpaceEnd(TKikimrEvents::ES_KESUS_PROXY)");
2929

3030
struct TEvResolveKesusProxy : public TEventLocal<TEvResolveKesusProxy, EvResolveKesusProxy> {
31+
const TString Database;
3132
const TString KesusPath;
3233

33-
explicit TEvResolveKesusProxy(const TString& kesusPath)
34-
: KesusPath(kesusPath)
34+
TEvResolveKesusProxy(const TString& database, const TString& kesusPath)
35+
: Database(database)
36+
, KesusPath(kesusPath)
3537
{}
3638
};
3739

ydb/core/kesus/proxy/proxy.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class TKesusProxyService : public TActor<TKesusProxyService> {
7373
}
7474

7575
private:
76-
IActor* CreateResolveActor(const TString& kesusPath);
76+
IActor* CreateResolveActor(const TString& database, const TString& kesusPath);
7777

7878
void Handle(TEvKesusProxy::TEvResolveKesusProxy::TPtr& ev) {
7979
const auto* msg = ev->Get();
@@ -103,7 +103,7 @@ class TKesusProxyService : public TActor<TKesusProxyService> {
103103
// Recheck schemecache for changes
104104
LOG_TRACE_S(ctx, NKikimrServices::KESUS_PROXY,
105105
"Starting resolve for kesus " << msg->KesusPath.Quote());
106-
RegisterWithSameMailbox(CreateResolveActor(msg->KesusPath));
106+
RegisterWithSameMailbox(CreateResolveActor(msg->Database, msg->KesusPath));
107107
entry.State = CACHE_STATE_RESOLVING;
108108
[[fallthrough]];
109109

@@ -220,21 +220,25 @@ class TKesusProxyService : public TActor<TKesusProxyService> {
220220
class TKesusProxyService::TResolveActor : public TActorBootstrapped<TResolveActor> {
221221
private:
222222
const TActorId Owner;
223+
const TString Database;
223224
const TString KesusPath;
224225

225226
public:
226-
TResolveActor(const TActorId& owner, const TString& kesusPath)
227+
TResolveActor(const TActorId& owner, const TString& database, const TString& kesusPath)
227228
: Owner(owner)
229+
, Database(CanonizePath(database))
228230
, KesusPath(kesusPath)
229231
{}
230232

231233
void Bootstrap(const TActorContext& ctx) {
232234
LOG_TRACE_S(ctx, NKikimrServices::KESUS_PROXY,
233235
"Sending resolve request to SchemeCache: " << KesusPath.Quote());
234-
auto request = MakeHolder<NSchemeCache::TSchemeCacheNavigate>();
236+
auto request = MakeHolder<TSchemeCacheNavigate>();
237+
request->DatabaseName = Database;
238+
235239
auto& entry = request->ResultSet.emplace_back();
236240
entry.Path = SplitPath(KesusPath);
237-
entry.Operation = NSchemeCache::TSchemeCacheNavigate::OpPath;
241+
entry.Operation = TSchemeCacheNavigate::OpPath;
238242
Send(MakeSchemeCacheID(), new TEvTxProxySchemeCache::TEvNavigateKeySet(request.Release()));
239243
Become(&TThis::StateWork);
240244
}
@@ -262,8 +266,8 @@ class TKesusProxyService::TResolveActor : public TActorBootstrapped<TResolveActo
262266
}
263267
};
264268

265-
IActor* TKesusProxyService::CreateResolveActor(const TString& kesusPath) {
266-
return new TResolveActor(SelfId(), kesusPath);
269+
IActor* TKesusProxyService::CreateResolveActor(const TString& database, const TString& kesusPath) {
270+
return new TResolveActor(SelfId(), database, kesusPath);
267271
}
268272

269273
TActorId MakeKesusProxyServiceId() {

ydb/core/persqueue/pqtablet/partition/account_read_quoter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void TBasicAccountQuoter::HandleQuotaConsumed(NAccountQuoterEvents::TEvConsumed:
102102
TThis::Send(MakeQuoterServiceID(),
103103
new TEvQuota::TEvRequest(
104104
TEvQuota::EResourceOperator::And,
105-
{ TEvQuota::TResourceLeaf(KesusPath, ResourcePath, ConsumedBytesInCredit) },
105+
{ TEvQuota::TResourceLeaf(KesusPath, KesusPath, ResourcePath, ConsumedBytesInCredit) },
106106
TDuration::Max()),
107107
0,
108108
++CurrentQuotaRequestCookie

ydb/core/quoter/public/quoter.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ struct TEvQuota {
4141

4242
const ui64 QuoterId;
4343
const ui64 ResourceId;
44+
const TString Database;
4445
const TString Quoter;
4546
const TString Resource;
4647

@@ -56,9 +57,10 @@ struct TEvQuota {
5657
, IsUsedAmount(isUsedAmount)
5758
{}
5859

59-
TResourceLeaf(const TString &quoter, const TString &resource, ui64 amount, bool isUsedAmount = false)
60+
TResourceLeaf(const TString& database, const TString &quoter, const TString &resource, ui64 amount, bool isUsedAmount = false)
6061
: QuoterId(0)
6162
, ResourceId(0)
63+
, Database(database)
6264
, Quoter(quoter)
6365
, Resource(resource)
6466
, Amount(amount)

ydb/core/quoter/quoter_service.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,8 @@ TQuoterService::EInitLeafStatus TQuoterService::InitResourceLeaf(const TEvQuota:
568568
Counters.ActiveQuoterProxies->Inc();
569569

570570
THolder<NSchemeCache::TSchemeCacheNavigate> req(new NSchemeCache::TSchemeCacheNavigate());
571+
req->DatabaseName = leaf.Database;
572+
571573
req->ResultSet.emplace_back();
572574
req->ResultSet.back().Path.swap(path);
573575
req->ResultSet.back().Operation = NSchemeCache::TSchemeCacheNavigate::OpPath;
@@ -1469,7 +1471,7 @@ TString TQuoterService::PrintEvent(const TEvQuota::TEvRequest::TPtr& ev) {
14691471
}
14701472
ret << " { " << leaf.Amount << ", ";
14711473
if (leaf.Quoter) {
1472-
ret << "\"" << leaf.Quoter << "\":\"" << leaf.Resource << "\"";
1474+
ret << "\"" << leaf.Database << "\":\"" << leaf.Quoter << "\":\"" << leaf.Resource << "\"";
14731475
} else {
14741476
ret << leaf.QuoterId << ":" << leaf.ResourceId;
14751477
}

ydb/core/quoter/quoter_service_bandwidth_test/quota_requester.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ TKesusQuotaRequester::TKesusQuotaRequester(const NKikimr::TOptions& opts, NKikim
9797

9898
THolder<TEvQuota::TEvRequest> TKesusQuotaRequester::MakeQuoterRequest() {
9999
TVector<TEvQuota::TResourceLeaf> reqs = {
100-
TEvQuota::TResourceLeaf(KesusPath, ResourcePath, 1.0)
100+
TEvQuota::TResourceLeaf(TTestServer::GetDomainPath(), KesusPath, ResourcePath, 1.0)
101101
};
102102
return MakeHolder<TEvQuota::TEvRequest>(TEvQuota::EResourceOperator::And, std::move(reqs), Opts.QuotaRequestDeadline);
103103
}

ydb/core/quoter/quoter_service_bandwidth_test/server.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ TTestServer::TTestServer(const TOptions &opts)
1919
RunServer();
2020
}
2121

22+
TString TTestServer::GetDomainPath() {
23+
return TStringBuilder() << "/" << Tests::TestDomainName;
24+
}
25+
2226
std::pair<TString, TString> TTestServer::GetKesusPathAndName(size_t i) {
2327
return {Tests::TestDomainName, TStringBuilder() << "Kesus_" << i};
2428
}

ydb/core/quoter/quoter_service_bandwidth_test/server.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class TTestServer {
2323

2424
void RunQuotaRequesters(TRequestStats& stats);
2525

26+
static TString GetDomainPath();
2627
static std::pair<TString, TString> GetKesusPathAndName(size_t i);
2728
static TString GetKesusPath(size_t i);
2829
static TString GetKesusResource(size_t i);

0 commit comments

Comments
 (0)