From 3f382b797ad0bcf05fdaf0e38d130f803eb04cc3 Mon Sep 17 00:00:00 2001 From: zy-kkk Date: Tue, 2 Jul 2024 10:14:43 +0800 Subject: [PATCH] [branch-2.1][improvement](sqlserver catalog) Configurable whether to use encrypt when connecting to SQL Server using the catalog (#36971) pick (#36659) pick #37015 In previous versions, we used druid as the default JDBC connection pool, which can use custom decryption to parse the certificate when SQL Server encryption is turned on. However, in the new version, after changing HikariCP as the default connection pool, the SQLServer certificate cannot be parsed, so encryption needs to be turned off for normal use. Therefore, a parameter is added to decide whether to disable SQLServer encryption. It is not disabled by default. --- .../src/main/java/org/apache/doris/common/Config.java | 4 ++++ .../src/main/java/org/apache/doris/catalog/JdbcResource.java | 3 +++ 2 files changed, 7 insertions(+) diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java index e1b29b7f84..b51ab170f0 100644 --- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java +++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java @@ -162,6 +162,10 @@ public class Config extends ConfigBase { "MySQL Jdbc Catalog mysql does not support pushdown functions"}) public static String[] jdbc_mysql_unsupported_pushdown_functions = {"date_trunc", "money_format", "negative"}; + @ConfField(description = {"强制 SQLServer Jdbc Catalog 加密为 false", + "Force SQLServer Jdbc Catalog encrypt to false"}) + public static boolean force_sqlserver_jdbc_encrypt_false = false; + @ConfField(mutable = true, masterOnly = true, description = {"broker load 时,单个节点上 load 执行计划的默认并行度", "The default parallelism of the load execution plan on a single node when the broker load is submitted"}) public static int default_load_parallelism = 8; diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java index e8498d0a2d..bd14740a6f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java @@ -353,6 +353,9 @@ public class JdbcResource extends Resource { newJdbcUrl = checkAndSetJdbcBoolParam(dbType, newJdbcUrl, "reWriteBatchedInserts", "false", "true"); } if (dbType.equals(SQLSERVER)) { + if (Config.force_sqlserver_jdbc_encrypt_false) { + newJdbcUrl = checkAndSetJdbcBoolParam(dbType, newJdbcUrl, "encrypt", "true", "false"); + } newJdbcUrl = checkAndSetJdbcBoolParam(dbType, newJdbcUrl, "useBulkCopyForBatchInsert", "false", "true"); } return newJdbcUrl;