Skip to content

Commit

Permalink
fix segfault in autocomplete handler when redirecting to a database (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adameat authored Aug 28, 2024
1 parent d9565af commit 987134c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ydb/core/viewer/viewer_autocomplete.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ using TNavigate = NSchemeCache::TSchemeCacheNavigate;
class TJsonAutocomplete : public TViewerPipeClient {
using TThis = TJsonAutocomplete;
using TBase = TViewerPipeClient;
IViewer* Viewer;
NMon::TEvHttpInfo::TPtr Event;
TEvViewer::TEvViewerRequest::TPtr ViewerRequest;
TJsonSettings JsonSettings;
ui32 Timeout = 0;
Expand Down Expand Up @@ -47,9 +45,8 @@ class TJsonAutocomplete : public TViewerPipeClient {
std::vector<TNodeId> TenantDynamicNodes;
bool Direct = false;
public:
TJsonAutocomplete(IViewer* viewer, NMon::TEvHttpInfo::TPtr &ev)
: Viewer(viewer)
, Event(ev)
TJsonAutocomplete(IViewer* viewer, NMon::TEvHttpInfo::TPtr& ev)
: TBase(viewer, ev)
{
const auto& params(Event->Get()->Request.GetParams());
InitConfig(params);
Expand Down Expand Up @@ -165,7 +162,7 @@ class TJsonAutocomplete : public TViewerPipeClient {
// autocomplete database list via console request
RequestConsoleListTenants();
} else {
Direct |= !Event->Get()->Request.GetHeader("X-Forwarded-From-Node").empty(); // we're already forwarding
Direct |= !TBase::Event->Get()->Request.GetHeader("X-Forwarded-From-Node").empty(); // we're already forwarding
Direct |= (Database == AppData()->TenantName) || Database.empty(); // we're already on the right node or don't use database filter
if (Database && !Direct) {
// proxy request to a dynamic node of the specified database
Expand Down

0 comments on commit 987134c

Please sign in to comment.