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
Conversation
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit f6a4af3 (Tue Nov 03 12:40:53 UTC 2020) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
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 commandsThe @flinkbot bot supports the following commands:
|
cc @fsk119 |
public Integer getParallelism() { | ||
return parallelism; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 ==
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -36,6 +38,23 @@ static OutputFormatProvider of(OutputFormat<RowData> outputFormat) { | |||
return () -> outputFormat; |
There was a problem hiding this comment.
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)
a20a546
to
5ba8c44
Compare
@flinkbot run azure |
There was a problem hiding this 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.
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
…onnector This closes apache#13907
The failed test is not related to this PR, it has been tracked by FLINK-20433. Will merge this issue. |
…onnector This closes apache#13907 Co-authored-by: zhuxiaoshang <zhushang@qutoutiao.net>
What is the purpose of the change
Support sink parallelism configuration to JDBC connector
Brief change log
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (no)Documentation