github-actions[bot] commented on code in PR #62700:
URL: https://github.com/apache/doris/pull/62700#discussion_r3122350502
##########
fs_brokers/cdc_client/src/main/java/org/apache/doris/cdcclient/utils/SmallFileMgr.java:
##########
@@ -216,9 +232,86 @@ static String getFilePath(
}
}
+ /**
+ * Resolve a FILE: reference to a PKCS12 truststore path, converting the
PEM on first access.
+ * For connectors (e.g. Debezium MySQL) that require JKS/PKCS12 rather
than raw PEM.
+ *
+ * @param filePath FILE reference, format: FILE:{file_id}:{md5}
+ * @return absolute local path to the PKCS12 truststore
+ */
+ public static String getPkcs12TruststorePath(String filePath) {
+ return pkcs12TruststorePath(getFilePath(filePath));
+ }
+
+ /** Package-private overload that accepts a custom local directory, used
for testing. */
+ static String getPkcs12TruststorePath(
+ String feMasterAddress, String filePath, String clusterToken,
String localDir) {
+ return pkcs12TruststorePath(getFilePath(feMasterAddress, filePath,
clusterToken, localDir));
+ }
+
Review Comment:
`PKCS12_CACHE` only memoizes the generated path, so once this fast-path hits
we never re-check whether the `.p12` still exists. If that file is deleted
after the first successful conversion, every later job in the same CDC client
process gets a stale path and Debezium fails when it tries to open the
truststore, even though the source PEM is still present and we could regenerate
it immediately.
The new `testPkcs12SecondCallUsesMemoryCache()` currently locks in this
stale-path behavior. Could we verify the cached file still exists before
returning it (or fall back into the synchronized regeneration path)?
##########
regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job_ssl.groovy:
##########
@@ -0,0 +1,158 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+import org.awaitility.Awaitility
+
+import static java.util.concurrent.TimeUnit.SECONDS
+
+suite("test_streaming_mysql_job_ssl",
"p0,external,mysql,external_docker,external_docker_mysql,nondatalake") {
+ def jobName = "test_streaming_mysql_job_name_ssl"
+ def currentDb = (sql "select database()")[0][0]
+ def table1 = "user_info_mysql_normal1_ssl"
+ def mysqlDb = "test_cdc_db_ssl"
+
+ sql """DROP JOB IF EXISTS where jobname = '${jobName}'"""
+ sql """drop table if exists ${currentDb}.${table1} force"""
+
+
+ String enabled = context.config.otherConfigs.get("enableJdbcTest")
+ if (enabled != null && enabled.equalsIgnoreCase("true")) {
+ String mysql_port = context.config.otherConfigs.get("mysql_57_port");
+ String externalEnvIp = context.config.otherConfigs.get("externalEnvIp")
+ String s3_endpoint = getS3Endpoint()
+ String bucket = getS3BucketName()
+ String driver_url =
"https://${bucket}.${s3_endpoint}/regression/jdbc_driver/mysql-connector-j-8.4.0.jar"
+
+ // create test
+ connect("root", "123456",
"jdbc:mysql://${externalEnvIp}:${mysql_port}") {
+ sql """CREATE DATABASE IF NOT EXISTS ${mysqlDb}"""
+ sql """DROP TABLE IF EXISTS ${mysqlDb}.${table1}"""
+ sql """CREATE TABLE ${mysqlDb}.${table1} (
+ `name` varchar(200) NOT NULL,
+ `age` int DEFAULT NULL,
+ PRIMARY KEY (`name`)
+ ) ENGINE=InnoDB"""
+ sql """INSERT INTO ${mysqlDb}.${table1} (name, age) VALUES ('A1',
1);"""
+ sql """INSERT INTO ${mysqlDb}.${table1} (name, age) VALUES ('B1',
2);"""
+ }
+
+ try {
+ sql """DROP FILE "mysql_ca.pem" FROM ${currentDb} PROPERTIES
("catalog" = "streaming_job")"""
+ } catch (Exception ignored) {
+ // ignore
+ }
+
+ sql """CREATE FILE "mysql_ca.pem"
+ IN ${currentDb}
+ PROPERTIES
+ (
+ "url" =
"https://qa-build.oss-cn-beijing.aliyuncs.com/jianxu/root.crt",
+ "catalog" = "streaming_job"
+ )
+ """
+
+ sql """CREATE JOB ${jobName}
+ ON STREAMING
+ FROM MYSQL (
+ "jdbc_url" = "jdbc:mysql://${externalEnvIp}:${mysql_port}",
+ "driver_url" = "${driver_url}",
+ "driver_class" = "com.mysql.cj.jdbc.Driver",
+ "user" = "root",
+ "password" = "123456",
+ "database" = "${mysqlDb}",
+ "include_tables" = "${table1}",
+ "offset" = "initial",
+ "ssl_mode" = "verify_ca",
+ "ssl_rootcert" = "FILE:mysql_ca.pem"
+ )
+ TO DATABASE ${currentDb} (
+ "table.create.properties.replication_num" = "1"
+ )
+ """
+ def showAllTables = sql """ show tables from ${currentDb}"""
+ log.info("showAllTables: " + showAllTables)
+ // check table created
+ def showTables = sql """ show tables from ${currentDb} like
'${table1}'; """
+ assert showTables.size() == 1
+
+ // check job running
+ try {
+ Awaitility.await().atMost(300, SECONDS)
+ .pollInterval(1, SECONDS).until(
+ {
+ def jobSuccendCount = sql """ select SucceedTaskCount
from jobs("type"="insert") where Name = '${jobName}' and
ExecuteType='STREAMING' """
+ log.info("jobSuccendCount: " + jobSuccendCount)
+ // check job status and succeed task count larger than
2
+ jobSuccendCount.size() == 1 && '2' <=
jobSuccendCount.get(0).get(0)
+ }
+ )
+ } catch (Exception ex){
+ def showjob = sql """select * from jobs("type"="insert") where
Name='${jobName}'"""
+ def showtask = sql """select * from tasks("type"="insert") where
JobName='${jobName}'"""
+ log.info("show job: " + showjob)
+ log.info("show task: " + showtask)
+ throw ex;
+ }
+
+ // check snapshot data
+ qt_select_snapshot_table1 """ SELECT * FROM ${table1} order by name
asc """
Review Comment:
This suite now adds `qt_...` assertions, but the PR does not add the
matching generated output files under
`regression-test/data/job_p0/streaming_job/cdc/`. The same is true for the new
`test_streaming_mysql_job_col_filter` and
`test_streaming_mysql_job_table_mapping` suites.
The regression harness throws `IllegalStateException("Missing outputFile:
...")` when `--genOut` is not enabled, so normal CI will fail before these new
cases validate anything.
##########
fs_brokers/cdc_client/src/main/java/org/apache/doris/cdcclient/source/reader/mysql/MySqlSourceReader.java:
##########
@@ -853,6 +854,19 @@ private MySqlSourceConfig generateMySqlConfig(Map<String,
String> cdcConfig, Str
dbzProps.setProperty(
MySqlConnectorConfig.KEEP_ALIVE_INTERVAL_MS.name(),
DEBEZIUM_HEARTBEAT_INTERVAL_MS + "");
+
+ if (cdcConfig.containsKey(DataSourceConfigKeys.SSL_MODE)) {
Review Comment:
This now forwards the raw user-provided `ssl_mode` straight into Debezium
MySQL, but Debezium only accepts `disabled`, `preferred`, `required`,
`verify_ca`, and `verify_identity`. FE validation still only checks that
`ssl_mode` is non-empty, so a PG-style value like `verify-ca` is accepted at
`CREATE JOB` time and then reaches
`MySqlConnectorConfig.MySqlSecureConnectionMode.parse(...)` as `null`. The
later `sslModeFor(connectorConfig.sslMode())` path then blows up during reader
startup instead of failing fast at job creation.
Since this PR is exposing `ssl_mode` for MySQL, can we normalize or reject
unsupported MySQL values before putting them into `database.ssl.mode`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]