[FLINK-38522][cdc connector mysql] use ssl for BinaryLogClient when searching for binlog offset for starting mysql cdc from timestamp#4156
Open
watsonjo737 wants to merge 11 commits intoapache:masterfrom
Open
Conversation
…earching for binlog offset for starting mysql cdc from timestamp
gguptp
reviewed
Oct 21, 2025
...or-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/debezium/DebeziumUtils.java
Show resolved
Hide resolved
gguptp
approved these changes
Oct 21, 2025
...ysql-cdc/src/test/java/org/apache/flink/cdc/connectors/mysql/debezium/DebeziumUtilsTest.java
Show resolved
Hide resolved
...or-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/debezium/DebeziumUtils.java
Outdated
Show resolved
Hide resolved
…re ssl and tests to ensure ssl config is honored
...or-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/debezium/DebeziumUtils.java
Outdated
Show resolved
Hide resolved
… test, throw runtime exception when we have invalid ssl mode
lvyanquan
reviewed
Dec 5, 2025
| public static BinlogOffset findBinlogOffset( | ||
| long targetMs, MySqlConnection connection, MySqlSourceConfig mySqlSourceConfig) { | ||
| MySqlConnection.MySqlConnectionConfiguration config = connection.connectionConfig(); | ||
| BinaryLogClient client = |
Contributor
There was a problem hiding this comment.
We can centralize the SSL configuration in the DebeziumUtils#createBinaryClient method,
and based on the implementation of MySqlStreamingChangeEventSource, we also need to add the following code to set SslSocketFactory:
Author
There was a problem hiding this comment.
Thanks for the review and recommendation @lvyanquan !
I have now updated this PR:
- ssl config now centralised under DebeziumUtils#createBinaryClient
- updated BinlogSplitReader and SnapshotSplitReader to use the new version of createBinaryClient
- added sslSocketFactory config, similar to what is used in flink-cdc/flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/io/debezium/connector/mysql/MySqlStreamingChangeEventSource.java
- updated iTest to include testing sslSocketFactory.
…add ssl socketFactory to ensure consistency with io.debezium code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/FLINK-38522
What is the purpose of the change
When using StartupOptions.timestamp(), the MySQL CDC connector calls DebeziumUtils.findBinlogOffset() to locate the appropriate binlog position. This method creates a short-lived BinaryLogClient to scan binlog files, but does not configure SSL mode on the client.
If the MySQL server requires SSL connections (e.g., require_secure_transport=ON or SSL mode configured in connection parameters), the connection fails because the BinaryLogClient attempts an unencrypted connection.
This Pull Request uses the ssl mode provided as part of the connection config for the BinaryLogClient as well to prevent this issue in cases where mysql is configured for require_secure_transport.
Changes
Set SSLMode to match what was provided in the connectionConfig for BinaryLogClient
Add unit test to ensure SSLMode is converted correctly.
Verifying this change