Skip to content

Commit

Permalink
txn: completely reset group state on term change
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rystsov committed Jun 7, 2023
1 parent 93297d5 commit 69c5392
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/v/kafka/server/group.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 69c5392

Please sign in to comment.