aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgvit <gvit@ydb.tech>2022-10-28 13:12:26 +0300
committergvit <gvit@ydb.tech>2022-10-28 13:12:26 +0300
commit15d014b82db58bc2964edbc39a38649dbc5b2d26 (patch)
tree4ac840b5b15f175a15621afd4db52c40db9b479e
parent8c22aef7c742fdb60b0391fced4ee92ecd061916 (diff)
downloadydb-15d014b82db58bc2964edbc39a38649dbc5b2d26.tar.gz
removing tenant pool status event usage
-rw-r--r--ydb/core/mind/tenant_node_enumeration.cpp48
-rw-r--r--ydb/core/sys_view/service/sysview_service.cpp33
2 files changed, 13 insertions, 68 deletions
diff --git a/ydb/core/mind/tenant_node_enumeration.cpp b/ydb/core/mind/tenant_node_enumeration.cpp
index 15ecddceb2..e40380a925 100644
--- a/ydb/core/mind/tenant_node_enumeration.cpp
+++ b/ydb/core/mind/tenant_node_enumeration.cpp
@@ -1,5 +1,5 @@
#include "tenant_node_enumeration.h"
-#include "tenant_pool.h"
+#include <ydb/core/base/path.h>
#include <ydb/core/base/appdata.h>
#include <ydb/core/base/statestorage.h>
#include <ydb/core/base/path.h>
@@ -24,37 +24,15 @@ static ui32 ExtractDefaultGroupForPath(const TString &path) {
}
class TTenantNodeEnumerationPublisher : public TActorBootstrapped<TTenantNodeEnumerationPublisher> {
- TMap<TString, TActorId> PublishActors;
-
- void Handle(TEvTenantPool::TEvTenantPoolStatus::TPtr &ev) {
- const auto &record = ev->Get()->Record;
-
- TMap<TString, TActorId> toRemove;
- toRemove.swap(PublishActors);
-
- for (auto &x : record.GetSlots()) {
- if (const TString &assigned = x.GetAssignedTenant()) {
- auto it = toRemove.find(assigned);
- if (it != toRemove.end()) {
- PublishActors.emplace(*it);
- toRemove.erase(it);
- } else {
- const TString assignedPath = MakeTenantNodeEnumerationPath(assigned);
- const ui32 statestorageGroupId = ExtractDefaultGroupForPath(assigned);
- if (statestorageGroupId == Max<ui32>())
- continue;
-
- const TActorId publishActor = Register(CreateBoardPublishActor(assignedPath, TString(), SelfId(), statestorageGroupId, 0, true));
-
- PublishActors.emplace(assigned, publishActor);
- }
- }
- }
+ void StartPublishing() {
+ const TString assignedPath = MakeTenantNodeEnumerationPath(AppData()->TenantName);
+ const ui32 statestorageGroupId = ExtractDefaultGroupForPath(AppData()->TenantName);
+ if (statestorageGroupId == Max<ui32>())
+ return;
- for (auto &xpair : toRemove) {
- Send(xpair.second, new TEvents::TEvPoisonPill());
- }
+ Register(CreateBoardPublishActor(assignedPath, TString(), SelfId(), statestorageGroupId, 0, true));
}
+
public:
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::TENANT_NODES_ENUMERATION;
@@ -64,14 +42,8 @@ public:
{}
void Bootstrap() {
- Send(MakeTenantPoolRootID(), new TEvents::TEvSubscribe());
- Become(&TThis::StateWait);
- }
-
- STATEFN(StateWait) {
- switch (ev->GetTypeRewrite()) {
- hFunc(TEvTenantPool::TEvTenantPoolStatus, Handle);
- }
+ StartPublishing();
+ PassAway();
}
};
diff --git a/ydb/core/sys_view/service/sysview_service.cpp b/ydb/core/sys_view/service/sysview_service.cpp
index 0055425928..92e826cd7f 100644
--- a/ydb/core/sys_view/service/sysview_service.cpp
+++ b/ydb/core/sys_view/service/sysview_service.cpp
@@ -5,10 +5,10 @@
#include <ydb/core/sys_view/common/common.h>
#include <ydb/core/sys_view/common/events.h>
+#include <ydb/core/base/path.h>
#include <ydb/core/base/appdata.h>
#include <ydb/core/base/tablet_pipecache.h>
#include <ydb/core/tx/scheme_cache/scheme_cache.h>
-#include <ydb/core/mind/tenant_pool.h>
#include <library/cpp/actors/core/actor_bootstrapped.h>
#include <library/cpp/actors/core/hfunc.h>
@@ -346,8 +346,6 @@ public:
TopByRequestUnits1Hour = MakeHolder<TServiceQueryHistory<TRequestUnitsGreater>>(
ONE_HOUR_BUCKET_COUNT, ONE_HOUR_BUCKET_SIZE, now);
- ctx.Send(MakeTenantPoolRootID(), new TEvents::TEvSubscribe());
-
ScanLimiter = MakeIntrusive<TScanLimiter>(ConcurrentScansLimit);
if (AppData()->FeatureFlags.GetEnablePersistentQueryStats()) {
@@ -375,7 +373,6 @@ public:
STFUNC(StateWork) {
Y_UNUSED(ctx);
switch(ev->GetTypeRewrite()) {
- hFunc(TEvTenantPool::TEvTenantPoolStatus, Handle);
hFunc(TEvSysView::TEvCollectQueryStats, Handle);
hFunc(TEvSysView::TEvGetQueryStats, Handle);
hFunc(TEvSysView::TEvGetScanLimiter, Handle);
@@ -908,26 +905,6 @@ private:
}
}
- void Handle(TEvTenantPool::TEvTenantPoolStatus::TPtr &ev) {
- auto& record = ev->Get()->Record;
- SVLOG_D("Handle TEvTenantPool::TEvTenantPoolStatus: service id# " << SelfId());
-
- Tenants.clear();
- for (auto& slot : record.GetSlots()) {
- Tenants.insert(slot.GetAssignedTenant());
- }
- HasTenants = true;
-
- TopByDuration1Minute->Clear();
- TopByDuration1Hour->Clear();
- TopByReadBytes1Minute->Clear();
- TopByReadBytes1Hour->Clear();
- TopByCpuTime1Minute->Clear();
- TopByCpuTime1Hour->Clear();
- TopByRequestUnits1Minute->Clear();
- TopByRequestUnits1Hour->Clear();
- }
-
void Handle(TEvSysView::TEvCollectQueryStats::TPtr& ev) {
const auto& database = ev->Get()->Database;
@@ -982,9 +959,8 @@ private:
startBucket = record.GetStartBucket();
}
- if (!HasTenants ||
- !record.HasTenantName() ||
- !Tenants.contains(record.GetTenantName()))
+ if (!record.HasTenantName() ||
+ record.GetTenantName() != AppData()->TenantName)
{
Send(ev->Sender, std::move(result), 0, ev->Cookie);
return;
@@ -1111,9 +1087,6 @@ private:
THolder<TServiceQueryHistory<TRequestUnitsGreater>> TopByRequestUnits1Minute;
THolder<TServiceQueryHistory<TRequestUnitsGreater>> TopByRequestUnits1Hour;
- bool HasTenants = false;
- THashSet<TString> Tenants;
-
struct TDbCountersState {
TIntrusivePtr<IDbCounters> Counters;
NKikimr::NSysView::TDbServiceCounters Current;