@@ -22,6 +22,8 @@ class TJsonTenantInfo : public TViewerPipeClient {
22
22
std::optional<TRequestResponse<NConsole::TEvConsole::TEvListTenantsResponse>> ListTenantsResponse;
23
23
std::unordered_map<TString, TRequestResponse<NConsole::TEvConsole::TEvGetTenantStatusResponse>> TenantStatusResponses;
24
24
std::unordered_map<TString, TRequestResponse<TEvTxProxySchemeCache::TEvNavigateKeySetResult>> NavigateKeySetResult;
25
+ std::unordered_map<TString, TRequestResponse<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>> DescribeSchemeResult;
26
+ std::unordered_map<TTabletId, std::vector<TString>> DescribesBySchemeShard;
25
27
std::unordered_map<TTabletId, TRequestResponse<TEvHive::TEvResponseHiveDomainStats>> HiveDomainStats;
26
28
std::unordered_map<TTabletId, TRequestResponse<TEvHive::TEvResponseHiveStorageStats>> HiveStorageStats;
27
29
std::unordered_map<TNodeId, TRequestResponse<TEvWhiteboard::TEvSystemStateResponse>> SystemStateResponse;
@@ -52,6 +54,7 @@ class TJsonTenantInfo : public TViewerPipeClient {
52
54
bool MetadataCache = true ;
53
55
THashMap<TString, std::vector<TNodeId>> TenantNodes;
54
56
TTabletId RootHiveId = 0 ;
57
+ TTabletId RootSchemeShardId = 0 ;
55
58
TString RootId; // id of root domain (tenant)
56
59
NKikimrViewer::TTenantInfo Result;
57
60
@@ -97,6 +100,15 @@ class TJsonTenantInfo : public TViewerPipeClient {
97
100
}
98
101
}
99
102
103
+ TRequestResponse<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> MakeRequestSchemeShardDescribe (TTabletId schemeShardId, const TString& path) {
104
+ NKikimrSchemeOp::TDescribeOptions options;
105
+ options.SetReturnPartitioningInfo (false );
106
+ options.SetReturnPartitionConfig (false );
107
+ options.SetReturnChildren (false );
108
+ options.SetReturnRangeKey (false );
109
+ return TBase::MakeRequestSchemeShardDescribe (schemeShardId, path, options);
110
+ }
111
+
100
112
void Bootstrap () override {
101
113
if (NeedToRedirect ()) {
102
114
return ;
@@ -120,6 +132,7 @@ class TJsonTenantInfo : public TViewerPipeClient {
120
132
TIntrusivePtr<TDomainsInfo> domains = AppData ()->DomainsInfo ;
121
133
auto * domain = domains->GetDomain ();
122
134
DomainPath = " /" + domain->Name ;
135
+ RootSchemeShardId = domain->SchemeRoot ;
123
136
TPathId rootPathId (domain->SchemeRoot , 1 );
124
137
RootId = GetDomainId (rootPathId);
125
138
RootHiveId = domains->GetHive ();
@@ -146,6 +159,8 @@ class TJsonTenantInfo : public TViewerPipeClient {
146
159
HiveDomainStats[RootHiveId] = MakeRequestHiveDomainStats (RootHiveId);
147
160
if (Storage) {
148
161
HiveStorageStats[RootHiveId] = MakeRequestHiveStorageStats (RootHiveId);
162
+ DescribeSchemeResult[DomainPath] = MakeRequestSchemeShardDescribe (RootSchemeShardId, DomainPath);
163
+ DescribesBySchemeShard[RootSchemeShardId].emplace_back (DomainPath);
149
164
}
150
165
151
166
Become (&TThis::StateCollectingInfo, TDuration::MilliSeconds (Timeout), new TEvents::TEvWakeup ());
@@ -175,6 +190,7 @@ class TJsonTenantInfo : public TViewerPipeClient {
175
190
hFunc (TEvTabletPipe::TEvClientConnected, Handle );
176
191
hFunc (TEvStateStorage::TEvBoardInfo, Handle );
177
192
hFunc (NHealthCheck::TEvSelfCheckResultProto, Handle );
193
+ hFunc (TEvSchemeShard::TEvDescribeSchemeResult, Handle );
178
194
cFunc (TEvents::TSystem::Wakeup, HandleTimeout);
179
195
}
180
196
}
@@ -202,6 +218,12 @@ class TJsonTenantInfo : public TViewerPipeClient {
202
218
it->second .Error (error);
203
219
}
204
220
}
221
+ auto itDescribes = DescribesBySchemeShard.find (ev->Get ()->TabletId );
222
+ if (itDescribes != DescribesBySchemeShard.end ()) {
223
+ for (const TString& path : itDescribes->second ) {
224
+ DescribeSchemeResult[path].Error (error);
225
+ }
226
+ }
205
227
}
206
228
TBase::Handle (ev); // all RequestDone() are handled by base handler
207
229
}
@@ -397,14 +419,19 @@ class TJsonTenantInfo : public TViewerPipeClient {
397
419
if (result.IsOk ()) {
398
420
auto domainInfo = result.Get ()->Request ->ResultSet .begin ()->DomainInfo ;
399
421
TTabletId hiveId = domainInfo->Params .GetHive ();
422
+ TTabletId schemeShardId = domainInfo->Params .GetSchemeShard ();
400
423
if (hiveId) {
401
424
if (HiveDomainStats.count (hiveId) == 0 ) {
402
425
HiveDomainStats[hiveId] = MakeRequestHiveDomainStats (hiveId);
403
426
}
404
- if (Storage) {
405
- if (HiveStorageStats.count (hiveId) == 0 ) {
406
- HiveStorageStats[hiveId] = MakeRequestHiveStorageStats (hiveId);
407
- }
427
+ }
428
+ if (Storage) {
429
+ if (hiveId && HiveStorageStats.count (hiveId) == 0 ) {
430
+ HiveStorageStats[hiveId] = MakeRequestHiveStorageStats (hiveId);
431
+ }
432
+ if (schemeShardId && DescribeSchemeResult.count (path) == 0 ) {
433
+ DescribeSchemeResult[path] = MakeRequestSchemeShardDescribe (schemeShardId, path);
434
+ DescribesBySchemeShard[schemeShardId].emplace_back (path);
408
435
}
409
436
}
410
437
NKikimrViewer::TTenant& tenant = TenantBySubDomainKey[domainInfo->DomainKey ];
@@ -424,6 +451,13 @@ class TJsonTenantInfo : public TViewerPipeClient {
424
451
}
425
452
}
426
453
454
+ void Handle (NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
455
+ TString path = ev->Get ()->GetRecord ().GetPath ();
456
+ if (DescribeSchemeResult[path].Set (std::move (ev))) {
457
+ RequestDone ();
458
+ }
459
+ }
460
+
427
461
void Handle (NNodeWhiteboard::TEvWhiteboard::TEvSystemStateResponse::TPtr& ev) {
428
462
ui32 nodeId = ev.Get ()->Cookie ;
429
463
if (SystemStateResponse[nodeId].Set (std::move (ev))) {
@@ -745,7 +779,6 @@ class TJsonTenantInfo : public TViewerPipeClient {
745
779
}
746
780
}
747
781
748
- THashMap<NKikimrViewer::TStorageUsage::EType, ui64> tablesStorageByType;
749
782
THashMap<NKikimrViewer::TStorageUsage::EType, TStorageQuota> storageQuotasByType;
750
783
751
784
for (const auto & quota : tenant.GetDatabaseQuotas ().storage_quotas ()) {
@@ -755,42 +788,47 @@ class TJsonTenantInfo : public TViewerPipeClient {
755
788
usage.HardQuota += quota.data_size_hard_quota ();
756
789
}
757
790
758
- if (entry.DomainDescription ) {
759
- for (const auto & poolUsage : entry.DomainDescription ->Description .GetDiskSpaceUsage ().GetStoragePoolsUsage ()) {
791
+ auto itDescribeScheme = DescribeSchemeResult.find (name);
792
+ if (itDescribeScheme != DescribeSchemeResult.end () && itDescribeScheme->second .IsOk ()) {
793
+ const auto & record = itDescribeScheme->second .Get ()->GetRecord ();
794
+ const auto & domainDescription (record.GetPathDescription ().GetDomainDescription ());
795
+ THashMap<NKikimrViewer::TStorageUsage::EType, ui64> tablesStorageByType;
796
+
797
+ for (const auto & poolUsage : domainDescription.GetDiskSpaceUsage ().GetStoragePoolsUsage ()) {
760
798
auto type = GetStorageType (poolUsage.GetPoolKind ());
761
799
tablesStorageByType[type] += poolUsage.GetTotalSize ();
762
800
}
763
801
764
- if (tablesStorageByType.empty () && entry. DomainDescription -> Description .HasDiskSpaceUsage ()) {
765
- tablesStorageByType[GuessStorageType (entry. DomainDescription -> Description )] =
766
- entry. DomainDescription -> Description .GetDiskSpaceUsage ().GetTables ().GetTotalSize ()
767
- + entry. DomainDescription -> Description .GetDiskSpaceUsage ().GetTopics ().GetDataSize ();
802
+ if (tablesStorageByType.empty () && domainDescription .HasDiskSpaceUsage ()) {
803
+ tablesStorageByType[GuessStorageType (domainDescription )] =
804
+ domainDescription .GetDiskSpaceUsage ().GetTables ().GetTotalSize ()
805
+ + domainDescription .GetDiskSpaceUsage ().GetTopics ().GetDataSize ();
768
806
}
769
807
770
808
if (storageQuotasByType.empty ()) {
771
- auto & quotas = storageQuotasByType[GuessStorageType (entry. DomainDescription -> Description )];
772
- quotas.HardQuota = entry. DomainDescription -> Description .GetDatabaseQuotas ().data_size_hard_quota ();
773
- quotas.SoftQuota = entry. DomainDescription -> Description .GetDatabaseQuotas ().data_size_soft_quota ();
809
+ auto & quotas = storageQuotasByType[GuessStorageType (domainDescription )];
810
+ quotas.HardQuota = domainDescription .GetDatabaseQuotas ().data_size_hard_quota ();
811
+ quotas.SoftQuota = domainDescription .GetDatabaseQuotas ().data_size_soft_quota ();
774
812
}
775
- }
776
813
777
- for (const auto & [type, size] : tablesStorageByType) {
778
- auto it = storageQuotasByType.find (type);
779
- auto & tablesStorage = *tenant.AddTablesStorage ();
780
- tablesStorage.SetType (type);
781
- tablesStorage.SetSize (size);
782
- if (it != storageQuotasByType.end ()) {
783
- tablesStorage.SetLimit (it->second .SoftQuota );
784
- tablesStorage.SetSoftQuota (it->second .SoftQuota );
785
- tablesStorage.SetHardQuota (it->second .HardQuota );
814
+ for (const auto & [type, size] : tablesStorageByType) {
815
+ auto it = storageQuotasByType.find (type);
816
+ auto & tablesStorage = *tenant.AddTablesStorage ();
817
+ tablesStorage.SetType (type);
818
+ tablesStorage.SetSize (size);
819
+ if (it != storageQuotasByType.end ()) {
820
+ tablesStorage.SetLimit (it->second .SoftQuota );
821
+ tablesStorage.SetSoftQuota (it->second .SoftQuota );
822
+ tablesStorage.SetHardQuota (it->second .HardQuota );
823
+ }
786
824
}
787
- }
788
825
789
- for (const auto & [type, pr] : databaseStorageByType) {
790
- auto & databaseStorage = *tenant.AddDatabaseStorage ();
791
- databaseStorage.SetType (type);
792
- databaseStorage.SetSize (pr.first );
793
- databaseStorage.SetLimit (pr.first + pr.second );
826
+ for (const auto & [type, pr] : databaseStorageByType) {
827
+ auto & databaseStorage = *tenant.AddDatabaseStorage ();
828
+ databaseStorage.SetType (type);
829
+ databaseStorage.SetSize (pr.first );
830
+ databaseStorage.SetLimit (pr.first + pr.second );
831
+ }
794
832
}
795
833
}
796
834
0 commit comments