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

[mysql] add custom jdbc properties to debezium mysql connection (#674) #1217

Merged
merged 6 commits into from
Aug 3, 2022

Conversation

ruanhang1993
Copy link
Contributor

This PR fix the bug that the mysql jdbc connection does not contain the jdbc properties set by users.
The problem is that the debezium mysql connection uses the fixed url pattern.

Changes:

  1. add new mysql connection class(MySqlConnectionWithJdbcProperties) and new inner mysql connection configuration class
  2. change the usage in mysql cdc from MySqlConnection to MySqlConnectionWithJdbcProperties

Copy link
Contributor

@leonardBang leonardBang left a comment

Choose a reason for hiding this comment

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

Thanks @ruanhang1993 for the contribution, I left some comments

Comment on lines 70 to 71
DebeziumUtils.createMySqlConnection(
from(dbzProperties), sourceConfig.getJdbcProperties());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
DebeziumUtils.createMySqlConnection(
from(dbzProperties), sourceConfig.getJdbcProperties());
DebeziumUtils.createMySqlConnection(sourceConfig);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is used by the legacy source whose sourceConfig is null. I will revert this change to use new Properties().

@leonardBang leonardBang merged commit a5dd0c0 into apache:master Aug 3, 2022
@ruanhang1993 ruanhang1993 deleted the github-674 branch August 11, 2022 07:45
@foxmorg
Copy link

foxmorg commented Jan 19, 2023

Hi there! Trying to update com.ververica:flink-connector-mysql-cdc from 2.2.1 to 2.3.0 version and getting such Exception:

Caused by: java.lang.NoSuchMethodError: 'void io.debezium.connector.mysql.MySqlConnection$MySqlConnectionConfiguration.<init>(io.debezium.config.Configuration, java.util.Properties)'

    at com.ververica.cdc.connectors.mysql.debezium.DebeziumUtils.createMySqlConnection(DebeziumUtils.java:78)

    at com.ververica.cdc.connectors.mysql.debezium.DebeziumUtils.createMySqlConnection(DebeziumUtils.java:71)

    at com.ververica.cdc.connectors.mysql.source.reader.MySqlSplitReader.checkSplitOrStartNext(MySqlSplitReader.java:138)

    at com.ververica.cdc.connectors.mysql.source.reader.MySqlSplitReader.fetch(MySqlSplitReader.java:71)

    at org.apache.flink.connector.base.source.reader.fetcher.FetchTask.run(FetchTask.java:58)

    at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.runOnce(SplitFetcher.java:142)

    at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.run(SplitFetcher.java:105)

    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

    ... 1 more

As I understand, the reason because I have two dependencies as result:
debezium-connector-mysql-1.6.4.Final.jar
flink-connector-mysql-cdc-2.3.0.jar

with the same class io.debezium.connector.mysql.MySqlConnection$MySqlConnectionConfiguration but first one with only one constructor. So the question is, why was this class renamed in this commit 5415bcf and how may I fix this issue?

@foxmorg
Copy link

foxmorg commented Jul 27, 2023

With 2.4.0 the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants