11#include " json_pipe_req.h"
2+ #include " log.h"
23#include < library/cpp/json/json_reader.h>
34#include < library/cpp/json/json_writer.h>
45
@@ -573,6 +574,9 @@ TViewerPipeClient::TRequestResponse<TEvTxProxySchemeCache::TEvNavigateKeySetResu
573574void TViewerPipeClient::RequestTxProxyDescribe (const TString& path) {
574575 THolder<TEvTxUserProxy::TEvNavigate> request (new TEvTxUserProxy::TEvNavigate ());
575576 request->Record .MutableDescribePath ()->SetPath (path);
577+ if (!Event->Get ()->UserToken .empty ()) {
578+ request->Record .SetUserToken (Event->Get ()->UserToken );
579+ }
576580 SendRequest (MakeTxProxyID (), request.Release ());
577581}
578582
@@ -739,6 +743,13 @@ void TViewerPipeClient::RequestDone(ui32 requests) {
739743 if (requests == 0 ) {
740744 return ;
741745 }
746+ if (requests > Requests) {
747+ BLOG_ERROR (" Requests count mismatch: " << requests << " > " << Requests);
748+ if (Span) {
749+ Span.Event (" Requests count mismatch" );
750+ }
751+ requests = Requests;
752+ }
742753 Requests -= requests;
743754 if (!DelayedRequests.empty ()) {
744755 SendDelayedRequests ();
@@ -763,13 +774,15 @@ void TViewerPipeClient::HandleResolveResource(TEvTxProxySchemeCache::TEvNavigate
763774 SharedDatabase = CanonizePath (entry.Path );
764775 if (SharedDatabase == AppData ()->TenantName ) {
765776 Direct = true ;
766- return Bootstrap (); // retry bootstrap without redirect this time
777+ Bootstrap (); // retry bootstrap without redirect this time
778+ } else {
779+ DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup (SharedDatabase);
767780 }
768- DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup (SharedDatabase);
769781 } else {
770- ReplyAndPassAway (GetHTTPBADREQUEST (" text/plain" , " Failed to resolve database - shared database not found" ));
782+ return ReplyAndPassAway (GetHTTPBADREQUEST (" text/plain" , " Failed to resolve database - shared database not found" ));
771783 }
772784 }
785+ RequestDone ();
773786}
774787
775788void TViewerPipeClient::HandleResolveDatabase (TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr& ev) {
@@ -780,24 +793,27 @@ void TViewerPipeClient::HandleResolveDatabase(TEvTxProxySchemeCache::TEvNavigate
780793 if (entry.DomainInfo && entry.DomainInfo ->ResourcesDomainKey && entry.DomainInfo ->DomainKey != entry.DomainInfo ->ResourcesDomainKey ) {
781794 ResourceNavigateResponse = MakeRequestSchemeCacheNavigate (TPathId (entry.DomainInfo ->ResourcesDomainKey ));
782795 Become (&TViewerPipeClient::StateResolveResource);
783- return ;
796+ } else {
797+ DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup (CanonizePath (entry.Path ));
784798 }
785- DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup (CanonizePath (entry.Path ));
786799 } else {
787- ReplyAndPassAway (GetHTTPBADREQUEST (" text/plain" , " Failed to resolve database - not found" ));
800+ return ReplyAndPassAway (GetHTTPBADREQUEST (" text/plain" , " Failed to resolve database - not found" ));
788801 }
789802 }
803+ RequestDone ();
790804}
791805
792806void TViewerPipeClient::HandleResolve (TEvStateStorage::TEvBoardInfo::TPtr& ev) {
793807 if (DatabaseBoardInfoResponse) {
794808 DatabaseBoardInfoResponse->Set (std::move (ev));
795809 if (DatabaseBoardInfoResponse->IsOk ()) {
796- ReplyAndPassAway (MakeForward (GetNodesFromBoardReply (DatabaseBoardInfoResponse->GetRef ())));
810+ return ReplyAndPassAway (MakeForward (GetNodesFromBoardReply (DatabaseBoardInfoResponse->GetRef ())));
797811 } else {
798- ReplyAndPassAway (GetHTTPBADREQUEST (" text/plain" , " Failed to resolve database - no nodes found" ));
812+ Direct = true ;
813+ Bootstrap (); // retry bootstrap without redirect this time
799814 }
800815 }
816+ RequestDone ();
801817}
802818
803819void TViewerPipeClient::HandleTimeout () {
0 commit comments