You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ca...@apache.org on 2022/01/13 10:06:45 UTC

[dolphinscheduler] branch dev updated: [fix-7671][plugin] Supports whether SQL is placed in the same session for configuration(fix-7671) (#7675)

This is an automated email from the ASF dual-hosted git repository.

caishunfeng pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 8987277  [fix-7671][plugin] Supports whether SQL is placed in the same session for configuration(fix-7671) (#7675)
8987277 is described below

commit 898727709f49e403e232bf5b68f006d3c6b28e55
Author: mask <39...@users.noreply.github.com>
AuthorDate: Thu Jan 13 18:06:40 2022 +0800

    [fix-7671][plugin] Supports whether SQL is placed in the same session for configuration(fix-7671) (#7675)
    
    -Supports whether SQL is placed in the same session for configuration
---
 dolphinscheduler-common/src/main/resources/common.properties         | 3 +++
 .../plugin/datasource/api/provider/JDBCDataSourceProvider.java       | 5 +++--
 .../main/java/org/apache/dolphinscheduler/spi/utils/Constants.java   | 5 +++++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/dolphinscheduler-common/src/main/resources/common.properties b/dolphinscheduler-common/src/main/resources/common.properties
index b91937a..0085ec7 100644
--- a/dolphinscheduler-common/src/main/resources/common.properties
+++ b/dolphinscheduler-common/src/main/resources/common.properties
@@ -75,6 +75,9 @@ datasource.encryption.enable=false
 # datasource encryption salt
 datasource.encryption.salt=!@#$%^&*
 
+# Whether hive SQL is executed in the same session
+support.hive.oneSession=false
+
 # use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
 sudo.enable=true
 
diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JDBCDataSourceProvider.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JDBCDataSourceProvider.java
index 1d2d4b2..ef5db82 100644
--- a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JDBCDataSourceProvider.java
+++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JDBCDataSourceProvider.java
@@ -77,8 +77,9 @@ public class JDBCDataSourceProvider {
         dataSource.setUsername(properties.getUser());
         dataSource.setPassword(PasswordUtils.decodePassword(properties.getPassword()));
 
-        dataSource.setMinimumIdle(1);
-        dataSource.setMaximumPoolSize(1);
+        Boolean isOneSession = PropertyUtils.getBoolean(Constants.SUPPORT_HIVE_ONE_SESSION, false);
+        dataSource.setMinimumIdle(isOneSession ? 1 : PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MIN_IDLE, 5));
+        dataSource.setMaximumPoolSize(isOneSession ? 1 : PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_ACTIVE, 50));
         dataSource.setConnectionTestQuery(properties.getValidationQuery());
 
         if (properties.getProps() != null) {
diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/Constants.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/Constants.java
index 4c37e90..abe0672 100644
--- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/Constants.java
+++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/Constants.java
@@ -119,6 +119,11 @@ public class Constants {
     public static final String KERBEROS = "kerberos";
 
     /**
+     *  support hive datasource in one session
+     */
+    public static final String SUPPORT_HIVE_ONE_SESSION = "support.hive.oneSession";
+
+    /**
      * driver
      */
     public static final String ORG_POSTGRESQL_DRIVER = "org.postgresql.Driver";