From 69c5392872cbc46e0c0d532ed80a8dabe6266825 Mon Sep 17 00:00:00 2001 From: Denis Rystsov Date: Sun, 28 May 2023 00:20:11 -0700 Subject: [PATCH] txn: completely reset group state on term change When the consumer group log's term change we replay the whole log to reconstruct the state. We used to merge current and the replayed state but it's error prone. Reseting the whole txn state to have more deter- ministic behavior --- src/v/kafka/server/group.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/v/kafka/server/group.cc b/src/v/kafka/server/group.cc index 987c963c1c8b..4cf7ac1c2164 100644 --- a/src/v/kafka/server/group.cc +++ b/src/v/kafka/server/group.cc @@ -1672,6 +1672,10 @@ void group::reset_tx_state(model::term_id term) { // to avoid modifying the state of the executing tx methods _term = term; _volatile_txs.clear(); + _prepared_txs.clear(); + _expiration_info.clear(); + _tx_data.clear(); + _fence_pid_epoch.clear(); } void group::insert_prepared(prepared_tx tx) {