Skip to content

Commit dda2bc2

Browse files
StekPerepolnenalexv-smirnovRaubzeug
authored
Viewer returns Failed to resolve database (#11841)
Co-authored-by: AlexSm <[email protected]> Co-authored-by: Raubzeug <[email protected]>
1 parent 375629c commit dda2bc2

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

ydb/core/viewer/json_pipe_req.cpp

+16-8
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,9 @@ TViewerPipeClient::TRequestResponse<TEvTxProxySchemeCache::TEvNavigateKeySetResu
573573
void TViewerPipeClient::RequestTxProxyDescribe(const TString& path) {
574574
THolder<TEvTxUserProxy::TEvNavigate> request(new TEvTxUserProxy::TEvNavigate());
575575
request->Record.MutableDescribePath()->SetPath(path);
576+
if (!Event->Get()->UserToken.empty()) {
577+
request->Record.SetUserToken(Event->Get()->UserToken);
578+
}
576579
SendRequest(MakeTxProxyID(), request.Release());
577580
}
578581

@@ -763,13 +766,15 @@ void TViewerPipeClient::HandleResolveResource(TEvTxProxySchemeCache::TEvNavigate
763766
SharedDatabase = CanonizePath(entry.Path);
764767
if (SharedDatabase == AppData()->TenantName) {
765768
Direct = true;
766-
return Bootstrap(); // retry bootstrap without redirect this time
769+
Bootstrap(); // retry bootstrap without redirect this time
770+
} else {
771+
DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup(SharedDatabase);
767772
}
768-
DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup(SharedDatabase);
769773
} else {
770-
ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - shared database not found"));
774+
return ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - shared database not found"));
771775
}
772776
}
777+
RequestDone();
773778
}
774779

775780
void TViewerPipeClient::HandleResolveDatabase(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr& ev) {
@@ -780,24 +785,27 @@ void TViewerPipeClient::HandleResolveDatabase(TEvTxProxySchemeCache::TEvNavigate
780785
if (entry.DomainInfo && entry.DomainInfo->ResourcesDomainKey && entry.DomainInfo->DomainKey != entry.DomainInfo->ResourcesDomainKey) {
781786
ResourceNavigateResponse = MakeRequestSchemeCacheNavigate(TPathId(entry.DomainInfo->ResourcesDomainKey));
782787
Become(&TViewerPipeClient::StateResolveResource);
783-
return;
788+
} else {
789+
DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup(CanonizePath(entry.Path));
784790
}
785-
DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup(CanonizePath(entry.Path));
786791
} else {
787-
ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - not found"));
792+
return ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - not found"));
788793
}
789794
}
795+
RequestDone();
790796
}
791797

792798
void TViewerPipeClient::HandleResolve(TEvStateStorage::TEvBoardInfo::TPtr& ev) {
793799
if (DatabaseBoardInfoResponse) {
794800
DatabaseBoardInfoResponse->Set(std::move(ev));
795801
if (DatabaseBoardInfoResponse->IsOk()) {
796-
ReplyAndPassAway(MakeForward(GetNodesFromBoardReply(DatabaseBoardInfoResponse->GetRef())));
802+
return ReplyAndPassAway(MakeForward(GetNodesFromBoardReply(DatabaseBoardInfoResponse->GetRef())));
797803
} else {
798-
ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - no nodes found"));
804+
Direct = true;
805+
Bootstrap(); // retry bootstrap without redirect this time
799806
}
800807
}
808+
RequestDone();
801809
}
802810

803811
void TViewerPipeClient::HandleTimeout() {

ydb/core/viewer/viewer_tabletinfo.h

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

139137
TString GetColumnValue(const TCell& cell, const NKikimrSchemeOp::TColumnDescription& type) {
@@ -182,7 +180,7 @@ class TJsonTabletInfo : public TJsonWhiteboardRequest<TEvWhiteboard::TEvTabletSt
182180
NScheme::TTypeInfo typeInfo = NKikimr::NScheme::TypeInfoFromProto(type.GetTypeId(), type.GetTypeInfo());
183181
auto convert = NPg::PgNativeTextFromNativeBinary(cell.AsBuf(),typeInfo.GetPgTypeDesc());
184182
return TStringBuilder() << '"' << (!convert.Error ? convert.Str : *convert.Error) << '"';;
185-
}
183+
}
186184
case NScheme::NTypeIds::DyNumber: return "DyNumber";
187185
case NScheme::NTypeIds::Uuid: return "Uuid";
188186
default:
@@ -331,14 +329,13 @@ class TJsonTabletInfo : public TJsonWhiteboardRequest<TEvWhiteboard::TEvTabletSt
331329
}
332330
}
333331
}
334-
if (Tablets.empty()) {
335-
ReplyAndPassAway();
336-
} else {
332+
if (!Tablets.empty()) {
337333
TBase::Bootstrap();
338334
for (auto tablet : Tablets) {
339335
Request->Record.AddFilterTabletId(tablet.first);
340336
}
341337
}
338+
RequestDone();
342339
}
343340

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

0 commit comments

Comments
 (0)