-
Notifications
You must be signed in to change notification settings - Fork 396
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
Support transactions #881
Support transactions #881
Conversation
Replication factor of transaction related options should be reduced to 1 so that we can test with a single broker.
I have struggled to find the best way to test the library specifying the git url in package.json. Seem in doing so the submodules are not present, do you have some guidelines on how to approach this. |
src/producer.cc
Outdated
return Baton(RdKafka::ERR_NO_ERROR); | ||
} | ||
else { | ||
Baton result(error->code()); |
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.
The librdkafka transactional API uses the new richer rd_kafka_error_t
type that provides some extra error attributes.
These attributes, fatal, txn_requires_abort and retriable, are necessary to expose in this node.js API as well since it tells the application how the errors are to be handled, which can not be derrived from the error code itself.
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.
Thank you for your feedback, I have addressed it. I am now exposing a richer JS object populated with data from rd_kafka_error_t
.
Baton InitTransactions(int32_t timeout_ms); | ||
Baton BeginTransaction(); | ||
Baton CommitTransaction(int32_t timeout_ms); | ||
Baton AbortTransaction(int32_t timeout_ms); |
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.
SendOffsetsToTransaction() is also required
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.
I am not familiar with committing offsets, it is something I need to investigate. Do you think it is possible to merge this PR and leave that for future work?
* Expose the richer 'rd_kafka_error_t' object returned by Rdkafka to the JS code. * Add a test to cover the generated error object.
@YordanPavlov thanks for the PR! Also @edenhill thank you for reviewing this! We'll need to do some more work for this to be merged. Transactions are only valuable in consume-process-produce scenarios so as @edenhill mentioned I suggest you read through this Confluent page to get a better understanding. Here are a few tasks that need to be addressed:
|
…ent as argument but pointer is not transferred correctly to C++ land.
Thanks @iradul for considering this PR, I have done some work on trying to add the |
In the meantime I have addressed some of the other issues.
As for your comment 'ideally, all methods in javascript should be asynchronous' - as the C++ methods are synchronous I believe no callback is required in the JS code also. |
Thanks.
I'll work with you on this one. We'll integrate the whole feature within this PR, no need to make a new PR. You can go ahead and cherry-pick santiment#2 commits to here. |
Hi, |
Instead of fetching all offsets for all partitions for a consumer - expect to get them as argument on SendOffsetsToTransaction.
Thank you for your contribution @olegladyka. I have merged my helper PR (the one specific for SendOffsetsToTransaction) and also copied your code, so now everything is in the current PR, as @iradul requested. Unfortunatelly even with your changes, I still get a core dump at this point:
this happens on running the test for SendOffsetsToTransaction. Could you @olegladyka try it for yourself. I may have done some mistake you mentioned that it worked in your tests. |
When you call |
Great work guys! |
Thank you @olegladyka for pointing out the mistake on my end, indeed calling |
Hey @YordanPavlov, the checkbox should be on the right-hand side on this same page under Notifications group. Before I merge this, we need to work a bit on e2e tests. Actually, I think, for now, you can remove |
Also don't allow single offset
I cherry-picked your commits @iradul . Also added the small changes in the tests needed after the style changes. However I started getting some:
errors on running the tests. I can't reproduce it running the tests one file by one but it happens when ran all together. |
Some transaction end to end tests were failing for two reasons. * A delayed message from prevoius test was being read and braking up the logic of the test. Fixed by using a separate topic. * One more message was being produced than expected. Fixed.
@iradul I dug into those occasional test fails and fixed them. Please have a look at my most recent commit. Let's continue work on merging this PR. |
We need to make those new APIs async since all methods can take a significant amount of time to complete. Also, I'd like us to include a complete e2e transactional test, for instance, similar to this. |
I have investigated why I am not seeing the option to grant you Edit access to the PR and the reason seems to be that the Fork I had originally done lives in an organization and not my personal namespace, so Github strips me of the ability to grant access. Any of the three options work for me though:
So just let me know how you would prefer to continue. |
Great feedback. I like the third option. You can reference this PR in the opening comment, so all the history will be available and preserved. |
Sorry for the delay guys. Here is the new PR: |
A pull request to expose the transactions support of LibrdKafka.
Since I noticed that support for transactions has been requested in this issue:
#871
I have done some work to expose it, please consider this pull request @iradul