Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c/rm_stm: cleanup tx_locks #15796

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/v/cluster/rm_stm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3199,12 +3199,23 @@ ss::future<> rm_stm::clear_old_tx_pids() {

fragmented_vector<model::producer_identity> pids_for_delete;
for (auto [id, epoch] : _log_state.fence_pid_epoch) {
auto pid = model::producer_identity(id, epoch);
// If pid is not inside tx_seqs it means we do not have transaction for
// it right now
if (!_log_state.current_txes.contains(pid)) {
pids_for_delete.push_back(pid);
auto pid = model::producer_identity(id, epoch);
if (_log_state.current_txes.contains(pid)) {
continue;
}
pids_for_delete.push_back(pid);

auto lock_it = _tx_locks.find(id);
// If there is no lock or the lock is not being held (presumably by
// another epoch of the same producer ID), we can cleanup entry in the
// map.
if (lock_it == _tx_locks.end() || !lock_it->second->ready()) {
continue;
}
lock_it->second->broken();
_tx_locks.erase(lock_it);
}

vlog(
Expand Down
Loading