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-19942][Connectors / JDBC]Support sink parallelism configuration to JDBC connector #13907

Merged
merged 1 commit into from Dec 22, 2020

Conversation

zhuxiaoshang
Copy link
Contributor

What is the purpose of the change

Support sink parallelism configuration to JDBC connector

Brief change log

  • Support sink parallelism configuration to JDBC connector

Verifying this change

This change added tests and can be verified as follows:

  • JdbcDynamicTableFactoryTest#testJDBCSinkWithParallelism

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/Mesos, 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? (no)

@flinkbot
Copy link
Collaborator

flinkbot commented Nov 3, 2020

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit f6a4af3 (Tue Nov 03 12:40:53 UTC 2020)

Warnings:

  • This pull request references an unassigned Jira ticket. According to the code contribution guide, tickets need to be assigned before starting with the implementation work.

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Nov 3, 2020

CI report:

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

@zhuxiaoshang
Copy link
Contributor Author

cc @JingsongLi @wuchong

@wuchong
Copy link
Member

wuchong commented Dec 9, 2020

cc @fsk119

public Integer getParallelism() {
return parallelism;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Copy link
Contributor

Choose a reason for hiding this comment

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

does the equals and hash function need to be modify? @zhuxiaoshang

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes you are right @zhisheng17 ,I ignored.

@@ -66,12 +76,13 @@ public boolean equals(Object o) {
JdbcExecutionOptions that = (JdbcExecutionOptions) o;
return batchIntervalMs == that.batchIntervalMs &&
batchSize == that.batchSize &&
maxRetries == that.maxRetries;
maxRetries == that.maxRetries &&
parallelism == that.parallelism;
Copy link
Contributor

Choose a reason for hiding this comment

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

Will return false when parallelism > 128?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe the framework will check whether the parallelism > max parallelism limit.
Moreover where do you get the 128?IIRC,128 is the limit of max keyGroup.

Copy link
Contributor

@V1ncentzzZ V1ncentzzZ Dec 9, 2020

Choose a reason for hiding this comment

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

My suggestion is that use equals() instead of == beacause of the == will return false when parallelism's value more than 128.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok,I have changed it.

@@ -66,12 +76,13 @@ public boolean equals(Object o) {
JdbcExecutionOptions that = (JdbcExecutionOptions) o;
return batchIntervalMs == that.batchIntervalMs &&
batchSize == that.batchSize &&
maxRetries == that.maxRetries;
maxRetries == that.maxRetries &&
parallelism == that.parallelism;
Copy link
Contributor

Choose a reason for hiding this comment

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

@zhuxiaoshang maybe, idea will recommend to use equals() instead of ==

Copy link
Member

@fsk119 fsk119 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 your contribution. Please rebase your branch to master.
image

@@ -36,6 +38,23 @@ static OutputFormatProvider of(OutputFormat<RowData> outputFormat) {
return () -> outputFormat;
Copy link
Member

Choose a reason for hiding this comment

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

It's seem this method is useless now? If no one uses it, please delete it. Otherwise, we can just treat this method as
of(outputFormat, null)

@fsk119
Copy link
Member

fsk119 commented Dec 10, 2020

@flinkbot run azure

Copy link
Member

@fsk119 fsk119 left a comment

Choose a reason for hiding this comment

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

LGTM. The failed tests are irrelevant to this pr.

Copy link
Member

@wuchong wuchong left a comment

Choose a reason for hiding this comment

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

I also left some comments.

*/
static OutputFormatProvider of(OutputFormat<RowData> outputFormat) {
return () -> outputFormat;
static OutputFormatProvider of(OutputFormat<RowData> outputFormat, Integer sinkParallelism) {
Copy link
Member

Choose a reason for hiding this comment

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

This is a public API. Please add a new method instead of changing the existing one, otherwise, it's not API compatible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to @fsk119 's suggestion,I removed the old method because it is never used.
If not i can get it back.

Copy link
Member

Choose a reason for hiding this comment

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

This is a public API. We don't know whether it is used by external projects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok,got it

long batchIntervalMs,
int batchSize,
int maxRetries,
Integer parallelism) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about adding this to JdbcExecutionOptions, because JdbcExecutionOptions is an public API for JdbcSink. For JdbcSink#sink, this may looks weird because the configured parallelism doesn't work as the returned object is SinkFunction.

Another option is adding the parallelism to JdbcDmlOption or JdbcOption, they are both internal class.

Copy link
Member

@wuchong wuchong left a comment

Choose a reason for hiding this comment

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

LGTM.

Will merge this once Azure turns green.

@wuchong
Copy link
Member

wuchong commented Dec 22, 2020

The failed test is not related to this PR, it has been tracked by FLINK-20433. Will merge this issue.

@wuchong wuchong merged commit 2ac4735 into apache:master Dec 22, 2020
meijies pushed a commit to meijies/flink that referenced this pull request Dec 28, 2020
…onnector

This closes apache#13907

Co-authored-by: zhuxiaoshang <zhushang@qutoutiao.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants