You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2022/07/11 15:53:10 UTC
[shardingsphere] branch master updated: Change default mode config from memory mode to standalone mode and H2 repository (#19029)
This is an automated email from the ASF dual-hosted git repository.
menghaoran 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 396e9f2c153 Change default mode config from memory mode to standalone mode and H2 repository (#19029)
396e9f2c153 is described below
commit 396e9f2c153170cbee07242f30b56a4a5a903df2
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon Jul 11 23:52:53 2022 +0800
Change default mode config from memory mode to standalone mode and H2 repository (#19029)
---
.../rule/EncryptColumnRuleConfigurationYamlSwapper.java | 1 +
.../AlgorithmProvidedShardingRuleConfiguration.java | 5 +++++
...ngRuleAlgorithmProviderConfigurationYamlSwapper.java | 2 ++
shardingsphere-jdbc/shardingsphere-jdbc-core/pom.xml | 5 +++++
.../shardingsphere-jdbc-core-spring-namespace/pom.xml | 5 +++++
.../manager/memory/MemoryContextManagerBuilder.java | 5 -----
.../standalone/StandaloneContextManagerBuilder.java | 16 +++++++++-------
.../workerid/generator/StandaloneWorkerIdGenerator.java | 8 +-------
.../mode/repository/standalone/file/FileRepository.java | 5 -----
.../pom.xml | 1 -
.../mode/repository/standalone/h2/H2Repository.java | 17 +++++++++++------
.../mode/repository/standalone/h2/H2RepositoryTest.java | 2 +-
.../shardingsphere-proxy-backend/pom.xml | 5 +++++
.../spi/type/required/RequiredSPIRegistry.java | 10 ++++++++++
.../pom.xml | 5 +++++
.../pom.xml | 5 +++++
.../pom.xml | 5 +++++
.../pom.xml | 5 +++++
.../shardingsphere-integration-test-fixture/pom.xml | 1 +
19 files changed, 76 insertions(+), 32 deletions(-)
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptColumnRuleConfigurationYamlSwapper.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptColumnRuleConfigurationYamlSwapper.java
index ec0bdaf11c8..b94b89ffcce 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptColumnRuleConfigurationYamlSwapper.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptColumnRuleConfigurationYamlSwapper.java
@@ -35,6 +35,7 @@ public final class EncryptColumnRuleConfigurationYamlSwapper implements YamlConf
result.setAssistedQueryColumn(data.getAssistedQueryColumn());
result.setEncryptorName(data.getEncryptorName());
result.setQueryWithCipherColumn(data.getQueryWithCipherColumn());
+ result.setAssistedQueryEncryptorName(data.getAssistedQueryEncryptorName());
return result;
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/config/AlgorithmProvidedShardingRuleConfiguration.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/config/AlgorithmProvidedShardingRuleConfiguration.java
index fd3a3dfc610..a5073e4b777 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/config/AlgorithmProvidedShardingRuleConfiguration.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/config/AlgorithmProvidedShardingRuleConfiguration.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.sharding.algorithm.config;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.infra.config.function.DistributedRuleConfiguration;
+import org.apache.shardingsphere.infra.config.rulealtered.OnRuleAlteredActionConfiguration;
import org.apache.shardingsphere.infra.config.scope.DatabaseRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
@@ -65,4 +66,8 @@ public final class AlgorithmProvidedShardingRuleConfiguration implements Databas
private Map<String, KeyGenerateAlgorithm> keyGenerators = new LinkedHashMap<>();
private Map<String, ShardingAuditAlgorithm> auditors = new LinkedHashMap<>();
+
+ private String scalingName;
+
+ private Map<String, OnRuleAlteredActionConfiguration> scaling = new LinkedHashMap<>();
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleAlgorithmProviderConfigurationYamlSwapper.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleAlgorithmProviderConfigurationYamlSwapper.java
index 37634dccd25..99f5b1d589e 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleAlgorithmProviderConfigurationYamlSwapper.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleAlgorithmProviderConfigurationYamlSwapper.java
@@ -56,6 +56,8 @@ public final class ShardingRuleAlgorithmProviderConfigurationYamlSwapper impleme
result.getBroadcastTables().addAll(data.getBroadcastTables());
setYamlStrategies(data, result);
setYamlAlgorithms(data, result);
+ result.setDefaultShardingColumn(data.getDefaultShardingColumn());
+ result.setScalingName(data.getScalingName());
return result;
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/pom.xml b/shardingsphere-jdbc/shardingsphere-jdbc-core/pom.xml
index b61fbbddb96..03e93181556 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/pom.xml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/pom.xml
@@ -98,6 +98,11 @@
<artifactId>shardingsphere-standalone-mode-repository-file</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-standalone-mode-repository-h2</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-cluster-mode-core</artifactId>
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/pom.xml b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/pom.xml
index bb2cb8943af..469e43eeef7 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/pom.xml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/pom.xml
@@ -43,6 +43,11 @@
<artifactId>shardingsphere-standalone-mode-repository-file</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-standalone-mode-repository-h2</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-cluster-mode-core</artifactId>
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
index 75104c210fb..17e2251f0ef 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
@@ -69,9 +69,4 @@ public final class MemoryContextManagerBuilder implements ContextManagerBuilder
public String getType() {
return "Memory";
}
-
- @Override
- public boolean isDefault() {
- return true;
- }
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
index e6a6082232d..a336b99ef0f 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.mode.manager.standalone;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
import org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
+import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.eventbus.EventBusContext;
import org.apache.shardingsphere.infra.federation.optimizer.context.OptimizerContextFactory;
@@ -53,20 +54,21 @@ public final class StandaloneContextManagerBuilder implements ContextManagerBuil
@Override
public ContextManager build(final ContextManagerBuilderParameter parameter) throws SQLException {
- MetaDataPersistService persistService = new MetaDataPersistService(StandalonePersistRepositoryFactory.getInstance(parameter.getModeConfig().getRepository()));
- persistConfigurations(persistService, parameter);
- InstanceContext instanceContext = buildInstanceContext(parameter);
+ ModeConfiguration modeConfig = null == parameter.getModeConfig() ? new ModeConfiguration("Standalone", null, true) : parameter.getModeConfig();
+ MetaDataPersistService persistService = new MetaDataPersistService(StandalonePersistRepositoryFactory.getInstance(modeConfig.getRepository()));
+ persistConfigurations(persistService, parameter, modeConfig);
+ InstanceContext instanceContext = buildInstanceContext(parameter, modeConfig);
return new ContextManager(buildMetaDataContexts(persistService, parameter, instanceContext), instanceContext);
}
- private void persistConfigurations(final MetaDataPersistService persistService, final ContextManagerBuilderParameter parameter) {
+ private void persistConfigurations(final MetaDataPersistService persistService, final ContextManagerBuilderParameter parameter, final ModeConfiguration modeConfig) {
if (!parameter.isEmpty()) {
- persistService.persistConfigurations(parameter.getDatabaseConfigs(), parameter.getGlobalRuleConfigs(), parameter.getProps(), parameter.getModeConfig().isOverwrite());
+ persistService.persistConfigurations(parameter.getDatabaseConfigs(), parameter.getGlobalRuleConfigs(), parameter.getProps(), modeConfig.isOverwrite());
}
}
- private InstanceContext buildInstanceContext(final ContextManagerBuilderParameter parameter) {
- return new InstanceContext(new ComputeNodeInstance(parameter.getInstanceMetaData()), new StandaloneWorkerIdGenerator(), parameter.getModeConfig(), new StandaloneLockContext(),
+ private InstanceContext buildInstanceContext(final ContextManagerBuilderParameter parameter, final ModeConfiguration modeConfig) {
+ return new InstanceContext(new ComputeNodeInstance(parameter.getInstanceMetaData()), new StandaloneWorkerIdGenerator(), modeConfig, new StandaloneLockContext(),
new EventBusContext());
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/workerid/generator/StandaloneWorkerIdGenerator.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/workerid/generator/StandaloneWorkerIdGenerator.java
index e46c112013a..f9aa466e941 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/workerid/generator/StandaloneWorkerIdGenerator.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/workerid/generator/StandaloneWorkerIdGenerator.java
@@ -17,10 +17,8 @@
package org.apache.shardingsphere.mode.manager.standalone.workerid.generator;
-import org.apache.shardingsphere.infra.exception.ShardingSphereException;
import org.apache.shardingsphere.infra.instance.workerid.WorkerIdGenerator;
-import java.util.Optional;
import java.util.Properties;
/**
@@ -30,10 +28,6 @@ public final class StandaloneWorkerIdGenerator implements WorkerIdGenerator {
@Override
public long generate(final Properties props) {
- Optional<Long> result = parseWorkerId(props);
- if (result.isPresent()) {
- return result.get();
- }
- throw new ShardingSphereException("{} is required configuration item in standalone mode", WORKER_ID_KEY);
+ return parseWorkerId(props).orElse(0L);
}
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-file/src/main/java/org/apache/shardingsphere/mode/repository/standalone/file/FileRepository.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/s [...]
index 7c5a8d88b97..3386b2b49ad 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-file/src/main/java/org/apache/shardingsphere/mode/repository/standalone/file/FileRepository.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-file/src/main/java/org/apache/shardingsphere/mode/repository/standalone/file/FileRepository.java
@@ -109,11 +109,6 @@ public final class FileRepository implements StandalonePersistRepository {
public void close() {
}
- @Override
- public boolean isDefault() {
- return true;
- }
-
@Override
public String getType() {
return "File";
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-h2/pom.xml b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-h2/pom.xml
index a393dd7bc11..33b723c1721 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-h2/pom.xml
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-h2/pom.xml
@@ -24,7 +24,6 @@
<artifactId>shardingsphere-standalone-mode-repository-provider</artifactId>
<version>5.1.3-SNAPSHOT</version>
</parent>
- <groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-standalone-mode-repository-h2</artifactId>
<dependencies>
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-h2/src/main/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2Repository.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardin [...]
index 87bcee5799b..58fd553ca77 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-h2/src/main/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2Repository.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-h2/src/main/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2Repository.java
@@ -42,7 +42,7 @@ import java.util.UUID;
@Slf4j
public final class H2Repository implements StandalonePersistRepository {
- private static final String DEFAULT_JDBC_URL = "jdbc:h2:~/h2_repository";
+ private static final String DEFAULT_JDBC_URL = "jdbc:h2:mem:config;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL";
private static final String DEFAULT_USER = "sa";
@@ -85,7 +85,7 @@ public final class H2Repository implements StandalonePersistRepository {
return Optional.ofNullable(Strings.emptyToNull(resultSet.getString("value"))).map(each -> each.replace("\"", "'")).orElse("");
}
} catch (final SQLException ex) {
- log.error("Get h2 data by key: {} failed", key, ex);
+ log.error("Get H2 data by key: {} failed", key, ex);
}
return "";
}
@@ -106,7 +106,7 @@ public final class H2Repository implements StandalonePersistRepository {
}
return resultChildren;
} catch (final SQLException ex) {
- log.error("Get children h2 data by key: {} failed", key, ex);
+ log.error("Get children H2 data by key: {} failed", key, ex);
}
return Collections.emptyList();
}
@@ -139,7 +139,7 @@ public final class H2Repository implements StandalonePersistRepository {
update(key, insensitiveValue);
}
} catch (final SQLException ex) {
- log.error("Persist h2 data to key: {} failed", key, ex);
+ log.error("Persist H2 data to key: {} failed", key, ex);
}
}
@@ -160,7 +160,7 @@ public final class H2Repository implements StandalonePersistRepository {
try (PreparedStatement statement = connection.prepareStatement("DELETE FROM REPOSITORY WHERE key = '" + key + "'")) {
statement.executeUpdate();
} catch (final SQLException ex) {
- log.error("Delete h2 data by key: {} failed", key, ex);
+ log.error("Delete H2 data by key: {} failed", key, ex);
}
}
@@ -171,7 +171,7 @@ public final class H2Repository implements StandalonePersistRepository {
connection.close();
}
} catch (final SQLException ex) {
- log.error("Failed to release h2 database resources.", ex);
+ log.error("Failed to release H2 database resources.", ex);
}
}
@@ -179,4 +179,9 @@ public final class H2Repository implements StandalonePersistRepository {
public String getType() {
return "H2";
}
+
+ @Override
+ public boolean isDefault() {
+ return true;
+ }
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-h2/src/test/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2RepositoryTest.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/sha [...]
index 84db61d8feb..a5e5245c183 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-h2/src/test/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2RepositoryTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-h2/src/test/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2RepositoryTest.java
@@ -34,7 +34,7 @@ public final class H2RepositoryTest {
@Before
public void setUp() {
Properties props = new Properties();
- props.setProperty("jdbc_url", "jdbc:h2:~/h2_repository");
+ props.setProperty("jdbc_url", "jdbc:h2:mem:config;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL");
props.setProperty("user", "sa");
props.setProperty("password", "");
props.setProperty("driver_class", "org.h2.Driver");
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml b/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml
index 2fd0b72efc3..d403363a4c4 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml
@@ -83,6 +83,11 @@
<artifactId>shardingsphere-standalone-mode-repository-file</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-standalone-mode-repository-h2</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-cluster-mode-core</artifactId>
diff --git a/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/type/required/RequiredSPIRegistry.java b/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/type/required/RequiredSPIRegistry.java
index 3fddfc3e911..aaea2beab98 100644
--- a/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/type/required/RequiredSPIRegistry.java
+++ b/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/type/required/RequiredSPIRegistry.java
@@ -21,8 +21,10 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.spi.exception.ServiceProviderNotFoundException;
+import org.apache.shardingsphere.spi.lifecycle.SPIPostProcessor;
import java.util.Collection;
+import java.util.Properties;
/**
* Required SPI registry.
@@ -38,6 +40,14 @@ public final class RequiredSPIRegistry {
* @return registered service
*/
public static <T extends RequiredSPI> T getRegisteredService(final Class<T> spiClass) {
+ T result = getRequiredService(spiClass);
+ if (result instanceof SPIPostProcessor) {
+ ((SPIPostProcessor) result).init(new Properties());
+ }
+ return result;
+ }
+
+ private static <T extends RequiredSPI> T getRequiredService(final Class<T> spiClass) {
Collection<T> services = ShardingSphereServiceLoader.getServiceInstances(spiClass);
if (services.isEmpty()) {
throw new ServiceProviderNotFoundException(spiClass);
diff --git a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-jaeger/pom.xml b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-jaeger/pom.xml
index b074fbce183..089623716ba 100644
--- a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-jaeger/pom.xml
+++ b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-jaeger/pom.xml
@@ -49,6 +49,11 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
diff --git a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/pom.xml b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/pom.xml
index 629fca400df..2171714742e 100644
--- a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/pom.xml
+++ b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/pom.xml
@@ -49,6 +49,11 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
diff --git a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/pom.xml b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/pom.xml
index 1b87b5381c0..d41eea77dea 100644
--- a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/pom.xml
+++ b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/pom.xml
@@ -54,6 +54,11 @@
<artifactId>gson</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
diff --git a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-zipkin/pom.xml b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-zipkin/pom.xml
index 3eedc5582eb..8b49bbf96c0 100644
--- a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-zipkin/pom.xml
+++ b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-zipkin/pom.xml
@@ -49,6 +49,11 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/pom.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/pom.xml
index 3ece856efce..977f536b5e0 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/pom.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/pom.xml
@@ -76,6 +76,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
+ <scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>