Skip to content

KAFKA-9310: Handle UnknownProducerId from RecordCollector.send - #7845

Merged
vvcephei merged 2 commits into
apache:trunkfrom
vvcephei:KAFKA-9310-catch-unknown-producer-id
Dec 21, 2019
Merged

KAFKA-9310: Handle UnknownProducerId from RecordCollector.send#7845
vvcephei merged 2 commits into
apache:trunkfrom
vvcephei:KAFKA-9310-catch-unknown-producer-id

Conversation

@vvcephei

@vvcephei vvcephei commented Dec 17, 2019

Copy link
Copy Markdown
Contributor

Follow on for #7748 .

Additionally handle synchronous UnknownProducerId in RecordCollectorImpl.send , which was overlooked in the prior PR.

Committer Checklist (excluded from commit message)

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

@vvcephei
vvcephei requested a review from mjsax December 17, 2019 21:45
@vvcephei

Copy link
Copy Markdown
Contributor Author

@mjsax , do you have a chance to look at this small fix?

@mjsax

mjsax commented Dec 17, 2019

Copy link
Copy Markdown
Member

Checkstyle:

13:50:48 > Task :streams:checkstyleMain
13:50:48 [ant:checkstyle] [ERROR] /home/jenkins/jenkins-slave/workspace/kafka-pr-jdk11-scala2.12/streams/src/main/java/org/apache/kafka/streams/processor/internals/RecordCollectorImpl.java:234:61: '&&' is not followed by whitespace. [WhitespaceAround]
13:50:48 [ant:checkstyle] [ERROR] /home/jenkins/jenkins-slave/workspace/kafka-pr-jdk11-scala2.12/streams/src/main/java/org/apache/kafka/streams/processor/internals/RecordCollectorImpl.java:237: 'if' child has incorrect indentation level 12, expected level should be 16. [Indentation]

}

@SuppressWarnings("unchecked")
@Test(expected = RecoverableClientException.class)

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.

we should avoid to use this construct but use assertThrows() instead.

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.

Should we also verify the root cause?

}

@SuppressWarnings("unchecked")
@Test(expected = RecoverableClientException.class)

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.

as above

collector.send("topic1", "3", "0", null, null, stringSerializer, stringSerializer, streamPartitioner);
}

@SuppressWarnings("unchecked")

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.

What is the reason for this?

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.

Missing generics in the method. I fixed it.

uncaughtException.getCause() instanceof ProducerFencedException) {
if (uncaughtException instanceof KafkaException &&(
uncaughtException.getCause() instanceof ProducerFencedException ||
uncaughtException.getCause() instanceof UnknownProducerIdException

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.

The error message of RecoverableClientException does not match any longer... (I would recommend to not add the error name to begin with, as the root cause exception is pass into the constructor anyway)

@vvcephei

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback, @mjsax ! All good catches. And sorry about the checkstyle.
I've updated the PR.

@mjsax mjsax left a comment

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.

Thanks. LGTM.

@vvcephei
vvcephei merged commit cdbf40d into apache:trunk Dec 21, 2019
@vvcephei
vvcephei deleted the KAFKA-9310-catch-unknown-producer-id branch December 21, 2019 18:30
vvcephei added a commit that referenced this pull request Dec 21, 2019
Reviewers:  Matthias J. Sax <mjsax@apache.org>
qq619618919 pushed a commit to qq619618919/kafka that referenced this pull request May 12, 2020
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.

2 participants