@@ -219,21 +219,20 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
219
219
};
220
220
221
221
struct TStoragePoolState {
222
- TString Kind ;
222
+ TString Name ;
223
223
THashSet<TGroupId> Groups;
224
- THashSet<TGroupId> AuthenticGroups;
225
224
};
226
225
227
226
struct TDatabaseState {
228
227
TTabletId HiveId = {};
229
228
TPathId ResourcePathId = {};
230
229
TVector<TNodeId> ComputeNodeIds;
231
- THashSet<TString> StoragePoolNames ;
230
+ THashSet<ui64> StoragePools ;
232
231
THashMap<std::pair<TTabletId, NNodeWhiteboard::TFollowerId>, const NKikimrHive::TTabletInfo*> MergedTabletState;
233
232
THashMap<TNodeId, TNodeTabletState> MergedNodeTabletState;
234
233
THashMap<TNodeId, ui32> NodeRestartsPerPeriod;
235
- ui64 StorageQuota;
236
- ui64 StorageUsage;
234
+ ui64 StorageQuota = 0 ;
235
+ ui64 StorageUsage = 0 ;
237
236
TMaybeServerlessComputeResourcesMode ServerlessComputeResourcesMode;
238
237
};
239
238
@@ -431,6 +430,7 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
431
430
TTabletId RootHiveId;
432
431
THashMap<TString, TTenantInfo> TenantByPath;
433
432
THashMap<TString, THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>> DescribeByPath;
433
+ THashMap<TString, THashSet<TString>> PathsByPoolName;
434
434
THashMap<TString, Ydb::Cms::GetDatabaseStatusResult> DatabaseStatusByPath;
435
435
THashMap<TString, THolder<NTenantSlotBroker::TEvTenantSlotBroker::TEvTenantState>> TenantStateByPath;
436
436
THashMap<TString, THolder<NSchemeCache::TSchemeCacheNavigate>> NavigateResult;
@@ -442,7 +442,6 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
442
442
THolder<TEvBlobStorage::TEvControllerConfigResponse> BaseConfig;
443
443
444
444
THashSet<TNodeId> NodeIds;
445
- THashSet<TNodeId> StorageNodeIds;
446
445
THashSet<TNodeId> ComputeNodeIds;
447
446
std::unordered_map<std::pair<TNodeId, int >, ui32> NodeRetries;
448
447
ui32 MaxRetries = 20 ;
@@ -463,8 +462,8 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
463
462
std::unordered_set<TString> ValidPDisks;
464
463
std::unordered_set<TGroupId> ValidGroups;
465
464
466
- THashMap<TString , TStoragePoolState> StoragePoolState;
467
- THashSet<TString > StoragePoolSeen;
465
+ THashMap<ui64 , TStoragePoolState> StoragePoolState;
466
+ THashSet<ui64 > StoragePoolSeen;
468
467
469
468
THashSet<TNodeId> UnavailableComputeNodes;
470
469
@@ -585,37 +584,10 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
585
584
586
585
Send (GetNameserviceActorId (), new TEvInterconnect::TEvListNodes ());
587
586
++Requests;
588
- Send (MakeBlobStorageNodeWardenID (SelfId ().NodeId ()), new TEvNodeWardenQueryStorageConfig (false ));
589
- ++Requests;
590
587
591
588
Become (&TThis::StateWait, Timeout, new TEvents::TEvWakeup ());
592
589
}
593
590
594
- void Handle (TEvNodeWardenStorageConfig::TPtr ev) {
595
- if (const NKikimrBlobStorage::TStorageConfig& config = *ev->Get ()->Config ; config.HasBlobStorageConfig ()) {
596
- if (const auto & bsConfig = config.GetBlobStorageConfig (); bsConfig.HasServiceSet ()) {
597
- const auto & staticConfig = bsConfig.GetServiceSet ();
598
- for (const NKikimrBlobStorage::TNodeWardenServiceSet_TPDisk& pDisk : staticConfig.pdisks ()) {
599
- RequestStorageNode (pDisk.GetNodeID ());
600
- }
601
- for (const NKikimrBlobStorage::TGroupInfo& group : staticConfig.groups ()) {
602
- ValidGroups.emplace (group.GetGroupID ());
603
- TString storagePoolName = group.GetStoragePoolName ();
604
- if (!storagePoolName) {
605
- storagePoolName = STATIC_STORAGE_POOL_NAME;
606
- }
607
- StoragePoolState[storagePoolName].Groups .emplace (group.groupid ());
608
-
609
- if (!IsSpecificDatabaseFilter ()) {
610
- DatabaseState[DomainPath].StoragePoolNames .emplace (storagePoolName);
611
- }
612
- }
613
- }
614
- }
615
-
616
- RequestDone (" TEvNodeWardenStorageConfig" );
617
- }
618
-
619
591
STATEFN (StateWait) {
620
592
switch (ev->GetTypeRewrite ()) {
621
593
hFunc (TEvents::TEvUndelivered, Handle );
@@ -627,15 +599,13 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
627
599
hFunc (TEvHive::TEvResponseHiveInfo, Handle );
628
600
hFunc (NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle );
629
601
hFunc (TEvTxProxySchemeCache::TEvNavigateKeySetResult, Handle )
630
- hFunc (TEvBlobStorage::TEvControllerSelectGroupsResult, Handle );
631
602
hFunc (TEvBlobStorage::TEvControllerConfigResponse, Handle );
632
603
hFunc (NNodeWhiteboard::TEvWhiteboard::TEvSystemStateResponse, Handle );
633
604
hFunc (TEvInterconnect::TEvNodeDisconnected, Disconnected);
634
605
hFunc (TEvTabletPipe::TEvClientDestroyed, Handle );
635
606
hFunc (TEvTabletPipe::TEvClientConnected, Handle );
636
607
hFunc (TEvPrivate::TEvRetryNodeWhiteboard, Handle );
637
608
cFunc (TEvents::TSystem::Wakeup, HandleTimeout);
638
- hFunc (TEvNodeWardenStorageConfig, Handle );
639
609
}
640
610
}
641
611
@@ -702,16 +672,10 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
702
672
RequestTabletPipe (ConsoleId, " TEvListTenantsRequest" , request.Release ());
703
673
}
704
674
705
- void RequestSelectGroups (const TString& storagePoolName) {
706
- THolder<TEvBlobStorage::TEvControllerSelectGroups> request = MakeHolder<TEvBlobStorage::TEvControllerSelectGroups>();
707
- request->Record .SetReturnAllMatchingGroups (true );
708
- request->Record .AddGroupParameters ()->MutableStoragePoolSpecifier ()->SetName (storagePoolName);
709
- RequestTabletPipe (BsControllerId, " TEvControllerSelectGroups:" + storagePoolName, request.Release ());
710
- }
711
-
712
675
void RequestConfig () {
713
676
THolder<TEvBlobStorage::TEvControllerConfigRequest> request = MakeHolder<TEvBlobStorage::TEvControllerConfigRequest>();
714
677
request->Record .MutableRequest ()->AddCommand ()->MutableQueryBaseConfig ();
678
+ request->Record .MutableRequest ()->AddCommand ()->MutableReadStoragePool ()->SetBoxId (Max<ui64>());
715
679
RequestTabletPipe (BsControllerId, " TEvControllerConfigRequest" , request.Release ());
716
680
}
717
681
@@ -758,12 +722,6 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
758
722
}
759
723
}
760
724
761
- void RequestStorageNode (TNodeId nodeId) {
762
- if (StorageNodeIds.emplace (nodeId).second ) {
763
- RequestGenericNode (nodeId);
764
- }
765
- }
766
-
767
725
void Handle (TEvPrivate::TEvRetryNodeWhiteboard::TPtr& ev) {
768
726
switch (ev->Get ()->EventId ) {
769
727
case NNodeWhiteboard::TEvWhiteboard::EvSystemStateRequest:
@@ -854,41 +812,24 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
854
812
if (pbRecord.HasResponse () && pbRecord.GetResponse ().StatusSize () > 0 ) {
855
813
const NKikimrBlobStorage::TConfigResponse::TStatus& pbStatus (pbRecord.GetResponse ().GetStatus (0 ));
856
814
if (pbStatus.HasBaseConfig ()) {
857
- const NKikimrBlobStorage::TBaseConfig& pbConfig (pbStatus.GetBaseConfig ());
858
- for (const NKikimrBlobStorage::TBaseConfig::TPDisk& pDisk : pbConfig.GetPDisk ()) {
859
- RequestStorageNode (pDisk.GetNodeId ());
860
- }
861
815
BaseConfig = ev->Release ();
862
816
}
863
817
}
864
818
RequestDone (" TEvControllerConfigResponse" );
865
819
}
866
820
867
- void Handle (TEvBlobStorage::TEvControllerSelectGroupsResult::TPtr& ev) {
868
- TabletRequests.CompleteRequest (ev->Cookie );
869
- for (const auto & matchingGroups : ev->Get ()->Record .matchinggroups ()) {
870
- for (const auto & group : matchingGroups.groups ()) {
871
- TString storagePoolName = group.storagepoolname ();
872
- StoragePoolState[storagePoolName].Groups .emplace (group.groupid ());
873
- StoragePoolState[storagePoolName].AuthenticGroups .emplace (group.groupid ());
874
- }
875
- }
876
- RequestDone (" TEvControllerSelectGroupsResult" );
877
- }
878
-
879
821
void Handle (NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
880
822
TabletRequests.CompleteRequest (ev->Cookie );
881
823
if (ev->Get ()->GetRecord ().status () == NKikimrScheme::StatusSuccess) {
882
824
TString path = ev->Get ()->GetRecord ().path ();
883
825
TDatabaseState& state (DatabaseState[path]);
884
826
for (const auto & storagePool : ev->Get ()->GetRecord ().pathdescription ().domaindescription ().storagepools ()) {
885
827
TString storagePoolName = storagePool.name ();
886
- state.StoragePoolNames .emplace (storagePoolName);
887
- StoragePoolState[storagePoolName].Kind = storagePool.kind ();
888
- RequestSelectGroups (storagePoolName);
828
+ PathsByPoolName[storagePoolName].emplace (path); // no poolId in TEvDescribeSchemeResult, so it's neccesary to keep poolNames instead
889
829
}
890
830
if (path == DomainPath) {
891
- state.StoragePoolNames .emplace (STATIC_STORAGE_POOL_NAME);
831
+ state.StoragePools .emplace (0 ); // static group has poolId = 0
832
+ StoragePoolState[0 ].Name = STATIC_STORAGE_POOL_NAME;
892
833
}
893
834
state.StorageUsage = ev->Get ()->GetRecord ().pathdescription ().domaindescription ().diskspaceusage ().tables ().totalsize ();
894
835
state.StorageQuota = ev->Get ()->GetRecord ().pathdescription ().domaindescription ().databasequotas ().data_size_hard_quota ();
@@ -1106,14 +1047,26 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
1106
1047
}
1107
1048
for (const NKikimrBlobStorage::TBaseConfig::TGroup& group : pbConfig.GetGroup ()) {
1108
1049
auto groupId = group.GetGroupId ();
1050
+ auto poolId = group.GetStoragePoolId ();
1109
1051
ValidGroups.emplace (groupId);
1110
1052
BSConfigGroups.emplace (groupId, &group);
1053
+ StoragePoolState[poolId].Groups .emplace (group.groupid ());
1111
1054
}
1112
1055
for (const NKikimrBlobStorage::TBaseConfig::TNode& node : pbConfig.GetNode ()) {
1113
1056
auto nodeId = node.GetNodeId ();
1114
1057
BSConfigNodes.emplace (nodeId, &node);
1115
1058
}
1116
1059
}
1060
+ const NKikimrBlobStorage::TConfigResponse::TStatus& spStatus (pbRecord.GetResponse ().GetStatus (1 ));
1061
+ for (const NKikimrBlobStorage::TDefineStoragePool& pool : spStatus.GetStoragePool ()) { // there is no specific pool for static group here
1062
+ ui64 poolId = pool.GetStoragePoolId ();
1063
+ TString storagePoolName = pool.GetName ();
1064
+ StoragePoolState[poolId].Name = storagePoolName;
1065
+
1066
+ for (const TString& path : PathsByPoolName[storagePoolName]) {
1067
+ DatabaseState[path].StoragePools .emplace (poolId);
1068
+ }
1069
+ }
1117
1070
}
1118
1071
for (auto itPDisk = BSConfigPDisks.begin (); itPDisk != BSConfigPDisks.end ();) {
1119
1072
if (ValidPDisks.count (itPDisk->first )) {
@@ -1380,10 +1333,6 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
1380
1333
return TStringBuilder () << vSlot.vslotid ().nodeid () << " -" << vSlot.vslotid ().pdiskid ();
1381
1334
}
1382
1335
1383
- static TString GetPDiskId (const NKikimrBlobStorage::TNodeWardenServiceSet_TPDisk& pDisk) {
1384
- return TStringBuilder () << pDisk.nodeid () << " -" << pDisk.pdiskid ();
1385
- }
1386
-
1387
1336
void FillPDiskStatus (const TString& pDiskId, Ydb::Monitoring::StoragePDiskStatus& storagePDiskStatus, TSelfCheckContext context) {
1388
1337
context.Location .clear_database (); // PDisks are shared between databases
1389
1338
context.Location .mutable_storage ()->mutable_pool ()->clear_name (); // PDisks are shared between pools
@@ -1943,9 +1892,9 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
1943
1892
mergeContext.FillRecords (records);
1944
1893
}
1945
1894
1946
- void FillPoolStatus (const TString& poolName, const TStoragePoolState& pool, Ydb::Monitoring::StoragePoolStatus& storagePoolStatus, TSelfCheckContext context) {
1947
- context.Location .mutable_storage ()->mutable_pool ()->set_name (poolName );
1948
- storagePoolStatus.set_id (poolName );
1895
+ void FillPoolStatus (const TStoragePoolState& pool, Ydb::Monitoring::StoragePoolStatus& storagePoolStatus, TSelfCheckContext context) {
1896
+ context.Location .mutable_storage ()->mutable_pool ()->set_name (pool. Name );
1897
+ storagePoolStatus.set_id (pool. Name );
1949
1898
for (auto groupId : pool.Groups ) {
1950
1899
FillGroupStatus (groupId, *storagePoolStatus.add_groups (), {&context, " STORAGE_GROUP" });
1951
1900
}
@@ -1970,17 +1919,16 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
1970
1919
}
1971
1920
1972
1921
void FillStorage (TDatabaseState& databaseState, Ydb::Monitoring::StorageStatus& storageStatus, TSelfCheckContext context) {
1973
- if (databaseState.StoragePoolNames .empty ()) {
1922
+ if (!BaseConfig) {
1923
+ context.ReportStatus (Ydb::Monitoring::StatusFlag::RED, " System tablet BSC didn't provide information" , ETags::StorageState);
1924
+ } else if (databaseState.StoragePools .empty ()) {
1974
1925
context.ReportStatus (Ydb::Monitoring::StatusFlag::RED, " There are no storage pools" , ETags::StorageState);
1975
1926
} else {
1976
- for (const TString& poolName : databaseState.StoragePoolNames ) {
1977
- auto itStoragePoolState = StoragePoolState.find (poolName );
1927
+ for (const ui64 poolId : databaseState.StoragePools ) {
1928
+ auto itStoragePoolState = StoragePoolState.find (poolId );
1978
1929
if (itStoragePoolState != StoragePoolState.end ()) {
1979
- if (!itStoragePoolState->second .AuthenticGroups .empty ()) {
1980
- itStoragePoolState->second .Groups = itStoragePoolState->second .AuthenticGroups ;
1981
- }
1982
- FillPoolStatus (poolName, itStoragePoolState->second , *storageStatus.add_pools (), {&context, " STORAGE_POOL" });
1983
- StoragePoolSeen.emplace (poolName);
1930
+ FillPoolStatus (itStoragePoolState->second , *storageStatus.add_pools (), {&context, " STORAGE_POOL" });
1931
+ StoragePoolSeen.emplace (poolId);
1984
1932
}
1985
1933
}
1986
1934
switch (context.GetOverallStatus ()) {
@@ -2142,14 +2090,14 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
2142
2090
context.UpdateMaxStatus (tabletContext.GetOverallStatus ());
2143
2091
}
2144
2092
}
2145
- if (!FilterDatabase) {
2093
+ if (!FilterDatabase && BaseConfig ) {
2146
2094
TDatabaseState unknownDatabase;
2147
- for (auto & [name , pool] : StoragePoolState) {
2148
- if (StoragePoolSeen.count (name ) == 0 ) {
2149
- unknownDatabase.StoragePoolNames .insert (name );
2095
+ for (auto & [id , pool] : StoragePoolState) {
2096
+ if (StoragePoolSeen.count (id ) == 0 ) {
2097
+ unknownDatabase.StoragePools .insert (id );
2150
2098
}
2151
2099
}
2152
- if (!unknownDatabase.StoragePoolNames .empty ()) {
2100
+ if (!unknownDatabase.StoragePools .empty ()) {
2153
2101
Ydb::Monitoring::DatabaseStatus& databaseStatus (*context.Result ->add_database_status ());
2154
2102
TSelfCheckResult storageContext;
2155
2103
FillStorage (unknownDatabase, *databaseStatus.mutable_storage (), {&storageContext, " STORAGE" });
0 commit comments