Skip to content

KAFKA-16448: Fix processing exception handler#16663

Merged
mjsax merged 3 commits intoapache:trunkfrom
sebastienviale:KAFKA-16448-Fix-processing-exception-handler
Jul 25, 2024
Merged

KAFKA-16448: Fix processing exception handler#16663
mjsax merged 3 commits intoapache:trunkfrom
sebastienviale:KAFKA-16448-Fix-processing-exception-handler

Conversation

@sebastienviale
Copy link
Copy Markdown
Contributor

This PR is part of KAFKA-16448 which aims to bring a ProcessingExceptionHandler to Kafka Streams in order to deal with exceptions that occur during processing.

This PR resolves some minor fixes

Jira: https://issues.apache.org/jira/browse/KAFKA-16448.

Contributors
@Dabz
@sebastienviale
@loicgreffier

@sebastienviale sebastienviale changed the title KFK-16448: Fix processing exception handler KAFKA-16448: Fix processing exception handler Jul 23, 2024
Copy link
Copy Markdown
Member

@cadonna cadonna left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @sebastienviale, @loicgreffier, and @Dabz!

I have one nit!

return true;
}

private void handleException(final Throwable e) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
private void handleException(final Throwable e) {
private void handleException(final Exception e) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@sebastienviale found that failedProcessingException.getCause() returns a Throwable. I think casting would be overhead. Let's keep private void handleException(final Throwable e)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why did you change private void handleException(final Throwable e) to private void handleException(final Exception e)? The additional wrapping into an Exception is not worth changing the signature. Please revert to private void handleException(final Throwable e) and pass in failedProcessingException.getCause().
See my comment above.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reverted. Probably a mistake in a recent commit

Copy link
Copy Markdown
Member

@cadonna cadonna left a comment

Choose a reason for hiding this comment

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

LGTM!

@cadonna cadonna closed this Jul 23, 2024
@cadonna cadonna reopened this Jul 23, 2024
record = null;
throw new TaskCorruptedException(Collections.singleton(id));
}
} catch (final FailedProcessingException failedProcessingException){
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Checkstyle is complaining here. You need to change it to the following:

Suggested change
} catch (final FailedProcessingException failedProcessingException){
} catch (final FailedProcessingException failedProcessingException) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Co-authored-by: Dabz <d.gasparina@gmail.com>
Co-authored-by: loicgreffier <loic.greffier@michelin.com>
@loicgreffier loicgreffier force-pushed the KAFKA-16448-Fix-processing-exception-handler branch from a26bf2a to 11c2573 Compare July 24, 2024 08:26
@cadonna cadonna added streams kip Requires or implements a KIP labels Jul 24, 2024
} catch (final StreamsException exception) {
record = null;
throw exception;
} catch (final RuntimeException e) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Didn't we agree on using Exception here instead of RuntimeException to be consistent with other handlers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes indeed, I think I missed a commit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed

loicgreffier and others added 2 commits July 24, 2024 11:05
Co-authored-by: Dabz <d.gasparina@gmail.com>
Co-authored-by: loicgreffier <loic.greffier@michelin.com>
Co-authored-by: Dabz <d.gasparina@gmail.com>
Co-authored-by: loicgreffier <loic.greffier@michelin.com>
@mjsax mjsax merged commit 09be14b into apache:trunk Jul 25, 2024
@mjsax
Copy link
Copy Markdown
Member

mjsax commented Jul 25, 2024

Thanks for the follow-up PR. Merged to trunk.

abhi-ksolves pushed a commit to ksolves/kafka that referenced this pull request Jul 31, 2024
Co-authored-by: Dabz <d.gasparina@gmail.com>
Co-authored-by: loicgreffier <loic.greffier@michelin.com>

Minor code improvements across different classed, related to the `ProcessingExceptionHandler` implementation (KIP-1033).

Reviewers: Bruno Cadonna <bruno@confluent.io>, Matthias J. Sax <matthias@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kip Requires or implements a KIP streams

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants