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

[FLINK-29395][Connector/Kinesis] Handle empty deaggregated records… #20945

Merged

Conversation

hlteoh37
Copy link
Contributor

@hlteoh37 hlteoh37 commented Oct 4, 2022

…in FanOutRecordPublisher

What is the purpose of the change

The consumer fails when three conditions are met:

  1. Kinesis EFO record publisher uses an AT_TIMESTAMP starting position.
  2. The first record batch is not empty.
  3. The deaggregated record batch is empty.

This can happen when the user writes aggregated records into their Kinesis stream whilst specifying the explicitHashKey for every single user record. When resharding occurs, there is a possibility that records within the same aggregated batch fall into two different shards, since they have different explicit hash keys. When this happens, the deaggregated records are dropped. (We need to do this in Kinesis Consumer so we do not process duplicate records. See awslabs/kinesis-aggregation#11)

If all deaggregated records are dropped, the consumer receives an empty deaggregated record batch even though the record batch is not empty.

Brief change log

This is fixed by returning the AT_TIMESTAMP starting position when receiving an AT_TIMESTAMP sentinel sequence number.

Verifying this change

  • Unit tests

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: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

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

@hlteoh37 hlteoh37 force-pushed the feature/kinesis_timestamp_fix_master branch from 34ff3f4 to 2d1d842 Compare October 4, 2022 07:53
@flinkbot
Copy link
Collaborator

flinkbot commented Oct 4, 2022

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@hlteoh37 hlteoh37 force-pushed the feature/kinesis_timestamp_fix_master branch 2 times, most recently from 89ef05f to 811cbe1 Compare October 9, 2022 23:41
@hlteoh37 hlteoh37 changed the title [FLINK-29395][Connector/Kinesis] Make EFO consumer resilient when con… [FLINK-29395][Connector/Kinesis] Handle empty deaggregated records… Oct 9, 2022
Copy link
Contributor

@dannycranmer dannycranmer left a comment

Choose a reason for hiding this comment

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

Thanks for the deep dive! The solution LGTM, just one comment on the unit test

@hlteoh37 hlteoh37 force-pushed the feature/kinesis_timestamp_fix_master branch from 811cbe1 to 74a6b1c Compare October 10, 2022 08:26
Copy link
Contributor

@dannycranmer dannycranmer left a comment

Choose a reason for hiding this comment

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

Thanks @hlteoh37m LGTM

@dannycranmer dannycranmer merged commit ef93ae4 into apache:master Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants