diff --git a/src/v/cluster/tm_stm_cache.cc b/src/v/cluster/tm_stm_cache.cc index 3cac1853fc3e2..705a37594310a 100644 --- a/src/v/cluster/tm_stm_cache.cc +++ b/src/v/cluster/tm_stm_cache.cc @@ -208,7 +208,7 @@ void tm_stm_cache::clear_log() { vlog(txlog.trace, "clearing log"); for (const auto& entry : _log_txes) { - unlink_lru_tx(entry.second.tx); + unlink_lru_tx(entry.second); } _log_txes.clear(); vassert( @@ -299,4 +299,10 @@ std::optional tm_stm_cache::oldest_log_transaction() { size_t tm_stm_cache::tx_cache_size() { return lru_txes.size(); } +void tm_stm_cache::unlink_lru_tx(const tx_wrapper& entry) { + if (entry._hook.is_linked()) { + lru_txes.erase(lru_txes.iterator_to(entry)); + } +} + } // namespace cluster diff --git a/src/v/cluster/tm_stm_cache.h b/src/v/cluster/tm_stm_cache.h index 5bbe3e45a488c..8bbc6c9f6aefb 100644 --- a/src/v/cluster/tm_stm_cache.h +++ b/src/v/cluster/tm_stm_cache.h @@ -271,11 +271,7 @@ class tm_stm_cache { // dentally update records in the past after the re-election std::optional _sealed_term; - void unlink_lru_tx(const tx_wrapper& entry) { - if (entry._hook.is_linked()) { - lru_txes.erase(lru_txes.iterator_to(entry)); - } - } + void unlink_lru_tx(const tx_wrapper&); }; // Updates in v1.