-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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-18401: Transaction version 2 does not support commit transaction without records #18448
base: trunk
Are you sure you want to change the base?
Conversation
…n without records
@@ -854,7 +856,7 @@ synchronized TxnRequestHandler nextRequest(boolean hasIncompleteBatches) { | |||
return null; | |||
} | |||
|
|||
if (nextRequestHandler.isEndTxn() && (!isTransactionV2Enabled() && !transactionStarted)) { | |||
if (nextRequestHandler.isEndTxn() && !transactionStarted) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit here: I wonder if we can change the log here for tv2 so that we say we didn't attempt to add any partitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pardon me, could you give me some hint? Did you mean we need to modify the log in line 862
log.debug("Not sending EndTxn for completed transaction since no partitions " +
"or offsets were successfully added");
to something else when using TV2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right -- the implication of successfully added is a little confusing in the TV2 case because it is not a matter of "successfully" adding but a matter of not attempting to add any at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, I modified the log to Not sending EndTxn for completed transaction since no send or sendOffsetsToTransaction were triggered
under TV2. Thank you.
@ClusterTest(brokers = 3, features = { | ||
@ClusterFeature(feature = Feature.TRANSACTION_VERSION, version = 2)}) | ||
}) | ||
public void testTransactionWithoutSend(ClusterInstance cluster) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we include tests for when we do send/add a partition to confirm we do see errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And is it possible to add these tests to an existing file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we include tests for when we do send/add a partition to confirm we do see errors?
Sure, I'm going to write one!
And is it possible to add these tests to an existing file?
Perhaps this one? https://github.com/apache/kafka/blob/trunk/core/src/test/scala/integration/kafka/coordinator/transaction/ProducerIdsIntegrationTest.scala ? We can rename this file to ProducerIntegrationTest.scala
and move the test to this file. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is an option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll move the test in this PR to the test file I mentioned above. Thanks!
related to KAFKA-18401,
Fix the issue where producer.commitTransaction under transaction version 2 throws error if no partition or offset is added to transaction. The solution is to avoid sending the endTxnRequest unless producer.send or producer.sendOffsetsToTransaction is triggered.
Committer Checklist (excluded from commit message)