Skip to content

KAFKA-9131: Remove dead code for handling timeout exception#7635

Merged
guozhangwang merged 5 commits into
apache:trunkfrom
gleb-kom:KAFKA-9131
Dec 5, 2019
Merged

KAFKA-9131: Remove dead code for handling timeout exception#7635
guozhangwang merged 5 commits into
apache:trunkfrom
gleb-kom:KAFKA-9131

Conversation

@gleb-kom

@gleb-kom gleb-kom commented Nov 2, 2019

Copy link
Copy Markdown
Contributor

…ns in catch clause and move it to the callback

More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.

Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@mjsax mjsax added the streams label Nov 4, 2019
@mjsax

mjsax commented Nov 5, 2019

Copy link
Copy Markdown
Member

@guozhangwang @hachikuji -- would appreciate a review of this PR (for details look into https://issues.apache.org/jira/browse/KAFKA-9131 -- seems we change some producer code with regard to handling exceptions? Would be good if you could verify that this PR makes sense).

@guozhangwang

Copy link
Copy Markdown
Contributor

@mjsax I looked at the code and it seems that producer.send indeed no longer throwing TimeoutException any more (hence we should update KafkaProducer.send javadoc as well to remove the possible thrown exception).

About the proposal on the streams side, it looks good to me. Thanks @gleb-kom !!

@guozhangwang

Copy link
Copy Markdown
Contributor

@vvcephei could you also take a look at this PR as well?

@vvcephei

vvcephei commented Nov 8, 2019

Copy link
Copy Markdown
Contributor

@guozhangwang . Roger that. I'll take a look.

@vvcephei vvcephei left a comment

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.

Hey @gleb-kom ,

Thanks for the PR!

Can you go ahead and remove the @throws TimeoutException from the KafkaProducer#send javadoc as well?

Looking at the code in doSend it looks like it's no longer possible for that method to directly throw any ApiException (it would always pass it to the callback instead). I'll leave it to you if you also want to clean up the other @throws declarations in the javadoc that are also no longer true.

Other than the above, and the one inline comment I made, this looks good to me!

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.

Can you move the comments from L136-7 below the new block, so that it can maintain its association with the RetriableException? Maybe you can put it inside the right block to keep it from getting dissociated again.

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.

I moved the comment below as you asked. However, on a personal note I think the both blocks are the right ones as TimeoutException is a subclass of Retriable Exception.

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.

I see your point, but it seems like the comment is more acknowledging that using RetriableException as a catch-all for all "retriable exceptions" isn't guaranteed to work, although it's the best we can do right now. If I understood the consumer API, though, TimeoutException is recommended as the way to catch "timeout exceptions".

But this might also be me justifying the position after the fact... Anyway, thanks for making the change.

@gleb-kom

gleb-kom commented Nov 8, 2019

Copy link
Copy Markdown
Contributor Author

@guozhangwang @vvcephei
Thank you for the review. I removed @throws in Javadoc from send and added it to waitOnMetada.

@vvcephei vvcephei left a comment

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.

This LGTM. Thanks @gleb-kom

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.

Remove this suppress and fix generic.

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.

specify generic -> MockProducer<byte[], byte[]>

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.

remove try-fail-catch and rewrite to

final StreamsException expected = assertThrows(StreamsException.class, () -> collector.flush());
assertTrue(expected.getCause() instanceof TimeoutException);
assertTrue(expected.getMessage().endsWith(topic1TimeoutHint));

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: avoid double blank } catch should we single blank } catch

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.

I am surprised the linter did not catch it before you.

@mjsax

mjsax commented Nov 10, 2019

Copy link
Copy Markdown
Member

Some nit about code style. Overall LGMT. Can merge after addressed.

@mjsax mjsax changed the title KAFKA-9131 remove dead code responsible for handling timeout exceptio… KAFKA-9131: Remove dead code for handling timeout exception Nov 10, 2019
@gleb-kom

Copy link
Copy Markdown
Contributor Author

@mjsax
Thanks for the review. I addressed your comments.

@mjsax

mjsax commented Dec 1, 2019

Copy link
Copy Markdown
Member

Java 11 / 2.12 passed. Java 11 / 2.13 and Java8 failed (test results are not available any longer).

Retest this please. \cc @vvcephei for merging.

@guozhangwang

Copy link
Copy Markdown
Contributor

@gleb-kom I tried to merge the PR but found it needs some rebasing, could you do that?

@gleb-kom

gleb-kom commented Dec 4, 2019

Copy link
Copy Markdown
Contributor Author

@guozhangwang done

@guozhangwang guozhangwang merged commit ba365bb into apache:trunk Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants