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

EoS TxnOffsetCommit v0 #195

Merged
merged 8 commits into from
Nov 6, 2018
Merged

EoS TxnOffsetCommit v0 #195

merged 8 commits into from
Nov 6, 2018

Conversation

ianwsperber
Copy link
Contributor

Resolves #169.

In testing I was not able to get a rejection for an invalid transaction id/producer id/producer epoch. Accordingly I wrote my broker test to just use mock values for these fields to make that behavior explicit. @tulios do you have any thoughts on this? According to the design doc my request should be rejected, but I'm unsure if that's Kafka's actual behavior.

Also added a little bit of documentation to the transaction methods in the broker.

@ianwsperber ianwsperber self-assigned this Nov 6, 2018
Copy link
Owner

@tulios tulios left a comment

Choose a reason for hiding this comment

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

In testing I was not able to get a rejection for an invalid transaction id/producer id/producer epoch

Interesting, looking at the Kafka code I'm assuming that since you haven't followed the "protocol" (init, add partitions, etc) it end up in a state where it can't validate the transaction. Can you try a version where you call the previous methods first? Maybe this was fixed on the newer versions

https://github.com/apache/kafka/blob/3cdc78e6bb1f83973a14ce1550fe3874f7348b05/core/src/main/scala/kafka/coordinator/transaction/TransactionMetadata.scala#L307-L366

* @param {string} groupId The unique group identifier (for the consumer group)
* @param {number} producerId Current producer id in use by the transactional id.
* @param {number} producerEpoch Current epoch associated with the producer id.
* @param {object[]} topics
Copy link
Owner

Choose a reason for hiding this comment

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

What about

/**
 * @param {OffsetCommitTopic[]} topics
 *
 * @typedef {Object} OffsetCommitTopic
 * @property {string} topic
 * @property {OffsetCommitTopicPartition[]} partitions
 *
 * @typedef {Object} OffsetCommitTopicPartition
 * @property {number} partition
 * @property {number} offset
 * @property {string} metadata
*/

For the topics JSDoc?

producerId = result.producerId
producerEpoch = result.producerEpoch

await transactionBroker.addPartitionsToTxn({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tulios I've added the preceding steps in the protocol here. You can see below we still don't get a rejection for invalid values.

Copy link
Owner

Choose a reason for hiding this comment

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

Yeah, well that's unfortunate, but I guess we will have more data once we start the actual producer. If we discover something new, we can come back add more tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good to me @tulios. If we ultimately conclude that this is indeed Kafka's behavior today it may be prudent to raise an issue with the Kafka team to identify whether it's the intended behavior or a bug.

@tulios tulios merged commit 5958a4f into master Nov 6, 2018
@tulios
Copy link
Owner

tulios commented Nov 7, 2018

@ianwsperber I was trying to test the commit flow following the steps in here

https://cwiki.apache.org/confluence/display/KAFKA/KIP-98+-+Exactly+Once+Delivery+and+Transactional+Messaging#KIP-98-ExactlyOnceDeliveryandTransactionalMessaging-DataFlow

and I just realized that we are not passing the transaction attributes to the produce request, I started some of this work here:

https://github.com/tulios/kafkajs/compare/add-transactional-attrs-to-record-batch

I have a theory that we do not see the correct behavior because we haven't produced any messages, so there's nothing associated with the producerId. I haven't managed to finish the test since I can't produce so you might want to take a look.

I'm busy with some other things this week and the next, but I should be able to join this initiative soon.

@ianwsperber
Copy link
Contributor Author

Ok, I'll take a look at your branch @tulios. If I get anywhere I'll create a separate branch and PR. It's curious because I was able to validate all those failure test cases for EndTxn in #198, so if producing messages fixes this issue then the behavior is at least inconsistent.

@tulios tulios deleted the eos-169-TxnOffsetCommit-v0 branch November 7, 2018 21:15
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.

2 participants