You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2025/07/13 14:02:01 UTC

(shardingsphere) branch master updated: Add mode-repo-memory profile (#35974)

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

zhangliang 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 2bdd798cdae Add mode-repo-memory profile (#35974)
2bdd798cdae is described below

commit 2bdd798cdaee176bcf7c76ed3f2e990475e308fe
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sun Jul 13 22:01:56 2025 +0800

    Add mode-repo-memory profile (#35974)
    
    * Add mode-repo-memory profile
    
    * Add mode-repo-memory profile
---
 distribution/jdbc/pom.xml                                     | 11 +++++++++++
 distribution/proxy-native/pom.xml                             | 11 +++++++++++
 distribution/proxy/pom.xml                                    | 11 +++++++++++
 kernel/data-pipeline/core/pom.xml                             |  2 +-
 .../creator/ShardingSpherePipelineDataSourceCreator.java      |  8 +-------
 5 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/distribution/jdbc/pom.xml b/distribution/jdbc/pom.xml
index 42f3422c4d1..9a88e18aaa6 100644
--- a/distribution/jdbc/pom.xml
+++ b/distribution/jdbc/pom.xml
@@ -308,6 +308,17 @@
             </dependencies>
         </profile>
         
+        <profile>
+            <id>mode-repo-memory</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.shardingsphere</groupId>
+                    <artifactId>shardingsphere-standalone-mode-repository-memory</artifactId>
+                    <version>${project.version}</version>
+                    <scope>runtime</scope>
+                </dependency>
+            </dependencies>
+        </profile>
         <profile>
             <id>mode-repo-jdbc</id>
             <dependencies>
diff --git a/distribution/proxy-native/pom.xml b/distribution/proxy-native/pom.xml
index 20d2b452e08..f403aa3dbc1 100644
--- a/distribution/proxy-native/pom.xml
+++ b/distribution/proxy-native/pom.xml
@@ -452,6 +452,17 @@
             </dependencies>
         </profile>
         
+        <profile>
+            <id>mode-repo-memory</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.shardingsphere</groupId>
+                    <artifactId>shardingsphere-standalone-mode-repository-memory</artifactId>
+                    <version>${project.version}</version>
+                    <scope>runtime</scope>
+                </dependency>
+            </dependencies>
+        </profile>
         <profile>
             <id>mode-repo-jdbc</id>
             <dependencies>
diff --git a/distribution/proxy/pom.xml b/distribution/proxy/pom.xml
index 8be7aa7a42b..53c0aba841d 100644
--- a/distribution/proxy/pom.xml
+++ b/distribution/proxy/pom.xml
@@ -490,6 +490,17 @@
             </dependencies>
         </profile>
         
+        <profile>
+            <id>mode-repo-memory</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.shardingsphere</groupId>
+                    <artifactId>shardingsphere-standalone-mode-repository-memory</artifactId>
+                    <version>${project.version}</version>
+                    <scope>runtime</scope>
+                </dependency>
+            </dependencies>
+        </profile>
         <profile>
             <id>mode-repo-jdbc</id>
             <dependencies>
diff --git a/kernel/data-pipeline/core/pom.xml b/kernel/data-pipeline/core/pom.xml
index 4823356aec7..c65f84b801f 100644
--- a/kernel/data-pipeline/core/pom.xml
+++ b/kernel/data-pipeline/core/pom.xml
@@ -54,7 +54,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-standalone-mode-repository-jdbc</artifactId>
+            <artifactId>shardingsphere-standalone-mode-repository-memory</artifactId>
             <version>${project.version}</version>
         </dependency>
         <!-- TODO remove cluster mode dependency after 3 modes have equivalent features -->
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 978a80e9116..62c31593afb 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
@@ -34,7 +34,6 @@ 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.repository.standalone.jdbc.props.JDBCRepositoryPropertyKey;
 import org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
 
 import javax.sql.DataSource;
@@ -44,15 +43,12 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Properties;
-import java.util.concurrent.atomic.AtomicInteger;
 
 /**
  * ShardingSphere pipeline data source creator.
  */
 public final class ShardingSpherePipelineDataSourceCreator implements PipelineDataSourceCreator {
     
-    private static final AtomicInteger STANDALONE_DATABASE_ID = new AtomicInteger(1);
-    
     @Override
     public DataSource create(final Object dataSourceConfig) throws SQLException {
         YamlRootConfiguration yamlRootConfig = YamlEngine.unmarshal(YamlEngine.marshal(dataSourceConfig), YamlRootConfiguration.class);
@@ -113,9 +109,7 @@ public final class ShardingSpherePipelineDataSourceCreator implements PipelineDa
         YamlModeConfiguration result = new YamlModeConfiguration();
         result.setType("Standalone");
         YamlPersistRepositoryConfiguration yamlRepositoryConfig = new YamlPersistRepositoryConfiguration();
-        yamlRepositoryConfig.setType("JDBC");
-        yamlRepositoryConfig.getProps().setProperty(JDBCRepositoryPropertyKey.JDBC_URL.getKey(),
-                String.format("jdbc:h2:mem:pipeline_db_%d;DB_CLOSE_DELAY=0;DATABASE_TO_UPPER=false;MODE=MYSQL", STANDALONE_DATABASE_ID.getAndIncrement()));
+        yamlRepositoryConfig.setType("Memory");
         result.setRepository(yamlRepositoryConfig);
         return result;
     }