Skip to content

Commit

Permalink
admin/transaction: prevent oversized allocs
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
(cherry picked from commit 3b0ef74)
  • Loading branch information
rockwotj authored and michael-redpanda committed Feb 27, 2024
1 parent fd03a56 commit 2dcc64d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/v/redpanda/admin_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3526,8 +3526,7 @@ admin_server::get_all_transactions_handler(
}

using tx_info = ss::httpd::transaction_json::transaction_summary;
std::vector<tx_info> ans;
ans.reserve(res.value().size());
fragmented_vector<tx_info> ans;

for (auto& tx : res.value()) {
if (tx.status == cluster::tm_transaction::tx_status::tombstone) {
Expand Down Expand Up @@ -3576,9 +3575,12 @@ admin_server::get_all_transactions_handler(
}

ans.push_back(std::move(new_tx));
co_await ss::coroutine::maybe_yield();
}

co_return ss::json::json_return_type(ans);
co_return ss::json::json_return_type(ss::json::stream_range_as_array(
lw_shared_container(std::move(ans)),
[](auto& tx_info) { return tx_info; }));
}

ss::future<ss::json::json_return_type>
Expand Down

0 comments on commit 2dcc64d

Please sign in to comment.