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

V21.11.x backport pr3232: Abort transactions with same pid but older epoch when detected #3247

Merged
merged 2 commits into from
Dec 13, 2021

Conversation

rystsov
Copy link
Contributor

@rystsov rystsov commented Dec 13, 2021

Cover letter

Backport #3232

Release notes

Fixes a consistency issue with transactions

rm_stm is a replicated state machine running on top of a Redpanda data
partition so we may break down an execution of a command in a familiar
sequence of steps:

  1) validation
  2) replication
  3) catching up
  4) execution

After replication is over we know than it won't be lost and for some
commands we may decide to return before waiting for step four. But
in this case when we process the next command we can't be sure that
it sees an up to date state.

Caching the replicated offset available after step 2 to use it later
(during an execution of the abort & commit commands) to explicitly
check / wait the previously replicated command is already executed

(cherry picked from commit 51f42c1)
kafka clients use producer id as an identity and not pid & epoch as
we assumed before, so when we postponed writing an abort marker with
older epoch. it could accidentally abort more txes than needed even
when they had different (fresher) pid & epoch pair

fixing the problem by writing an abort marker as soon as new epoch
(with the same pid) is detected

(cherry picked from commit e312dd1)
@rystsov rystsov added this to the v21.11.3 milestone Dec 13, 2021
Copy link
Contributor

@VadimPlh VadimPlh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dotnwat dotnwat merged commit e1281b9 into redpanda-data:v21.11.x Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants