KAFKA-14138: Wrapping all non-fatal exceptions in KafkaException and throwing all fata exceptions directly for producer.send()
Currently the producer.send() method has different mechanisms of throwing exceptions when EOS is enabled and when it is not. Furthermore, the exceptions returned in callbacks are also different at times which could lead to confusion. This PR aims to close the confusion by following one of the methodologies of KIP-691.
It wraps all non-fatal exceptions inKafkaException and throws fatal exceptions directly. It does the same for all styles of producer.send() variations(EOS/non-EOS/callback/future.get()). Note that the definition of fatal/non-fatal exceptions were obtained from the KIP.
To get the PR working, needed to make test changes. There was one method where AuthorizationException was wrapped in KafkaException. I removed those checks which made the tests working. This is what exactly the PR was aiming for. I didn't add more tests right now. If reviewers feel so, can add for sure.
@guozhangwang , I made some changes based on what I understood of the KIP and whatever we discussed. Plz review whenever you get the chance. Thanks!
Looks like there are some checkstyle failures. Would fix them.
Hello @vamossagar12 thanks for the PR.
I took another pass on KIP-691 and updated some exception cases in the wiki, and I think we need to thoroughly go through them before we can continue on this specific change. Could we hold on that until KIP-691 is completely went through with a consensus?
hello @guozhangwang Thanks for the note. I noticed that you had made some changes to the KIP. This PR, I kept the changes focussed on send method but the KIP covers all methods. Sure, I would wait until there's consensus on that.
@guozhangwang plz let me know when the KIP changes are done and this could be re-worked upon..