@@ -46,9 +46,11 @@ class TJsonTenantInfo : public TViewerPipeClient {
46
46
THashMap<TString, std::vector<TNodeId>> TenantNodes;
47
47
THashMap<TString, NKikimrViewer::TEvViewerResponse> OffloadMergedTabletStateResponse;
48
48
THashMap<TString, NKikimrViewer::TEvViewerResponse> OffloadMergedSystemStateResponse;
49
+ THashMap<TString, NKikimrViewer::TStorageUsage::EType> StoragePoolType;
49
50
TTabletId RootHiveId = 0 ;
50
51
TString RootId; // id of root domain (tenant)
51
52
NKikimrViewer::TTenantInfo Result;
53
+ std::optional<TRequestResponse<NSysView::TEvSysView::TEvGetStoragePoolsResponse>> GetStoragePoolsResponse;
52
54
53
55
struct TStorageQuota {
54
56
uint64 SoftQuota = 0 ;
@@ -87,6 +89,7 @@ class TJsonTenantInfo : public TViewerPipeClient {
87
89
}
88
90
89
91
void Bootstrap () override {
92
+ Cerr << " iiiiiiii Bootstrap " << Endl;
90
93
BLOG_TRACE (" Bootstrap()" );
91
94
const auto & params (Event->Get ()->Request .GetParams ());
92
95
JsonSettings.EnumAsNumbers = !FromStringWithDefault<bool >(params.Get (" enums" ), true );
@@ -124,6 +127,7 @@ class TJsonTenantInfo : public TViewerPipeClient {
124
127
if (Storage) {
125
128
RequestHiveStorageStats (RootHiveId);
126
129
}
130
+ GetStoragePoolsResponse = RequestBSControllerPools ();
127
131
128
132
if (Requests == 0 ) {
129
133
ReplyAndPassAway ();
@@ -154,9 +158,10 @@ class TJsonTenantInfo : public TViewerPipeClient {
154
158
hFunc (TEvViewer::TEvViewerResponse, Handle );
155
159
hFunc (TEvents::TEvUndelivered, Undelivered);
156
160
hFunc (TEvInterconnect::TEvNodeDisconnected, Disconnected);
157
- hFunc (TEvTabletPipe::TEvClientConnected, TBase:: Handle );
161
+ hFunc (TEvTabletPipe::TEvClientConnected, Handle );
158
162
hFunc (TEvStateStorage::TEvBoardInfo, Handle );
159
163
hFunc (NHealthCheck::TEvSelfCheckResultProto, Handle );
164
+ hFunc (NSysView::TEvSysView::TEvGetStoragePoolsResponse, Handle );
160
165
cFunc (TEvents::TSystem::Wakeup, HandleTimeout);
161
166
}
162
167
}
@@ -534,7 +539,32 @@ class TJsonTenantInfo : public TViewerPipeClient {
534
539
return type;
535
540
}
536
541
542
+ void Handle (TEvTabletPipe::TEvClientConnected::TPtr& ev) {
543
+ if (ev->Get ()->Status != NKikimrProto::OK) {
544
+ TString error = TStringBuilder () << " Failed to establish pipe: " << NKikimrProto::EReplyStatus_Name (ev->Get ()->Status );
545
+ if (ev->Get ()->TabletId == GetBSControllerId ()) {
546
+ if (GetStoragePoolsResponse.has_value ()) {
547
+ GetStoragePoolsResponse->Error (error);
548
+ }
549
+ }
550
+ }
551
+ TBase::Handle (ev); // all RequestDone() are handled by base handler
552
+ }
553
+
554
+ void Handle (NSysView::TEvSysView::TEvGetStoragePoolsResponse::TPtr& ev) {
555
+ GetStoragePoolsResponse->Set (std::move (ev));
556
+
557
+ if (GetStoragePoolsResponse && GetStoragePoolsResponse->IsOk ()) {
558
+ for (const NKikimrSysView::TStoragePoolEntry& entry : GetStoragePoolsResponse->Get ()->Record .GetEntries ()) {
559
+ StoragePoolType[entry.GetInfo ().GetName ()] = GetStorageType (entry.GetInfo ().GetKind ());
560
+ }
561
+ }
562
+
563
+ RequestDone ();
564
+ }
565
+
537
566
void ReplyAndPassAway () override {
567
+ Cerr << " iiiiiiii ReplyAndPassAway " << Endl;
538
568
BLOG_TRACE (" ReplyAndPassAway() started" );
539
569
TIntrusivePtr<TDomainsInfo> domains = AppData ()->DomainsInfo ;
540
570
auto *domain = domains->GetDomain ();
@@ -666,6 +696,7 @@ class TJsonTenantInfo : public TViewerPipeClient {
666
696
}
667
697
668
698
if (Storage) {
699
+ THashMap<NKikimrViewer::TStorageUsage::EType, ui64> blobStorageByType;
669
700
auto itHiveStorageStats = HiveStorageStats.find (hiveId);
670
701
if (itHiveStorageStats != HiveStorageStats.end ()) {
671
702
const NKikimrHive::TEvResponseHiveStorageStats& record = itHiveStorageStats->second .Get ()->Record ;
@@ -675,9 +706,13 @@ class TJsonTenantInfo : public TViewerPipeClient {
675
706
uint64 storageGroups = 0 ;
676
707
for (const NKikimrHive::THiveStoragePoolStats& poolStat : record.GetPools ()) {
677
708
if (poolStat.GetName ().StartsWith (tenantBySubDomainKey.GetName ())) {
709
+ Cerr << " iiiiiiii PoolStat: " << poolStat.GetName () << Endl;
710
+ NKikimrViewer::TStorageUsage::EType storageType = GetStorageType (poolStat.GetName ());
678
711
for (const NKikimrHive::THiveStorageGroupStats& groupStat : poolStat.GetGroups ()) {
679
712
storageAllocatedSize += groupStat.GetAllocatedSize ();
680
713
storageAvailableSize += groupStat.GetAvailableSize ();
714
+ blobStorageByType[storageType] += groupStat.GetAllocatedSize ();
715
+ blobStorageByType[storageType] += groupStat.GetAvailableSize ();
681
716
storageMinAvailableSize = std::min (storageMinAvailableSize, groupStat.GetAvailableSize ());
682
717
++storageGroups;
683
718
}
@@ -729,6 +764,12 @@ class TJsonTenantInfo : public TViewerPipeClient {
729
764
storageUsage.SetHardQuota (it->second .HardQuota );
730
765
}
731
766
}
767
+
768
+ for (const auto & [type, size] : blobStorageByType) {
769
+ auto & blobStorage = *tenant.AddBlobStorage ();
770
+ blobStorage.SetType (type);
771
+ blobStorage.SetSize (size);
772
+ }
732
773
}
733
774
734
775
THashSet<TNodeId> tenantNodes;
0 commit comments