Skip to content

[KAFKA-6923] Refactoring Serializer/Deserializer - #5494

Merged
hachikuji merged 5 commits into
apache:trunkfrom
viktorsomogyi:KAFKA-6923
Sep 20, 2018
Merged

[KAFKA-6923] Refactoring Serializer/Deserializer#5494
hachikuji merged 5 commits into
apache:trunkfrom
viktorsomogyi:KAFKA-6923

Conversation

@viktorsomogyi

Copy link
Copy Markdown
Contributor

This is the implementation of KIP-336.

Committer Checklist (excluded from commit message)

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

@satishd satishd 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 @viktorsomogyi for the PR.

Overall LGTM, good to have tests for the introduced methods with Serializer and Deserializer.

@viktorsomogyi

Copy link
Copy Markdown
Contributor Author

@satishd thanks very much for the review. Do you have any specific test case in mind I should implement?

@satishd

satishd commented Aug 15, 2018

Copy link
Copy Markdown
Member

@viktorsomogyi As you have added new methods in Serializer/Deserializer, it is good to add a test to make sure those methods are invoked from producer and consumer respectively in an expected manner. You may want to look at the tests added earlier for ExtendedSerializer/ExtendedDeserializer here(1).

  1. https://github.com/apache/kafka/blob/trunk/core/src/test/scala/integration/kafka/api/PlaintextConsumerTest.scala#L70

@viktorsomogyi

Copy link
Copy Markdown
Contributor Author

@satishd thanks, I'll update my PR soon with added tests.

@viktorsomogyi

Copy link
Copy Markdown
Contributor Author

@satishd rebased on latest trunk + added some tests. Will add more based on the outcome of the KIP discussions.

@viktorsomogyi

Copy link
Copy Markdown
Contributor Author

retest this please

* @return deserialized typed data; may be null
*/
T deserialize(String topic, byte[] data);
default T deserialize(String topic, byte[] data) {

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 @viktorsomogyi ,

Sorry I missed the KIP discussion, but I just read the KIP over and didn't see a explanation of this:

Can you explain the reason to provide a default implementation of this method?

Thanks,
-John

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.

Ah, I just now saw the discussion in the vote thread. It sounds like you're going to remove this default. Sorry about that.

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. Thank you for the review though. :)
I'll updte this piece of code soon.

@hachikuji hachikuji self-assigned this Sep 19, 2018

@hachikuji hachikuji 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.

Thanks @viktorsomogyi. I had only one comment.

}

@Override
public byte[] serialize(String topic, Headers headers, ByteBuffer data) {

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 may have been left behind from a previous iteration, but shouldn't we just rely on the default implementation?

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.

Indeed, I'll correct it.

@satishd

satishd commented Sep 20, 2018

Copy link
Copy Markdown
Member

retest this please

@satishd satishd 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 @viktorsomogyi for addressing review comments.
+1 LGTM

@hachikuji hachikuji 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.

LGTM. Thanks for the patch and the KIP.

@hachikuji

Copy link
Copy Markdown
Contributor

retest this please

@hachikuji
hachikuji merged commit f1f7192 into apache:trunk Sep 20, 2018
@hachikuji hachikuji mentioned this pull request Sep 21, 2018
3 tasks
@ijuma

ijuma commented Sep 23, 2018

Copy link
Copy Markdown
Member

@viktorsomogyi I think it would be good to include an upgrade note.

pengxiaolong pushed a commit to pengxiaolong/kafka that referenced this pull request Jun 14, 2019
This patch implements KIP-336. It adds a default implementation to the Serializer/Deserializer interface to support the use of headers and it deprecates the ExtendedSerializer and ExtendedDeserializer interfaces for later removal.

Reviewers: Satish Duggana <sduggana@hortonworks.com>, John Roesler <john@confluent.io>, Jason Gustafson <jason@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants