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

KAFKA-18464: Empty Abort Transaction can fence producer incorrectly with Transactions V2 #18467

Merged
merged 2 commits into from
Jan 11, 2025

Conversation

jolshan
Copy link
Member

@jolshan jolshan commented Jan 10, 2025

To avoid self-fencing in the commit/abort + empty abort scenario, return the concurrent transactions error when we have pending state and do the epoch check second. In this scenario, we will complete the previous transaction before proceeding to the empty abort.

Added a test that failed before the change.

Note -- only the pending state is checked earlier. This is because we don’t return from EndTxn (the first commit) until we already written to the log, transitioned to PrepareX, and have the pending CompleteX state. We don't need to worry about the cases of an EndTxn request coming in with PrepareX without the pending state because that would be an older request and/or retry which are already covered.

@github-actions github-actions bot added core Kafka Broker small Small PRs labels Jan 10, 2025
@jolshan jolshan added the transactions Transactions and EOS label Jan 10, 2025
Copy link
Contributor

@artemlivshits artemlivshits left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +819 to +820
else if (!isValidEpoch)
Left(Errors.PRODUCER_FENCED)
Copy link
Contributor

Choose a reason for hiding this comment

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

please confirm my understanding:

the mentioned commit/abort + empty abort scenario currently results in fencing the empty abort because the previous commit/abort is left in progress. This change returns concurrent_transactions when performing the empty abort instead. This enables the producer to retry instead of hard failing. Is this correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

exactly! We will retry until the previous operation completes and then we can handle the abort. 👍

Copy link
Contributor

@jeffkbkim jeffkbkim left a comment

Choose a reason for hiding this comment

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

LGTM. thanks!

@jolshan jolshan merged commit 32dbbe6 into apache:trunk Jan 11, 2025
10 checks passed
jolshan added a commit that referenced this pull request Jan 11, 2025
…ith Transactions V2 (#18467)

To avoid self-fencing in the commit/abort + empty abort scenario, return the concurrent transactions error when we have pending state and do the epoch check second. In this scenario, we will complete the previous transaction before proceeding to the empty abort.

Added a test that failed before the change.

Note -- only the pending state is checked earlier. This is because we don’t return from EndTxn (the first commit) until we already written to the log, transitioned to PrepareX, and have the pending CompleteX state. We don't need to worry about the cases of an EndTxn request coming in with PrepareX without the pending state because that would be an older request and/or retry which are already covered.

Reviewers: Artem Livshits <[email protected]>, Jeff Kim <[email protected]>
pranavt84 pushed a commit to pranavt84/kafka that referenced this pull request Jan 27, 2025
…ith Transactions V2 (apache#18467)

To avoid self-fencing in the commit/abort + empty abort scenario, return the concurrent transactions error when we have pending state and do the epoch check second. In this scenario, we will complete the previous transaction before proceeding to the empty abort.

Added a test that failed before the change.

Note -- only the pending state is checked earlier. This is because we don’t return from EndTxn (the first commit) until we already written to the log, transitioned to PrepareX, and have the pending CompleteX state. We don't need to worry about the cases of an EndTxn request coming in with PrepareX without the pending state because that would be an older request and/or retry which are already covered.

Reviewers: Artem Livshits <[email protected]>, Jeff Kim <[email protected]>
airlock-confluentinc bot pushed a commit to confluentinc/kafka that referenced this pull request Jan 27, 2025
…ith Transactions V2 (apache#18467)

To avoid self-fencing in the commit/abort + empty abort scenario, return the concurrent transactions error when we have pending state and do the epoch check second. In this scenario, we will complete the previous transaction before proceeding to the empty abort.

Added a test that failed before the change.

Note -- only the pending state is checked earlier. This is because we don’t return from EndTxn (the first commit) until we already written to the log, transitioned to PrepareX, and have the pending CompleteX state. We don't need to worry about the cases of an EndTxn request coming in with PrepareX without the pending state because that would be an older request and/or retry which are already covered.

Reviewers: Artem Livshits <[email protected]>, Jeff Kim <[email protected]>
manoj-mathivanan pushed a commit to manoj-mathivanan/kafka that referenced this pull request Feb 19, 2025
…ith Transactions V2 (apache#18467)

To avoid self-fencing in the commit/abort + empty abort scenario, return the concurrent transactions error when we have pending state and do the epoch check second. In this scenario, we will complete the previous transaction before proceeding to the empty abort.

Added a test that failed before the change.

Note -- only the pending state is checked earlier. This is because we don’t return from EndTxn (the first commit) until we already written to the log, transitioned to PrepareX, and have the pending CompleteX state. We don't need to worry about the cases of an EndTxn request coming in with PrepareX without the pending state because that would be an older request and/or retry which are already covered.

Reviewers: Artem Livshits <[email protected]>, Jeff Kim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Kafka Broker small Small PRs transactions Transactions and EOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants