From 8a37438e65bfc58298c9457ef198253177253a1e Mon Sep 17 00:00:00 2001 From: Alek5andr-Kotov Date: Wed, 27 Nov 2024 18:44:40 +0300 Subject: [PATCH] Improvements to the transaction list (#12060) --- ydb/core/persqueue/pq_impl_app.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ydb/core/persqueue/pq_impl_app.cpp b/ydb/core/persqueue/pq_impl_app.cpp index f2b7a0ffd6c3..331c13339e45 100644 --- a/ydb/core/persqueue/pq_impl_app.cpp +++ b/ydb/core/persqueue/pq_impl_app.cpp @@ -14,11 +14,11 @@ using EState = NKikimrPQ::TTransaction::EState; namespace { struct TTransactionSnapshot { - TTransactionSnapshot(const TDistributedTransaction& tx) + explicit TTransactionSnapshot(const TDistributedTransaction& tx) : TxId(tx.TxId) , Step(tx.Step) , State(tx.State) - , MinStep(tx.MaxStep) + , MinStep(tx.MinStep) , MaxStep(tx.MaxStep) { } @@ -124,7 +124,7 @@ class TMonitoringProxy : public TActorBootstrapped { } } TABLED() {str << tx.Step;} - TABLED() {str << (int)tx.State;} + TABLED() {str << NKikimrPQ::TTransaction_EState_Name(tx.State);} TABLED() {str << tx.MinStep;} TABLED() {str << tx.MaxStep;} } @@ -243,6 +243,15 @@ bool TPersQueue::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev, const TAc transactions.emplace_back(tx); } + auto isLess = [](const TTransactionSnapshot& lhs, const TTransactionSnapshot& rhs) { + auto makeValue = [](const TTransactionSnapshot& v) { + return std::make_tuple(v.Step, v.TxId); + }; + + return makeValue(lhs) < makeValue(rhs); + }; + std::sort(transactions.begin(), transactions.end(), isLess); + ctx.Register(new TMonitoringProxy(ev->Sender, ev->Get()->Query, std::move(res), CacheActor, TopicName, TabletID(), ResponseProxy.size(), std::move(config), std::move(transactions)));