diff --git a/src/v/cluster/tx_gateway_frontend.cc b/src/v/cluster/tx_gateway_frontend.cc index 281a85c51cda6..ba69844cb47ea 100644 --- a/src/v/cluster/tx_gateway_frontend.cc +++ b/src/v/cluster/tx_gateway_frontend.cc @@ -1147,7 +1147,7 @@ ss::future tx_gateway_frontend::limit_init_tm_tx( // similar to double-checked locking pattern // it protects concurrent access to oldest_tx - if (stm->tx_cache_size() > _max_transactions_per_coordinator()) { + while (stm->tx_cache_size() > _max_transactions_per_coordinator()) { auto tx_opt = stm->oldest_tx(); if (!tx_opt) { vlog( @@ -1160,7 +1160,10 @@ ss::future tx_gateway_frontend::limit_init_tm_tx( auto tx = tx_opt.value(); vlog( txlog.info, - "tx cache is at capacity; expiring oldest tx with id:{}", + "tx cache size ({}) is beyond capacity ({}); expiring oldest tx " + "with id:{}", + stm->tx_cache_size(), + _max_transactions_per_coordinator(), tx.id); auto tx_units = co_await stm->lock_tx(tx.id, "init_tm_tx"); @@ -1190,7 +1193,7 @@ ss::future tx_gateway_frontend::limit_init_tm_tx( } tx_units.return_all(); } - + vlog(txlog.info, "tx cache size is reduced"); init_units.return_all(); }