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

[BEAM-11325] ReadFromKafkaDoFn should stop reading when topic/partition is removed or marked as stopped #13710

Merged
merged 1 commit into from Jan 21, 2021

Conversation

boyuanzz
Copy link
Contributor

@boyuanzz boyuanzz commented Jan 9, 2021

For design details, please refer to the doc here: https://docs.google.com/document/d/1FU3GxVRetHPLVizP3Mdv6mP5tpjZ3fd99qNjUI5DT5k/edit#

Next step is to add support of starting reading from new added TopicPartitions.

r: @dpmills @aromanenko-dev


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

Post-Commit Tests Status (on master branch)

Lang SDK Dataflow Flink Samza Spark Twister2
Go Build Status --- Build Status --- Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status
Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
--- Build Status ---
XLang Build Status Build Status Build Status --- Build Status ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status --- --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@boyuanzz boyuanzz force-pushed the kafka_remove branch 2 times, most recently from 2acbf8a to 1435e98 Compare January 12, 2021 22:05
@boyuanzz boyuanzz changed the title [WIP] initial commit [BEAM-11325] ReadFromKafkaDoFn should stop reading when topic/partition is removed or marked as stopped Jan 12, 2021
@aromanenko-dev
Copy link
Contributor

Thanks, I'll take a look!

Copy link
Contributor

@aromanenko-dev aromanenko-dev left a comment

Choose a reason for hiding this comment

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

LGTM in general, I left several comments, ptal.

Also, please, add Jira ID to commit message as a prefix.

Don't you think it will make sense to add a IT that test this functionality against "real" (see KafkaIOIT) Kafka cluster as well?

* A custom {@link SerializableFunction} that determines whether the {@link ReadFromKafkaDoFn}
* should stop reading from the given {@link TopicPartition}.
*/
public ReadSourceDescriptors<K, V> withCheckStopReadingFn(
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add an example to the main KafkaIO Javadoc how to use this functionality to make it more clear for users?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, will do. I'll also add support to commit transform together in this PR for reverting safety.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added more related javadoc around KafkaIO.

Thinking about the commit transform again. I don't think additional changes required here because:

  • For stopped TopicPartition, we still want to commit the offset
  • For deleted TopicPartition, we should get exceptions from Kafka Consumer API, which has been handled in the Commit transform.

I'll merge this PR if all these look good to you : )

@aromanenko-dev
Copy link
Contributor

Run Java KafkaIO Performance Test

@boyuanzz
Copy link
Contributor Author

The IT failed on pulling sdk harness docker image.

@boyuanzz
Copy link
Contributor Author

Run Java KafkaIO Performance Test

@boyuanzz
Copy link
Contributor Author

Don't you think it will make sense to add a IT that test this functionality against "real" (see KafkaIOIT) Kafka cluster as well?

I think ReadFromKafkaDoFnTest gives a good coverage and it may not be easy to add such an IT within current framework(it might be easier with Kafka Admin API but I need to have a try on that). I would prefer to have ITs in one separated PR later. What do you think?

@boyuanzz
Copy link
Contributor Author

It seems like KafkaIOIT has been failing for more than 1 month. The failure is the pipeline fails to pull java sdk harness docker image from gcr. It looks like an issue of test configuration.

@aromanenko-dev
Copy link
Contributor

aromanenko-dev commented Jan 20, 2021

@boyuanzz

I would prefer to have ITs in one separated PR later. What do you think?

Sounds good to me.

@aromanenko-dev
Copy link
Contributor

Run Java KafkaIO Performance Test

@aromanenko-dev
Copy link
Contributor

aromanenko-dev commented Jan 21, 2021

It seems like KafkaIOIT has been failing for more than 1 month. The failure is the pipeline fails to pull java sdk harness docker image from gcr. It looks like an issue of test configuration.

Do you have an idea why it got broken and how to fix it? This IT is very valuable since it runs tests agains different Kafka versions and, therefore, test the compatibility.

Other than that, I think we can merge this PR.

@boyuanzz
Copy link
Contributor Author

It seems like KafkaIOIT has been failing for more than 1 month. The failure is the pipeline fails to pull java sdk harness docker image from gcr. It looks like an issue of test configuration.

Do you have an idea why it got broken and how to fix it? This IT is very valuable since it runs tests agains different Kafka versions and, therefore, test the compatibility.

Other than that, I think we can merge this PR.

Yeah I'll explore the failure today. Thanks for your quick review!

@boyuanzz boyuanzz merged commit d2e1f69 into apache:master Jan 21, 2021
@boyuanzz boyuanzz deleted the kafka_remove branch March 11, 2021 18:33
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.

None yet

2 participants