diff options
author | xenoxeno <[email protected]> | 2022-12-27 13:41:03 +0300 |
---|---|---|
committer | xenoxeno <[email protected]> | 2022-12-27 13:41:03 +0300 |
commit | 78e309ef88ca25a80efd951a4d8a48525e925424 (patch) | |
tree | a74e2923514e46bd76e06fe915ade31db0eb47ae | |
parent | 4c087567ebe51fc9ca768f5e5cc1fa54e234083c (diff) |
add optimization for tablet id filter
-rw-r--r-- | ydb/core/viewer/json_tabletinfo.h | 15 | ||||
-rw-r--r-- | ydb/core/viewer/wb_req.h | 12 |
2 files changed, 25 insertions, 2 deletions
diff --git a/ydb/core/viewer/json_tabletinfo.h b/ydb/core/viewer/json_tabletinfo.h index e14086b3ebb..66605f815d4 100644 --- a/ydb/core/viewer/json_tabletinfo.h +++ b/ydb/core/viewer/json_tabletinfo.h @@ -7,6 +7,7 @@ #include <ydb/core/tx/tx_proxy/proxy.h> #include <ydb/core/node_whiteboard/node_whiteboard.h> #include <ydb/core/base/tablet_pipe.h> +#include <ydb/core/util/wildcard.h> #include "json_pipe_req.h" #include "json_wb_req.h" #include <span> @@ -103,6 +104,16 @@ public: Become(&TThis::StateRequestedDescribe, TDuration::MilliSeconds(TBase::RequestSettings.Timeout), new TEvents::TEvWakeup()); } else { TBase::Bootstrap(); + if (!TBase::RequestSettings.FilterFields.empty()) { + if (IsMatchesWildcard(TBase::RequestSettings.FilterFields, "(TabletId=*)")) { + TString strTabletId(TBase::RequestSettings.FilterFields.substr(10, TBase::RequestSettings.FilterFields.size() - 11)); + TTabletId uiTabletId(FromStringWithDefault<TTabletId>(strTabletId, {})); + if (uiTabletId) { + Tablets.push_back(uiTabletId); + Request->Record.AddFilterTabletId(uiTabletId); + } + } + } } } @@ -156,6 +167,10 @@ public: } if (Tablets.empty()) { ReplyAndPassAway(); + } else { + for (TTabletId tabletId : Tablets) { + Request->Record.AddFilterTabletId(tabletId); + } } TBase::Bootstrap(); } diff --git a/ydb/core/viewer/wb_req.h b/ydb/core/viewer/wb_req.h index c5c9317694c..b46fd735af4 100644 --- a/ydb/core/viewer/wb_req.h +++ b/ydb/core/viewer/wb_req.h @@ -45,6 +45,7 @@ protected: using TBase = TViewerPipeClient<TDerived>; using TResponseType = typename TResponseEventType::ProtoRecordType; TRequestSettings RequestSettings; + THolder<TRequestEventType> Request; std::unordered_set<TNodeId> NodeIds; TMap<TNodeId, TResponseType> PerNodeStateInfo; // map instead of unordered_map only for sorting reason std::unordered_map<TNodeId, TString> NodeErrors; @@ -77,9 +78,15 @@ public: return request; } + THolder<TRequestEventType> CloneRequest() { + THolder<TRequestEventType> request = MakeHolder<TRequestEventType>(); + request->Record.MergeFrom(Request->Record); + return request; + } + void SendNodeRequestToWhiteboard(TNodeId nodeId) { - TActorId whiteboardServiceId = MakeNodeWhiteboardServiceId(nodeId); - THolder<TRequestEventType> request = BuildRequest(); + TActorId whiteboardServiceId = MakeNodeWhiteboardServiceId(nodeId ); + THolder<TRequestEventType> request = CloneRequest(); BLOG_TRACE("Sent WhiteboardRequest to " << nodeId << " Request: " << request->Record.ShortDebugString()); TBase::SendRequest(whiteboardServiceId, request.Release(), IEventHandle::FlagTrackDelivery | IEventHandle::FlagSubscribeOnSession, nodeId); NodeIds.insert(nodeId); @@ -105,6 +112,7 @@ public: TlsActivationContext->ActorSystem()->NodeId); TBase::InitConfig(RequestSettings); + Request = BuildRequest(); if (RequestSettings.FilterNodeIds.empty()) { if (RequestSettings.AliveOnly) { static const TActorId whiteboardServiceId = MakeNodeWhiteboardServiceId(TBase::SelfId().NodeId()); |