KAFKA-20738: Producer 2PC InitProducerId request must negotiate v6#22703
Open
Shekharrajak wants to merge 2 commits into
Open
KAFKA-20738: Producer 2PC InitProducerId request must negotiate v6#22703Shekharrajak wants to merge 2 commits into
Shekharrajak wants to merge 2 commits into
Conversation
Contributor
Author
|
Ref #22704 |
AndrewJSchofield
left a comment
Member
There was a problem hiding this comment.
I don't think this is a problem that needs a fix. It's a reflection of the partial implementation of KIP-939. The latest RPC version is marked as unstable so that production clusters do not accidentally support 2PC.
Contributor
Author
Thanks @AndrewJSchofield for checking. Let me follow it closely https://issues.apache.org/jira/browse/KAFKA-15370 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ref https://issues.apache.org/jira/browse/KAFKA-20738
A producer with transaction.two.phase.commit.enable=true fails initTransactions() with UnsupportedVersionException: Attempted to write a non-default enable2Pc at version 5.
Root cause: v6 is latestVersionUnstable, the builder caps latestAllowedVersion at 5, so NetworkClient can never negotiate v6.
Fix: When enable2Pc or keepPreparedTxn is set, the builder allows the unstable last version (v6) so v6 is negotiated against a capable broker. Plain producers are unaffected (still capped at v5). build() now throws a clear UnsupportedVersionException if the negotiated version is < 6 while a 2PC field is set, instead of leaking the serialization-internals message.
Tests: Added InitProducerIdRequestTest covering latestAllowedVersion == 6 when enable2Pc/keepPreparedTxn is set, and the v5 cap for non-2PC requests.
Note: this is the client-side half; broker-side keepPreparedTxn recovery is tracked in KAFKA-20739 #22704
Reviewers: Andrew Schofield aschofield@confluent.io