Skip to content

Commit

Permalink
tx_gateway_frontend: make tx cleaning less disruptive
Browse files Browse the repository at this point in the history
  • Loading branch information
rystsov committed Sep 26, 2023
1 parent 7a1eb63 commit e697703
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/v/cluster/tx_gateway_frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,13 @@ ss::future<cluster::init_tm_tx_reply> tx_gateway_frontend::limit_init_tm_tx(
}
auto term = term_opt.value();

auto units = co_await stm->lock_tx(tx_id, "init_tm_tx");
if ((co_await stm->get_tx(tx_id)).has_value()) {
co_return co_await do_init_tm_tx(
stm, term, tx_id, transaction_timeout_ms, timeout, expected_pid);
}
units.return_all();

if (stm->tx_cache_size() > _max_transactions_per_coordinator()) {
// lock is sloppy and doesn't guarantee that tx_cache_size
// never exceeds _max_transactions_per_coordinator. init_tm_tx
Expand Down Expand Up @@ -1197,7 +1204,7 @@ ss::future<cluster::init_tm_tx_reply> tx_gateway_frontend::limit_init_tm_tx(
init_units.return_all();
}

auto units = co_await stm->lock_tx(tx_id, "init_tm_tx");
units = co_await stm->lock_tx(tx_id, "init_tm_tx");

co_return co_await do_init_tm_tx(
stm, term, tx_id, transaction_timeout_ms, timeout, expected_pid);
Expand Down

0 comments on commit e697703

Please sign in to comment.