Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[schema] key/value schema enhancement #4548

Merged
merged 6 commits into from
Jun 20, 2019

Conversation

sijie
Copy link
Member

@sijie sijie commented Jun 18, 2019

Motivation

  • The code for encoding and decoding key/value schema is spreading over multiple places.
  • Make code changes to prepare supporting key/value schema in AUTO consumers
  • Make schema tools display key/value schema in a pretty format

Modifications

  • Move the common logic of encoding and decoding key/value schema to a common class KeyValueSchemaInfo
  • Expose the common class in DefaultImplementation so that it can be available for public usage
  • Fix the display problem on displaying key/value schema

Verify this change

  • Add bunch of the unit tests for key/value schemas

*Motivation*

- The code for encoding and decoding key/value schema is spreading over multiple places.
- Make code changes to prepare supporting key/value schema in AUTO consumers
- Make schema tools display key/value schema in a pretty format

*Modifications*

- Move the common logic of encoding and decoding key/value schema to a common class KeyValueSchemaInfo
- Expose the common class in DefaultImplementation so that it can be available for public usage
- Fix the display problem on displaying key/value schema

*Verify this change*

- Add bunch of the unit tests for key/value schemas
@sijie sijie added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages type/cleanup Code or doc cleanups e.g. remove the outdated documentation or remove the code no longer in use component/schemaregistry labels Jun 18, 2019
@sijie sijie self-assigned this Jun 18, 2019
@sijie
Copy link
Member Author

sijie commented Jun 18, 2019

retest this please

Copy link
Contributor

@codelipenghui codelipenghui left a comment

Choose a reason for hiding this comment

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

Overall lgtm. just left a question

@@ -36,7 +37,7 @@
/**
* Message schema definition
*/
public interface Schema<T> {
public interface Schema<T> extends SchemaWriter<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why consider to inherit SchemaWriter?

* @param valueWriter a writer to encode value object
* @return the encoded bytes array
*/
public static <K, V> byte[] encode(K key, SchemaWriter<K> keyWriter,
Copy link
Member Author

Choose a reason for hiding this comment

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

@codelipenghui since I only need a serialize method for serializing K or V into bytes. so I use SchemaWriter as the interface in the util functions. To use existing Schema interface, I extend Schema interface to SchemaWriter. Maybe I can just rewrite it using a different approach to get rid of extending Schema from SchemaWriter. Let me give it a shot.

@sijie
Copy link
Member Author

sijie commented Jun 18, 2019

@codelipenghui I have addressed your comment. PTAL

@sijie
Copy link
Member Author

sijie commented Jun 18, 2019

run java8 tests
run integration tests

@codelipenghui
Copy link
Contributor

@sijie 👍, LGTM.

@codelipenghui
Copy link
Contributor

run java8 tests
run integration tests

Copy link
Member

@jiazhai jiazhai left a comment

Choose a reason for hiding this comment

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

+1, lgtm.

@sijie
Copy link
Member Author

sijie commented Jun 20, 2019

run java8 tests

1 similar comment
@sijie
Copy link
Member Author

sijie commented Jun 20, 2019

run java8 tests

@sijie sijie added this to the 2.4.0 milestone Jun 20, 2019
@sijie sijie merged commit 82d9e71 into apache:master Jun 20, 2019
@sijie sijie deleted the move_kv_schema_to_common branch June 20, 2019 05:30
jiazhai pushed a commit that referenced this pull request Jul 1, 2020
Motivation
Pulsar 2.4.0 Added schema versioning to support multi version messages produce and consume #3876 #3670 #4211 #4325 #4548. but the doc is not updated accordingly.

Modifications
Update the schema version in the pulsar registry doc for releases 2.4.0/2.4.1/2.4.2.
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
Motivation
Pulsar 2.4.0 Added schema versioning to support multi version messages produce and consume apache#3876 apache#3670 apache#4211 apache#4325 apache#4548. but the doc is not updated accordingly.

Modifications
Update the schema version in the pulsar registry doc for releases 2.4.0/2.4.1/2.4.2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/cleanup Code or doc cleanups e.g. remove the outdated documentation or remove the code no longer in use type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants