Version and Environment
- Apache Doris version: 4.1.2 (also reproduced on 4.1.3-rc02, bug is present on master/4.2-SNAPSHOT)
- Deployment mode: Compute-storage-decoupled (cloud mode), but the bug also applies to shared-nothing mode
- Source database: MySQL 8.0 / Amazon Aurora MySQL 8.0 (
8.0.mysql_aurora.3.10.3) with require_secure_transport=ON
What happened
A CDC streaming job configured with offset='latest' (or earliest) and ssl_mode='require' immediately fails with a JDBC connection error at job startup. The job never begins replication.
What was expected
The job should connect using SSL to resolve the current binlog position and then begin streaming.
Minimal Reproduction
- Configure MySQL/Aurora with
require_secure_transport=ON:
-- On MySQL:
SET GLOBAL require_secure_transport = ON;
- Upload a CA certificate to Doris (if using verify-ca, otherwise ssl_mode=require suffices):
CREATE FILE "mysql_ca.pem"
PROPERTIES ("url" = "file:///path/to/rds-combined-ca-bundle.pem", "catalog" = "internal");
- Create a CDC streaming job:
CREATE JOB my_cdc_job
PROPERTIES (
'type' = 'insert',
'format' = 'cdc'
)
FROM MYSQL (
'host' = '10.0.1.100',
'port' = '3306',
'user' = 'cdc_user',
'password' = '***',
'database' = 'mydb',
'table' = 'orders',
'offset' = 'latest',
'ssl_mode' = 'require'
)
INTO TABLE mydb.orders;
- The job fails immediately. The BE
cdc_client log shows:
java.sql.SQLException: Could not create connection to database server.
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol
or (depending on MySQL configuration):
java.sql.SQLException: Connections using insecure transport are prohibited while --require_secure_transport=ON
Root Cause
In MySqlSourceReader.generateMySqlConfig() (fs_brokers/cdc_client/src/main/java/org/apache/doris/cdcclient/source/reader/mysql/MySqlSourceReader.java), the startup mode switch block (starting at line 907 in tag 4.1.2) calls initializeEffectiveOffset() for latest, earliest, and timestamp modes. This method creates a MySqlConnection via DebeziumUtils.createMySqlConnection(config) — i.e., it opens a JDBC connection to the source database to resolve the current binlog file and position.
However, the SSL properties (ssl_mode → database.ssl.mode / sslMode, and ssl_rootcert → truststore path) are applied to jdbcProperties and dbzProps after the startup mode block (line 955+ in tag 4.1.2). So when initializeEffectiveOffset() builds its config and opens a connection, SSL is not yet configured. Against a MySQL instance with require_secure_transport=ON, the plaintext connection attempt is rejected.
Affected Modes
offset='latest' — always calls initializeEffectiveOffset()
offset='earliest' — always calls initializeEffectiveOffset()
- Timestamp offset (13-digit epoch) — always calls
initializeEffectiveOffset()
The offset='initial' and offset='snapshot' modes are NOT affected because they do not resolve binlog position at configuration time.
Suggested Fix
Move the JDBC properties + SSL configuration block to before the startup mode switch block. When SSL properties are absent, the behaviour is identical (the JDBC connection simply doesn't use SSL). The reordering has no effect on non-SSL users.
Version and Environment
8.0.mysql_aurora.3.10.3) withrequire_secure_transport=ONWhat happened
A CDC streaming job configured with
offset='latest'(orearliest) andssl_mode='require'immediately fails with a JDBC connection error at job startup. The job never begins replication.What was expected
The job should connect using SSL to resolve the current binlog position and then begin streaming.
Minimal Reproduction
require_secure_transport=ON:CREATE JOB my_cdc_job PROPERTIES ( 'type' = 'insert', 'format' = 'cdc' ) FROM MYSQL ( 'host' = '10.0.1.100', 'port' = '3306', 'user' = 'cdc_user', 'password' = '***', 'database' = 'mydb', 'table' = 'orders', 'offset' = 'latest', 'ssl_mode' = 'require' ) INTO TABLE mydb.orders;cdc_clientlog shows:or (depending on MySQL configuration):
Root Cause
In
MySqlSourceReader.generateMySqlConfig()(fs_brokers/cdc_client/src/main/java/org/apache/doris/cdcclient/source/reader/mysql/MySqlSourceReader.java), the startup mode switch block (starting at line 907 in tag 4.1.2) callsinitializeEffectiveOffset()forlatest,earliest, and timestamp modes. This method creates aMySqlConnectionviaDebeziumUtils.createMySqlConnection(config)— i.e., it opens a JDBC connection to the source database to resolve the current binlog file and position.However, the SSL properties (
ssl_mode→database.ssl.mode/sslMode, andssl_rootcert→ truststore path) are applied tojdbcPropertiesanddbzPropsafter the startup mode block (line 955+ in tag 4.1.2). So wheninitializeEffectiveOffset()builds its config and opens a connection, SSL is not yet configured. Against a MySQL instance withrequire_secure_transport=ON, the plaintext connection attempt is rejected.Affected Modes
offset='latest'— always callsinitializeEffectiveOffset()offset='earliest'— always callsinitializeEffectiveOffset()initializeEffectiveOffset()The
offset='initial'andoffset='snapshot'modes are NOT affected because they do not resolve binlog position at configuration time.Suggested Fix
Move the JDBC properties + SSL configuration block to before the startup mode switch block. When SSL properties are absent, the behaviour is identical (the JDBC connection simply doesn't use SSL). The reordering has no effect on non-SSL users.