@@ -113,31 +113,119 @@ std::vector<TNodeRequest::TTaskInfo> TNodeState::GetTasksByTxId(ui64 txId) const
113113}
114114
115115void TNodeState::DumpInfo (TStringStream& str) const {
116- for (const auto & bucket : Buckets) {
117- TReadGuard guard (bucket.Mutex );
118- TMap<ui64, TVector<std::pair<const TActorId, const TNodeRequest*>>> byTx;
116+ HTML (str) {
117+ str << Endl << " Transactions:" << Endl;
118+ TABLE_SORTABLE_CLASS (" table table-condensed" ) {
119+ TABLEHEAD () {
120+ TABLER () {
121+ TABLEH () {str << " TxId" ;}
122+ TABLEH () {str << " Executer" ;}
123+ TABLEH () {str << " StartTime" ;}
124+ TABLEH () {str << " Deadline" ;}
125+ }
126+ }
127+ TABLEBODY () {
128+ for (const auto & bucket : Buckets) {
129+ TReadGuard guard (bucket.Mutex );
130+ TMap<ui64, TVector<std::pair<const TActorId, const TNodeRequest*>>> byTx;
119131
120- for (const auto & [txId, request] : bucket.Requests ) {
121- byTx[txId].emplace_back (request.ExecuterId , &request);
132+ for (const auto & [txId, request] : bucket.Requests ) {
133+ byTx[txId].emplace_back (request.ExecuterId , &request);
134+ }
135+
136+ for (const auto & [txId, requests] : byTx) {
137+ for (auto & [requester, request] : requests) {
138+ TABLER () {
139+ TABLED () {str << txId;}
140+ TABLED () {
141+ HREF (TStringBuilder () << " /node/" << requester.NodeId () << " /actors/kqp_node?ex=" << requester) {
142+ str << requester;
143+ }
144+ }
145+ TABLED () {str << request->StartTime ;}
146+ TABLED () {str << request->Deadline ;}
147+ }
148+ }
149+ }
150+ }
151+ }
122152 }
123- for (const auto & [txId, requests] : byTx) {
124- str << " Requests:" << Endl;
125- for (auto & [requester, request] : requests) {
126- str << " Requester: " << requester << Endl;
127- str << " StartTime: " << request->StartTime << Endl;
128- str << " Deadline: " << request->Deadline << Endl;
129- str << " In-fly tasks:" << Endl;
130- for (auto & [taskId, actorId] : request->Tasks ) {
131- str << " Task: " << taskId << Endl;
132- if (actorId) {
133- str << " Compute actor: " << *actorId << Endl;
134- } else {
135- str << " Compute actor: (task not started yet)" << Endl;
153+
154+ str << Endl << " Tasks:" << Endl;
155+ TABLE_SORTABLE_CLASS (" table table-condensed" ) {
156+ TABLEHEAD () {
157+ TABLER () {
158+ TABLEH () {str << " TxId" ;}
159+ TABLEH () {str << " Executer" ;}
160+ TABLEH () {str << " TaskId" ;}
161+ TABLEH () {str << " ComputeActorId" ;}
162+ }
163+ }
164+ TABLEBODY () {
165+ for (const auto & bucket : Buckets) {
166+ TReadGuard guard (bucket.Mutex );
167+ TMap<ui64, TVector<std::pair<const TActorId, const TNodeRequest*>>> byTx;
168+
169+ for (const auto & [txId, request] : bucket.Requests ) {
170+ byTx[txId].emplace_back (request.ExecuterId , &request);
171+ }
172+
173+ for (const auto & [txId, requests] : byTx) {
174+ for (auto & [requester, request] : requests) {
175+ for (auto & [taskId, actorId] : request->Tasks ) {
176+ TABLER () {
177+ TABLED () {str << txId;}
178+ TABLED () {
179+ HREF (TStringBuilder () << " /node/" << requester.NodeId () << " /actors/kqp_node?ex=" << requester) {
180+ str << requester;
181+ }
182+ }
183+ TABLED () {str << taskId;}
184+ TABLED () {
185+ if (actorId) {
186+ HREF (TStringBuilder () << " /node/" << requester.NodeId () << " /actors/kqp_node?ca=" << *actorId) {
187+ str << *actorId;
188+ }
189+ } else {
190+ str << " N/A" ;
191+ }
192+ }
193+ }
194+ }
195+ }
136196 }
137197 }
138198 }
139199 }
140200 }
141201}
142202
203+ bool TNodeState::ValidateComputeActorId (const TString& computeActorId, TActorId& id) const {
204+ for (const auto & bucket : Buckets) {
205+ TReadGuard guard (bucket.Mutex );
206+ for (const auto & [_, request] : bucket.Requests ) {
207+ for (auto & [_, actorId] : request.Tasks ) {
208+ if (actorId && ToString (*actorId) == computeActorId) {
209+ id = *actorId;
210+ return true ;
211+ }
212+ }
213+ }
214+ }
215+ return false ;
216+ }
217+
218+ bool TNodeState::ValidateKqpExecuterId (const TString& kqpExecuterId, ui32 nodeId, TActorId& id) const {
219+ for (const auto & bucket : Buckets) {
220+ TReadGuard guard (bucket.Mutex );
221+ for (const auto & [_, request] : bucket.Requests ) {
222+ if (ToString (request.ExecuterId ) == kqpExecuterId && request.ExecuterId .NodeId () == nodeId) {
223+ id = request.ExecuterId ;
224+ return true ;
225+ }
226+ }
227+ }
228+ return false ;
229+ }
230+
143231} // namespace NKikimr::NKqp::NKqpNode
0 commit comments