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

azexin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new a9e1580899a Recover max-connections-size-per-query setting to enable 
streaming query in pipeline job (#24201)
a9e1580899a is described below

commit a9e1580899a5ec118d80339c0f155791cfe082c7
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Fri Feb 17 09:56:10 2023 +0800

    Recover max-connections-size-per-query setting to enable streaming query in 
pipeline job (#24201)
---
 .../creator/ShardingSpherePipelineDataSourceCreator.java          | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git 
a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/data/pipeline/datasource/creator/ShardingSpherePipelineDataSourceCreator.java
 
b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/data/pipeline/datasource/creator/ShardingSpherePipelineDataSourceCreator.java
index 19e72c09488..00692af304c 100644
--- 
a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/data/pipeline/datasource/creator/ShardingSpherePipelineDataSourceCreator.java
+++ 
b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/data/pipeline/datasource/creator/ShardingSpherePipelineDataSourceCreator.java
@@ -20,6 +20,7 @@ package 
org.apache.shardingsphere.driver.data.pipeline.datasource.creator;
 import 
org.apache.shardingsphere.data.pipeline.api.datasource.config.impl.ShardingSpherePipelineDataSourceConfiguration;
 import 
org.apache.shardingsphere.data.pipeline.spi.datasource.creator.PipelineDataSourceCreator;
 import 
org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory;
+import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
 import 
org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration;
@@ -37,6 +38,7 @@ public final class ShardingSpherePipelineDataSourceCreator 
implements PipelineDa
     @Override
     public DataSource createPipelineDataSource(final Object dataSourceConfig) 
throws SQLException {
         YamlRootConfiguration rootConfig = 
YamlEngine.unmarshal(YamlEngine.marshal(dataSourceConfig), 
YamlRootConfiguration.class);
+        enableStreamingQuery(rootConfig);
         YamlShardingRuleConfiguration shardingRuleConfig = 
ShardingRuleConfigurationConverter.findYamlShardingRuleConfiguration(rootConfig.getRules());
         enableRangeQueryForInline(shardingRuleConfig);
         rootConfig.setDatabaseName(null);
@@ -44,6 +46,12 @@ public final class ShardingSpherePipelineDataSourceCreator 
implements PipelineDa
         return 
YamlShardingSphereDataSourceFactory.createDataSourceWithoutCache(rootConfig);
     }
     
+    // TODO Another way is improving ExecuteQueryCallback.executeSQL to enable 
streaming query, then remove it
+    private void enableStreamingQuery(final YamlRootConfiguration rootConfig) {
+        // Set a large enough value to enable ConnectionMode.MEMORY_STRICTLY, 
make sure streaming query work.
+        
rootConfig.getProps().put(ConfigurationPropertyKey.MAX_CONNECTIONS_SIZE_PER_QUERY.getKey(),
 100000);
+    }
+    
     private void enableRangeQueryForInline(final YamlShardingRuleConfiguration 
shardingRuleConfig) {
         for (YamlAlgorithmConfiguration each : 
shardingRuleConfig.getShardingAlgorithms().values()) {
             if ("INLINE".equalsIgnoreCase(each.getType())) {

Reply via email to