kafka icon indicating copy to clipboard operation
kafka copied to clipboard

KAFKA-14138: Wrapping all non-fatal exceptions in KafkaException and throwing all fata exceptions directly for producer.send()

Open vamossagar12 opened this issue 3 years ago • 5 comments

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.

vamossagar12 avatar Aug 13 '22 12:08 vamossagar12

@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!

vamossagar12 avatar Aug 13 '22 12:08 vamossagar12

Looks like there are some checkstyle failures. Would fix them.

vamossagar12 avatar Aug 16 '22 19:08 vamossagar12

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?

guozhangwang avatar Aug 19 '22 00:08 guozhangwang

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.

vamossagar12 avatar Aug 19 '22 06:08 vamossagar12

@guozhangwang plz let me know when the KIP changes are done and this could be re-worked upon..

vamossagar12 avatar Aug 31 '22 12:08 vamossagar12