KAFKA-10864: Convert end txn marker schema to use auto-generated protocol#9766
KAFKA-10864: Convert end txn marker schema to use auto-generated protocol#9766chia7712 merged 5 commits intoapache:trunkfrom
Conversation
abbccdda
left a comment
There was a problem hiding this comment.
Thanks for the PR, one high level question I have is that whether the new auto generated protocol format is exactly the same as old hard-coded schema format, since this field is used inter-broker. Could you write a test to prove that they could translate between each other?
There was a problem hiding this comment.
Add a comment for the field. Also do you think we need flexible version support here?
There was a problem hiding this comment.
Firstly I tried to use flexible version here, but it's not the same as the old hard-coded schema format. Could we bump the version and support flexible version from version 1 ?
Thank you, I tested that the 2 schemas could translate between each other locally, now I add the code to |
62c0038 to
fe6b884
Compare
fe6b884 to
a0129ac
Compare
a0129ac to
63d420a
Compare
63d420a to
340cabc
Compare
340cabc to
77891e9
Compare
|
This PR is being marked as stale since it has not had any activity in 90 days. If you If you are having difficulty finding a reviewer, please reach out on the [mailing list](https://kafka.apache.org/contact). If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed. |
|
@dengziming could you please fix the conflicts? |
77891e9 to
00e9aae
Compare
|
Hi, @chia7712 , Thanks for noticing this PR, I have rebased on trunk and the test looks fine. We have a controversy here that in the past the length of Another alternative is to change |
chia7712
left a comment
There was a problem hiding this comment.
@dengziming sorry for delay review :(
one small comment is left. PTAL
00e9aae to
be75709
Compare
chia7712
left a comment
There was a problem hiding this comment.
@dengziming thanks for this patch!
| public class EndTransactionMarkerTest { | ||
|
|
||
| // Old hard-coded schema, used to validate old hard-coded schema format is exactly the same as new auto generated protocol format | ||
| private Schema v0Schema = new Schema( |
|
|
||
| int coordinatorEpoch = value.getInt(2); | ||
| return new EndTransactionMarker(type, coordinatorEpoch); | ||
| public int endTxnMarkerValueSize() { |
There was a problem hiding this comment.
Could you please add unit test for this method?
There was a problem hiding this comment.
Yes, it's good to test it since it's public.
chia7712
left a comment
There was a problem hiding this comment.
@dengziming thanks for this patch, overall LGTM and one last comment is left
| log.debug("Received end transaction marker value version {}. Parsing as version {}", version, | ||
| CURRENT_END_TXN_MARKER_VERSION); | ||
| EndTxnMarker.HIGHEST_SUPPORTED_VERSION); | ||
| EndTxnMarker marker = new EndTxnMarker(new ByteBufferAccessor(value), version); |
There was a problem hiding this comment.
According to the debug message, we should use EndTxnMarker.HIGHEST_SUPPORTED_VERSION instead of version to parse it as EndTxnMarker.HIGHEST_SUPPORTED_VERSION, right?
There was a problem hiding this comment.
Oh, you are so careful about this, though it seems obscure, I agree with you that we should indeed use EndTxnMarker.HIGHEST_SUPPORTED_VERSION.

More detailed description of your change
EndTxnMarkerCURRENT_END_TXN_MARKER_VALUE_SIZEwith anendTnxMarkerValueSizemethod since the size is accumulated fromEndTxnMarker.EndTransactionMarkerto avoid twice compute fromserializeValueandendTnxMarkerValueSize.Summary of testing strategy (including rationale)
A unit test to verify serialize and deserialize
Committer Checklist (excluded from commit message)