Skip to content

Commit 3f33b88

Browse files
authored
fix segfault in tenantinfo handler (#8449)
1 parent 13f7cbd commit 3f33b88

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

ydb/core/viewer/viewer_tenantinfo.h

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -645,35 +645,38 @@ class TJsonTenantInfo : public TViewerPipeClient {
645645
TIntrusivePtr<TDomainsInfo> domains = AppData()->DomainsInfo;
646646
auto* domain = domains->GetDomain();
647647
TStackVec<TTabletId, 64> tablets;
648-
for (TTabletId tabletId : entry.DomainInfo->Params.GetCoordinators()) {
649-
tablets.emplace_back(tabletId);
650-
}
651-
for (TTabletId tabletId : entry.DomainInfo->Params.GetMediators()) {
652-
tablets.emplace_back(tabletId);
653-
}
654-
if (entry.DomainInfo->Params.HasSchemeShard()) {
655-
tablets.emplace_back(entry.DomainInfo->Params.GetSchemeShard());
656-
} else {
657-
658-
tablets.emplace_back(domain->SchemeRoot);
659-
tablets.emplace_back(MakeBSControllerID());
660-
tablets.emplace_back(MakeConsoleID());
661-
}
662-
TTabletId hiveId = domains->GetHive();
663-
if (entry.DomainInfo->Params.HasHive()) {
664-
hiveId = entry.DomainInfo->Params.GetHive();
665-
} else {
666-
if (tenant.GetType() == NKikimrViewer::Serverless) {
667-
auto itResourceNavigate = NavigateKeySetResult.find(tenant.GetResourceId());
668-
if (itResourceNavigate != NavigateKeySetResult.end() && itResourceNavigate->second.IsOk()) {
669-
NSchemeCache::TSchemeCacheNavigate::TEntry entry = itResourceNavigate->second.Get()->Request->ResultSet.front();
670-
if (entry.DomainInfo->Params.HasHive()) {
671-
hiveId = entry.DomainInfo->Params.GetHive();
648+
TTabletId hiveId;
649+
if (entry.DomainInfo) {
650+
for (TTabletId tabletId : entry.DomainInfo->Params.GetCoordinators()) {
651+
tablets.emplace_back(tabletId);
652+
}
653+
for (TTabletId tabletId : entry.DomainInfo->Params.GetMediators()) {
654+
tablets.emplace_back(tabletId);
655+
}
656+
if (entry.DomainInfo->Params.HasSchemeShard()) {
657+
tablets.emplace_back(entry.DomainInfo->Params.GetSchemeShard());
658+
} else {
659+
tablets.emplace_back(domain->SchemeRoot);
660+
}
661+
if (entry.DomainInfo->Params.HasHive()) {
662+
tablets.emplace_back(hiveId = entry.DomainInfo->Params.GetHive());
663+
} else {
664+
if (tenant.GetType() == NKikimrViewer::Serverless) {
665+
auto itResourceNavigate = NavigateKeySetResult.find(tenant.GetResourceId());
666+
if (itResourceNavigate != NavigateKeySetResult.end() && itResourceNavigate->second.IsOk()) {
667+
NSchemeCache::TSchemeCacheNavigate::TEntry entry = itResourceNavigate->second.Get()->Request->ResultSet.front();
668+
if (entry.DomainInfo->Params.HasHive()) {
669+
tablets.emplace_back(hiveId = entry.DomainInfo->Params.GetHive());
670+
}
672671
}
672+
} else {
673+
tablets.emplace_back(hiveId = domains->GetHive());
673674
}
674675
}
676+
} else {
677+
tablets.emplace_back(domain->SchemeRoot);
678+
tablets.emplace_back(hiveId = domains->GetHive());
675679
}
676-
tablets.emplace_back(hiveId);
677680

678681
if (SystemTablets) {
679682
for (TTabletId tabletId : tablets) {

0 commit comments

Comments
 (0)