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

[v24.3.x] rm_stm: fix a race during partition shutdown #24939

Merged
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
3 changes: 3 additions & 0 deletions src/v/cluster/rm_stm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ rm_stm::maybe_create_producer(model::producer_identity pid) {
if (it != _producers.end()) {
return std::make_pair(it->second, producer_previously_known::yes);
}
vlog(_ctx_log.trace, "creating producer for pid: {}", pid);
auto producer = ss::make_lw_shared<producer_state>(
_ctx_log, pid, _raft->group(), [pid, this] {
cleanup_producer_state(pid);
Expand Down Expand Up @@ -205,6 +206,7 @@ void rm_stm::cleanup_producer_state(model::producer_identity pid) noexcept {
};

ss::future<> rm_stm::reset_producers() {
vlog(_ctx_log.trace, "reseting producers");
// note: must always be called under exlusive write lock to
// avoid concurrrent state changes to _producers.
co_await ss::max_concurrent_for_each(
Expand Down Expand Up @@ -1631,6 +1633,7 @@ void rm_stm::apply_fence(model::producer_identity pid, model::record_batch b) {
}

ss::future<> rm_stm::do_apply(const model::record_batch& b) {
auto holder = _gate.hold();
const auto& hdr = b.header();
const auto bid = model::batch_identity::from(hdr);

Expand Down
Loading