Skip to content

Commit a371c9f

Browse files
send whiteboard request only for static groups
1 parent b916f5d commit a371c9f

File tree

1 file changed

+44
-23
lines changed

1 file changed

+44
-23
lines changed

ydb/core/health_check/health_check.cpp

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
446446
THolder<TEvInterconnect::TEvNodesInfo> NodesInfo;
447447
THashMap<TNodeId, const TEvInterconnect::TNodeInfo*> MergedNodeInfo;
448448
THolder<TEvBlobStorage::TEvControllerConfigResponse> BaseConfig;
449+
bool RequestedStorageConfig = false;
450+
THashSet<TNodeId> UnknownStaticGroups;
451+
449452

450453
THashSet<TNodeId> NodeIds;
451454
THashSet<TNodeId> StorageNodeIds;
@@ -562,12 +565,14 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
562565
Timeout = GetDuration(Request->Request.operation_params().operation_timeout());
563566
}
564567
TIntrusivePtr<TDomainsInfo> domains = AppData()->DomainsInfo;
568+
565569
auto *domain = domains->GetDomain();
566570
DomainPath = "/" + domain->Name;
567571
RootSchemeShardId = domain->SchemeRoot;
568572
ConsoleId = MakeConsoleID();
569573
RootHiveId = domains->GetHive();
570574
BsControllerId = MakeBSControllerID();
575+
// BsControllerId = MakeTabletID(false, 0xF00F);
571576

572577
if (ConsoleId) {
573578
TabletRequests.TabletStates[ConsoleId].Database = DomainPath;
@@ -614,6 +619,10 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
614619
Schedule(Timeout, new TEvents::TEvWakeup(TimeoutFinal)); // timeout for the rest
615620
}
616621

622+
bool NeedWhiteboardInfoForGroup(TGroupId groupId) {
623+
return BaseConfig && UnknownStaticGroups.count(groupId) != 0 || !BaseConfig && IsStaticGroup(groupId);
624+
}
625+
617626
void Handle(TEvNodeWardenStorageConfig::TPtr ev) {
618627
if (const NKikimrBlobStorage::TStorageConfig& config = *ev->Get()->Config; config.HasBlobStorageConfig()) {
619628
if (const auto& bsConfig = config.GetBlobStorageConfig(); bsConfig.HasServiceSet()) {
@@ -631,7 +640,6 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
631640
pbPDisk.SetPath(pDisk.GetPath());
632641
pbPDisk.SetGuid(pDisk.GetPDiskGuid());
633642
pbPDisk.SetCategory(static_cast<ui64>(pDisk.GetPDiskCategory()));
634-
RequestStorageNode(pDisk.GetNodeID());
635643
}
636644
}
637645
for (const NKikimrBlobStorage::TNodeWardenServiceSet_TVDisk& vDisk : staticConfig.vdisks()) {
@@ -646,6 +654,11 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
646654
pbVDisk.SetNodeId(vDisk.GetVDiskLocation().GetNodeID());
647655
pbVDisk.SetPDiskId(vDisk.GetVDiskLocation().GetPDiskID());
648656
}
657+
658+
auto groupId = vDisk.GetVDiskID().GetGroupID();
659+
if (NeedWhiteboardInfoForGroup(groupId)) {
660+
RequestStorageNode(vDisk.GetVDiskLocation().GetNodeID());
661+
}
649662
}
650663
for (const NKikimrBlobStorage::TGroupInfo& group : staticConfig.groups()) {
651664
ValidGroups.emplace(group.GetGroupID());
@@ -816,6 +829,14 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
816829
}
817830
}
818831

832+
void RequestStorageConfig() {
833+
if (!RequestedStorageConfig) {
834+
Send(MakeBlobStorageNodeWardenID(SelfId().NodeId()), new TEvNodeWardenQueryStorageConfig(false));
835+
RequestedStorageConfig = true;
836+
++Requests;
837+
}
838+
}
839+
819840
void Handle(TEvPrivate::TEvRetryNodeWhiteboard::TPtr& ev) {
820841
switch (ev->Get()->EventId) {
821842
case NNodeWhiteboard::TEvWhiteboard::EvSystemStateRequest:
@@ -933,8 +954,7 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
933954
switch (ev->Get()->Tag) {
934955
case TimeoutBSC:
935956
if (!BaseConfig) {
936-
Send(MakeBlobStorageNodeWardenID(SelfId().NodeId()), new TEvNodeWardenQueryStorageConfig(false));
937-
++Requests;
957+
RequestStorageConfig();
938958
}
939959
break;
940960
case TimeoutFinal:
@@ -970,21 +990,24 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
970990
}
971991

972992
bool NeedWhiteboardInfo(const NKikimrBlobStorage::TBaseConfig::TGroup& group) {
973-
return IsStaticGroup(group.groupid())
974-
&& (group.operatingstatus() == NKikimrBlobStorage::TGroupStatus::UNKNOWN
975-
|| group.operatingstatus() == NKikimrBlobStorage::TGroupStatus::DISINTEGRATED);
993+
return IsStaticGroup(group.groupid());
994+
// && (group.operatingstatus() == NKikimrBlobStorage::TGroupStatus::UNKNOWN
995+
// || group.operatingstatus() == NKikimrBlobStorage::TGroupStatus::DISINTEGRATED);
976996
}
977997

978-
bool NeedWhiteboardInfo(const NKikimrBlobStorage::TBaseConfig& pbConfig) {
979-
if (IsSpecificDatabaseFilter()) {
980-
return false;
981-
}
998+
void AggregateUnknownStatusStaticGroups() {
999+
const NKikimrBlobStorage::TEvControllerConfigResponse& pbRecord(BaseConfig->Record);
1000+
const NKikimrBlobStorage::TConfigResponse::TStatus& pbStatus(pbRecord.GetResponse().GetStatus(0));
1001+
const NKikimrBlobStorage::TBaseConfig& pbConfig(pbStatus.GetBaseConfig());
9821002
for (const NKikimrBlobStorage::TBaseConfig::TGroup& group : pbConfig.GetGroup()) {
9831003
if (NeedWhiteboardInfo(group)) {
984-
return true;
1004+
UnknownStaticGroups.emplace(group.groupid());
9851005
}
9861006
}
987-
return false;
1007+
}
1008+
1009+
bool NeedWhiteboardForStaticGroupsWithUnknownStatus() {
1010+
return RequestedStorageConfig && !IsSpecificDatabaseFilter();
9881011
}
9891012

9901013
bool ReadyBscInfo(TGroupId groupId) {
@@ -1002,13 +1025,9 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
10021025
const NKikimrBlobStorage::TConfigResponse::TStatus& pbStatus(pbRecord.GetResponse().GetStatus(0));
10031026
if (pbStatus.HasBaseConfig()) {
10041027
BaseConfig = ev->Release();
1005-
const NKikimrBlobStorage::TBaseConfig& pbConfig(pbStatus.GetBaseConfig());
1006-
if (NeedWhiteboardInfo(pbConfig)) {
1007-
Send(MakeBlobStorageNodeWardenID(SelfId().NodeId()), new TEvNodeWardenQueryStorageConfig(false));
1008-
++Requests;
1009-
for (const NKikimrBlobStorage::TBaseConfig::TPDisk& pDisk : pbConfig.GetPDisk()) {
1010-
RequestStorageNode(pDisk.GetNodeId());
1011-
}
1028+
AggregateUnknownStatusStaticGroups();
1029+
if (UnknownStaticGroups.size() > 0) {
1030+
RequestStorageConfig();
10121031
}
10131032
}
10141033
}
@@ -2452,7 +2471,7 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
24522471
for (auto groupId : pool.Groups) {
24532472
if (ReadyBscInfo(groupId)) {
24542473
FillGroupStatus(groupId, *storagePoolStatus.add_groups(), {&context, "STORAGE_GROUP"});
2455-
} else {
2474+
} else if (IsStaticGroup(groupId)) {
24562475
auto itGroup = MergedBSGroupState.find(groupId);
24572476
if (itGroup != MergedBSGroupState.end()) {
24582477
FillGroupStatusWithWhiteboard(groupId, *itGroup->second, *storagePoolStatus.add_groups(), {&context, "STORAGE_GROUP"});
@@ -2480,14 +2499,13 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
24802499
}
24812500

24822501
void FillStorage(TDatabaseState& databaseState, Ydb::Monitoring::StorageStatus& storageStatus, TSelfCheckContext context) {
2483-
if (BaseConfig && databaseState.StoragePools.empty()
2484-
|| !BaseConfig && databaseState.StoragePoolNames.empty()) {
2502+
if (BaseConfig && databaseState.StoragePools.empty()) {
24852503
context.ReportStatus(Ydb::Monitoring::StatusFlag::RED, "There are no storage pools", ETags::StorageState);
24862504
} else {
24872505
if (BaseConfig) {
24882506
for (const ui64 poolId : databaseState.StoragePools) {
24892507
auto itStoragePoolState = StoragePoolState.find(poolId);
2490-
if (itStoragePoolState != StoragePoolState.end()) {
2508+
if (itStoragePoolState != StoragePoolState.end() && itStoragePoolState->second.Groups) {
24912509
FillPoolStatus(itStoragePoolState->second, *storageStatus.add_pools(), {&context, "STORAGE_POOL"});
24922510
StoragePoolSeen.emplace(poolId);
24932511
}
@@ -2515,6 +2533,9 @@ class TSelfCheckRequest : public TActorBootstrapped<TSelfCheckRequest> {
25152533
default:
25162534
break;
25172535
}
2536+
if (!BaseConfig) {
2537+
context.ReportStatus(Ydb::Monitoring::StatusFlag::RED, TStringBuilder() << "System tablet BSC didn't provide information", ETags::StorageState);
2538+
}
25182539
}
25192540
if (databaseState.StorageQuota > 0) {
25202541
auto usage = (float)databaseState.StorageUsage / databaseState.StorageQuota;

0 commit comments

Comments
 (0)