This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 5f373f62730 Inject ContextManager properties for pipeline job data
source (#36749)
5f373f62730 is described below
commit 5f373f6273029deeadd6722b6a1b182831c3bdf3
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Mon Sep 29 15:41:21 2025 +0800
Inject ContextManager properties for pipeline job data source (#36749)
---
.../creator/ShardingSpherePipelineDataSourceCreator.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/datasource/creator/ShardingSpherePipelineDataSourceCreator.java
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/datasource/creator/ShardingSpherePipelineDataSourceCreator.java
index abf47ea8db6..8419555d098 100644
---
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/datasource/creator/ShardingSpherePipelineDataSourceCreator.java
+++
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/datasource/creator/ShardingSpherePipelineDataSourceCreator.java
@@ -19,6 +19,7 @@ package
org.apache.shardingsphere.data.pipeline.core.datasource.creator;
import
org.apache.shardingsphere.authority.yaml.config.YamlAuthorityRuleConfiguration;
import
org.apache.shardingsphere.data.pipeline.api.type.ShardingSpherePipelineDataSourceConfiguration;
+import
org.apache.shardingsphere.data.pipeline.core.context.PipelineContextManager;
import
org.apache.shardingsphere.data.pipeline.core.datasource.yaml.PipelineYamlRuleConfigurationReviser;
import org.apache.shardingsphere.data.pipeline.spi.PipelineDataSourceCreator;
import org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory;
@@ -35,6 +36,7 @@ import
org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistReposito
import
org.apache.shardingsphere.infra.yaml.config.swapper.mode.YamlModeConfigurationSwapper;
import
org.apache.shardingsphere.infra.yaml.config.swapper.resource.YamlDataSourceConfigurationSwapper;
import
org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapperEngine;
+import org.apache.shardingsphere.mode.manager.ContextManager;
import javax.sql.DataSource;
import java.sql.SQLException;
@@ -63,7 +65,7 @@ public final class ShardingSpherePipelineDataSourceCreator
implements PipelineDa
}
private void updateConfigurationProperties(final YamlRootConfiguration
yamlRootConfig) {
- Properties newProps = new Properties();
+ Properties newProps = prepareProperties();
for (String each :
Arrays.asList(ConfigurationPropertyKey.KERNEL_EXECUTOR_SIZE.getKey(),
ConfigurationPropertyKey.SQL_SHOW.getKey())) {
Object value = yamlRootConfig.getProps().get(each);
if (null != value) {
@@ -76,6 +78,14 @@ public final class ShardingSpherePipelineDataSourceCreator
implements PipelineDa
yamlRootConfig.setProps(newProps);
}
+ private Properties prepareProperties() {
+ ContextManager contextManager =
PipelineContextManager.getProxyContext();
+ if (null == contextManager) {
+ return new Properties();
+ }
+ return
contextManager.getMetaDataContexts().getMetaData().getProps().getProps();
+ }
+
@SuppressWarnings("unchecked")
private void reviseYamlRuleConfiguration(final YamlRootConfiguration
yamlRootConfig) {
OrderedSPILoader.getServices(PipelineYamlRuleConfigurationReviser.class,
yamlRootConfig.getRules()).forEach((key, value) -> value.revise(key));