Skip to content

Commit f1c85b9

Browse files
StekPerepolnenalexv-smirnovRaubzeug
authored
Fix UI error "Failed to resolve database" - merge stream-nb-24-3 (#12359)
Co-authored-by: AlexSm <alex@ydb.tech> Co-authored-by: Raubzeug <Raubzeug@users.noreply.github.com>
1 parent 9c88f07 commit f1c85b9

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

ydb/core/viewer/json_pipe_req.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@ TViewerPipeClient::TRequestResponse<TEvTxProxySchemeCache::TEvNavigateKeySetResu
564564
void TViewerPipeClient::RequestTxProxyDescribe(const TString& path) {
565565
THolder<TEvTxUserProxy::TEvNavigate> request(new TEvTxUserProxy::TEvNavigate());
566566
request->Record.MutableDescribePath()->SetPath(path);
567+
if (!Event->Get()->UserToken.empty()) {
568+
request->Record.SetUserToken(Event->Get()->UserToken);
569+
}
567570
SendRequest(MakeTxProxyID(), request.Release());
568571
}
569572

@@ -754,13 +757,15 @@ void TViewerPipeClient::HandleResolveResource(TEvTxProxySchemeCache::TEvNavigate
754757
SharedDatabase = CanonizePath(entry.Path);
755758
if (SharedDatabase == AppData()->TenantName) {
756759
Direct = true;
757-
return Bootstrap(); // retry bootstrap without redirect this time
760+
Bootstrap(); // retry bootstrap without redirect this time
761+
} else {
762+
DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup(SharedDatabase);
758763
}
759-
DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup(SharedDatabase);
760764
} else {
761-
ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - shared database not found"));
765+
return ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - shared database not found"));
762766
}
763767
}
768+
RequestDone();
764769
}
765770

766771
void TViewerPipeClient::HandleResolveDatabase(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr& ev) {
@@ -771,24 +776,27 @@ void TViewerPipeClient::HandleResolveDatabase(TEvTxProxySchemeCache::TEvNavigate
771776
if (entry.DomainInfo && entry.DomainInfo->ResourcesDomainKey && entry.DomainInfo->DomainKey != entry.DomainInfo->ResourcesDomainKey) {
772777
ResourceNavigateResponse = MakeRequestSchemeCacheNavigate(TPathId(entry.DomainInfo->ResourcesDomainKey));
773778
Become(&TViewerPipeClient::StateResolveResource);
774-
return;
779+
} else {
780+
DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup(CanonizePath(entry.Path));
775781
}
776-
DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup(CanonizePath(entry.Path));
777782
} else {
778-
ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - not found"));
783+
return ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - not found"));
779784
}
780785
}
786+
RequestDone();
781787
}
782788

783789
void TViewerPipeClient::HandleResolve(TEvStateStorage::TEvBoardInfo::TPtr& ev) {
784790
if (DatabaseBoardInfoResponse) {
785791
DatabaseBoardInfoResponse->Set(std::move(ev));
786792
if (DatabaseBoardInfoResponse->IsOk()) {
787-
ReplyAndPassAway(MakeForward(GetNodesFromBoardReply(DatabaseBoardInfoResponse->GetRef())));
793+
return ReplyAndPassAway(MakeForward(GetNodesFromBoardReply(DatabaseBoardInfoResponse->GetRef())));
788794
} else {
789-
ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - no nodes found"));
795+
Direct = true;
796+
Bootstrap(); // retry bootstrap without redirect this time
790797
}
791798
}
799+
RequestDone();
792800
}
793801

794802
void TViewerPipeClient::HandleTimeout() {

ydb/core/viewer/viewer_tabletinfo.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,11 @@ class TJsonTabletInfo : public TJsonWhiteboardRequest<TEvWhiteboard::TEvTabletSt
8787
}
8888
const auto& params(Event->Get()->Request.GetParams());
8989
TBase::RequestSettings.Timeout = FromStringWithDefault<ui32>(params.Get("timeout"), 10000);
90-
if (Database) {
91-
RegisterWithSameMailbox(CreateBoardLookupActor(MakeEndpointsBoardPath(Database), TBase::SelfId(), EBoardLookupMode::Second));
90+
91+
if (DatabaseBoardInfoResponse && DatabaseBoardInfoResponse->IsOk()) {
92+
TBase::RequestSettings.FilterNodeIds = TBase::GetNodesFromBoardReply(DatabaseBoardInfoResponse->GetRef());
93+
} else if (Database) {
94+
RequestStateStorageEndpointsLookup(Database);
9295
Become(&TThis::StateRequestedLookup, TDuration::MilliSeconds(TBase::RequestSettings.Timeout), new TEvents::TEvWakeup());
9396
return;
9497
}
@@ -102,13 +105,7 @@ class TJsonTabletInfo : public TJsonWhiteboardRequest<TEvWhiteboard::TEvTabletSt
102105
if (params.Has("path")) {
103106
TBase::RequestSettings.Timeout = FromStringWithDefault<ui32>(params.Get("timeout"), 10000);
104107
IsBase64Encode = FromStringWithDefault<bool>(params.Get("base64"), IsBase64Encode);
105-
THolder<TEvTxUserProxy::TEvNavigate> request(new TEvTxUserProxy::TEvNavigate());
106-
if (!Event->Get()->UserToken.empty()) {
107-
request->Record.SetUserToken(Event->Get()->UserToken);
108-
}
109-
NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
110-
record->SetPath(params.Get("path"));
111-
TBase::Send(MakeTxProxyID(), request.Release());
108+
RequestTxProxyDescribe(params.Get("path"));
112109
Become(&TThis::StateRequestedDescribe, TDuration::MilliSeconds(TBase::RequestSettings.Timeout), new TEvents::TEvWakeup());
113110
} else {
114111
TBase::Bootstrap();
@@ -133,6 +130,7 @@ class TJsonTabletInfo : public TJsonWhiteboardRequest<TEvWhiteboard::TEvTabletSt
133130
void Handle(TEvStateStorage::TEvBoardInfo::TPtr& ev) {
134131
TBase::RequestSettings.FilterNodeIds = TBase::GetNodesFromBoardReply(ev);
135132
CheckPath();
133+
RequestDone();
136134
}
137135

138136
TString GetColumnValue(const TCell& cell, const NKikimrSchemeOp::TColumnDescription& type) {
@@ -322,14 +320,13 @@ class TJsonTabletInfo : public TJsonWhiteboardRequest<TEvWhiteboard::TEvTabletSt
322320
}
323321
}
324322
}
325-
if (Tablets.empty()) {
326-
ReplyAndPassAway();
327-
} else {
323+
if (!Tablets.empty()) {
328324
TBase::Bootstrap();
329325
for (auto tablet : Tablets) {
330326
Request->Record.AddFilterTabletId(tablet.first);
331327
}
332328
}
329+
RequestDone();
333330
}
334331

335332
virtual void FilterResponse(NKikimrWhiteboard::TEvTabletStateResponse& response) override {

0 commit comments

Comments
 (0)