Skip to content

Commit

Permalink
Improvements to the transaction list (#12060)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alek5andr-Kotov authored Nov 27, 2024
1 parent 721ecf3 commit 8a37438
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ydb/core/persqueue/pq_impl_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}

Expand Down Expand Up @@ -124,7 +124,7 @@ class TMonitoringProxy : public TActorBootstrapped<TMonitoringProxy> {
}
}
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;}
}
Expand Down Expand Up @@ -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)));

Expand Down

0 comments on commit 8a37438

Please sign in to comment.