Skip to content

[FLINK-7440] [kinesis] Add various eager serializability checks on to Kinesis connector#4537

Closed
tzulitai wants to merge 2 commits intoapache:masterfrom
tzulitai:FLINK-7440
Closed

[FLINK-7440] [kinesis] Add various eager serializability checks on to Kinesis connector#4537
tzulitai wants to merge 2 commits intoapache:masterfrom
tzulitai:FLINK-7440

Conversation

@tzulitai
Copy link
Contributor

What is the purpose of the change

This is a minor improvement for user experience for the Kinesis consumer and producer.
If the provided KinesisDeserializationSchema, KinesisSerializationSchema, KinesisPartitioner is not serializable, a more clear error message is shown instead of some vague "the implementation of RichSunkFunction is not serializable".

Brief change log

Changes are broken up into 2 commits:

  • for consumer: eagerly check serializability of KinesisDeserializationSchema, with better error msgs
  • for producer: eagerly check serializability of KinesisSerializationSchema and KinesisPartitioner, with better error msgs.

Verifying this change

Added new tests to both FlinkKinesisConsumerTest and FlinkKinesisProducer test, to verify that the expected error message is thrown (and also not thrown if the provided arg instances are serializable). Also included tests to check that FlinkKinesisConsumer and FlinkKinesisProducer themselves are serializable.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

…on schema in FlinkKinesisConsumer

This commit also adds tests for verifying that the FlinkKinesisConsumer
itself is serializable.
…oner is serializable in FlinkKinesisProducer

This commit also adds a test to verify that the FlinkKinesisProducer is
serializable.
@tzulitai
Copy link
Contributor Author

R: @bowenli86 would you like to take a look at the changes here?

Copy link
Contributor

@zentol zentol left a comment

Choose a reason for hiding this comment

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

+1

// check the configuration properties for any conflicting settings
KinesisConfigUtil.validateConsumerConfiguration(this.configProps);

checkArgument(
Copy link
Contributor

Choose a reason for hiding this comment

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

How about first checking for null, and then for serializability? (Just seem more intuitive to me)

return fakeRestoredState;
}

private final class NonSerializableDeserializationSchema implements KinesisDeserializationSchema<String> {
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add a comment explaining why this is not serializable and why the following one is serializable? Basically pointing out this class is not static.

@bowenli86
Copy link
Member

@tzulitai LGTM!

@bowenli86
Copy link
Member

Once this is checked in, we'll be more confident that #4473 is all good and it doesn't break anything

@tzulitai
Copy link
Contributor Author

@bowenli86 @zentol Thanks a lot for the reviews! I will address your comments and merge this.

tzulitai added a commit to tzulitai/flink that referenced this pull request Aug 15, 2017
…oner is serializable in FlinkKinesisProducer

This commit also adds a test to verify that the FlinkKinesisProducer is
serializable.

This closes apache#4537.
tzulitai added a commit to tzulitai/flink that referenced this pull request Aug 16, 2017
…oner is serializable in FlinkKinesisProducer

This commit also adds a test to verify that the FlinkKinesisProducer is
serializable.

This closes apache#4537.
tzulitai added a commit to tzulitai/flink that referenced this pull request Aug 18, 2017
…oner is serializable in FlinkKinesisProducer

This commit also adds a test to verify that the FlinkKinesisProducer is
serializable.

This closes apache#4537.
@asfgit asfgit closed this in 98737f9 Sep 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants