You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by wu...@apache.org on 2021/08/11 16:36:36 UTC
[shardingsphere] branch master updated: Use yaml mode config to
proxy (#11772)
This is an automated email from the ASF dual-hosted git repository.
wuweijie 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 798ca3a Use yaml mode config to proxy (#11772)
798ca3a is described below
commit 798ca3a9b99817aa0a8bc8fe9fcc24a69c133522
Author: Liang Zhang <te...@163.com>
AuthorDate: Thu Aug 12 00:35:58 2021 +0800
Use yaml mode config to proxy (#11772)
* Add mode yaml pojo
* Add mode yaml pojo
* Add ModeConfigurationYamlSwapper
* Add YamlProxyServerConfiguration.mode
* Refactor Bootstrap
* Revise yaml config
* Revise other yaml config
---
.../shardingsphere-proxy/sharding/conf/server.yaml | 15 +++---
.../src/main/resources/conf/server.yaml | 25 ++++-----
.../src/main/resources/conf/server.yaml | 25 ++++-----
.../src/main/resources/conf/server.yaml | 33 ++++++------
...rPersistRepositoryConfigurationYamlSwapper.java | 48 ++++++++++++++++++
....mode.PersistRepositoryConfigurationYamlSwapper | 18 +------
.../api/config/RegistryCenterConfiguration.java | 12 ++---
.../config/PersistRepositoryConfiguration.java | 21 +++++---
... StandalonePersistRepositoryConfiguration.java} | 4 +-
.../impl/standalone/StandaloneModeBuilder.java | 3 +-
.../config/pojo/mode/YamlModeConfiguration.java} | 19 +++----
.../mode/YamlPersistRepositoryConfiguration.java} | 15 +++---
.../swapper/mode/ModeConfigurationYamlSwapper.java | 47 +++++++++++++++++
.../PersistRepositoryConfigurationYamlSwapper.java | 25 +++------
...stRepositoryConfigurationYamlSwapperEngine.java | 59 ++++++++++++++++++++++
...ePersistRepositoryConfigurationYamlSwapper.java | 45 +++++++++++++++++
....mode.PersistRepositoryConfigurationYamlSwapper | 18 +------
.../org/apache/shardingsphere/proxy/Bootstrap.java | 54 +++++---------------
.../impl/AbstractBootstrapInitializer.java | 10 ++--
.../impl/GovernanceBootstrapInitializer.java | 8 ++-
.../impl/StandardBootstrapInitializer.java | 4 +-
.../src/main/resources/conf/server.yaml | 25 ++++-----
.../impl/GovernanceBootstrapInitializerTest.java | 3 +-
.../impl/StandardBootstrapInitializerTest.java | 3 +-
.../src/test/resources/conf/local/server.yaml | 25 ++++-----
.../src/test/resources/conf/reg_center/server.yaml | 25 ++++-----
.../config/yaml/YamlProxyServerConfiguration.java | 5 +-
.../proxy/config/ProxyConfigurationLoaderTest.java | 3 +-
.../src/test/resources/conf/server.yaml | 16 +++---
.../resources/docker/db/h2/proxy/conf/server.yaml | 25 ++++-----
.../docker/db/mysql/proxy/conf/server.yaml | 25 ++++-----
.../docker/db/postgresql/proxy/conf/server.yaml | 25 ++++-----
.../h2/proxy/conf/server.yaml | 25 ++++-----
.../mysql/proxy/conf/server.yaml | 25 ++++-----
.../postgresql/proxy/conf/server.yaml | 25 ++++-----
.../h2/proxy/conf/server.yaml | 25 ++++-----
.../mysql/proxy/conf/server.yaml | 25 ++++-----
.../postgresql/proxy/conf/server.yaml | 25 ++++-----
.../docker/encrypt/h2/proxy/conf/server.yaml | 25 ++++-----
.../docker/encrypt/mysql/proxy/conf/server.yaml | 25 ++++-----
.../encrypt/postgresql/proxy/conf/server.yaml | 25 ++++-----
.../readwrite_splitting/h2/proxy/conf/server.yaml | 25 ++++-----
.../mysql/proxy/conf/server.yaml | 25 ++++-----
.../postgresql/proxy/conf/server.yaml | 25 ++++-----
.../sharding_governance/h2/proxy/conf/server.yaml | 25 ++++-----
.../mysql/proxy/conf/server.yaml | 25 ++++-----
.../postgresql/proxy/conf/server.yaml | 25 ++++-----
.../resources/docker/tbl/h2/proxy/conf/server.yaml | 25 ++++-----
.../docker/tbl/mysql/proxy/conf/server.yaml | 25 ++++-----
.../docker/tbl/postgresql/proxy/conf/server.yaml | 25 ++++-----
50 files changed, 657 insertions(+), 481 deletions(-)
diff --git a/examples/docker/shardingsphere-proxy/sharding/conf/server.yaml b/examples/docker/shardingsphere-proxy/sharding/conf/server.yaml
index 3630369..acd7076 100644
--- a/examples/docker/shardingsphere-proxy/sharding/conf/server.yaml
+++ b/examples/docker/shardingsphere-proxy/sharding/conf/server.yaml
@@ -21,18 +21,21 @@
#
######################################################################################################
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: localhost:2181
+# overwrite: false
+
rules:
- !AUTHORITY
users:
- root@%:root
provider:
type: NATIVE
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: localhost:2181
-# overwrite: false
props:
max-connections-size-per-query: 1
diff --git a/examples/shardingsphere-proxy-example/shardingsphere-proxy-boot-mybatis-example/src/main/resources/conf/server.yaml b/examples/shardingsphere-proxy-example/shardingsphere-proxy-boot-mybatis-example/src/main/resources/conf/server.yaml
index 2559ab6..d45f245 100644
--- a/examples/shardingsphere-proxy-example/shardingsphere-proxy-boot-mybatis-example/src/main/resources/conf/server.yaml
+++ b/examples/shardingsphere-proxy-example/shardingsphere-proxy-boot-mybatis-example/src/main/resources/conf/server.yaml
@@ -22,6 +22,19 @@
######################################################################################################
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: localhost:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: false
+
rules:
- !AUTHORITY
users:
@@ -29,18 +42,6 @@ rules:
- sharding@:sharding
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: localhost:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: false
props:
max-connections-size-per-query: 1
diff --git a/examples/shardingsphere-proxy-example/shardingsphere-proxy-hint-example/src/main/resources/conf/server.yaml b/examples/shardingsphere-proxy-example/shardingsphere-proxy-hint-example/src/main/resources/conf/server.yaml
index 6beaf51..8b62db5 100644
--- a/examples/shardingsphere-proxy-example/shardingsphere-proxy-hint-example/src/main/resources/conf/server.yaml
+++ b/examples/shardingsphere-proxy-example/shardingsphere-proxy-hint-example/src/main/resources/conf/server.yaml
@@ -22,6 +22,19 @@
######################################################################################################
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: localhost:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: false
+
rules:
- !AUTHORITY
users:
@@ -29,18 +42,6 @@ rules:
provider:
type: NATIVE
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: localhost:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: false
-
props:
max-connections-size-per-query: 1
executor-size: 16 # Infinite by default.
diff --git a/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/server.yaml b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/server.yaml
index 4405979..87cc6ec 100644
--- a/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/server.yaml
+++ b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/server.yaml
@@ -21,10 +21,19 @@
#
######################################################################################################
-#scaling:
-# blockQueueSize: 10000
-# workerThread: 40
-
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: localhost:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: false
+
#rules:
# - !AUTHORITY
# users:
@@ -32,18 +41,10 @@
# - sharding@:sharding
# provider:
# type: NATIVE
-#
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: localhost:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: false
+
+#scaling:
+# blockQueueSize: 10000
+# workerThread: 40
#props:
# max-connections-size-per-query: 1
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/ClusterPersistRepositoryConfigurationYamlSwapper.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/ClusterPersistRepositoryConfigurationYamlSwapper.java
new file mode 100644
index 0000000..988e63c
--- /dev/null
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/ClusterPersistRepositoryConfigurationYamlSwapper.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.governance.core.yaml.swapper;
+
+import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.swapper.mode.PersistRepositoryConfigurationYamlSwapper;
+
+/**
+ * Cluster persist repository configuration YAML swapper.
+ */
+public final class ClusterPersistRepositoryConfigurationYamlSwapper implements PersistRepositoryConfigurationYamlSwapper<RegistryCenterConfiguration> {
+
+ @Override
+ public YamlPersistRepositoryConfiguration swapToYamlConfiguration(final RegistryCenterConfiguration data) {
+ YamlPersistRepositoryConfiguration result = new YamlPersistRepositoryConfiguration();
+ result.setType(data.getType());
+ result.setProps(data.getProps());
+ result.getProps().setProperty("namespace", data.getNamespace());
+ result.getProps().setProperty("serverLists", data.getServerLists());
+ return result;
+ }
+
+ @Override
+ public RegistryCenterConfiguration swapToObject(final YamlPersistRepositoryConfiguration yamlConfig) {
+ return new RegistryCenterConfiguration(yamlConfig.getType(), yamlConfig.getProps().getProperty("namespace"), yamlConfig.getProps().getProperty("serverLists"), yamlConfig.getProps());
+ }
+
+ @Override
+ public String getType() {
+ return "Cluster";
+ }
+}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml b/shardingsphere-governance/shardingsphere-governance-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.mode.PersistRepositoryConfigurationYamlSwapper
similarity index 72%
copy from shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml
copy to shardingsphere-governance/shardingsphere-governance-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.mode.PersistRepositoryConfigurationYamlSwapper
index 07a0537..f82fee8 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.mode.PersistRepositoryConfigurationYamlSwapper
@@ -15,20 +15,4 @@
# limitations under the License.
#
-rules:
- - !AUTHORITY
- users:
- - root@:root
- provider:
- type: NATIVE
-
- - !GOVERNANCE
- registryCenter:
- type: ZooKeeper
- namespace: test_name_1
- serverLists: localhost:2181
- overwrite: false
-
-props:
- max-connections-size-per-query: 1
- sql-show: false
+org.apache.shardingsphere.governance.core.yaml.swapper.ClusterPersistRepositoryConfigurationYamlSwapper
diff --git a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/RegistryCenterConfiguration.java b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/RegistryCenterConfiguration.java
index e13f490..6cb7fe9 100644
--- a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/RegistryCenterConfiguration.java
+++ b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/RegistryCenterConfiguration.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.governance.repository.api.config;
import lombok.Getter;
+import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.mode.config.PersistRepositoryConfiguration;
import java.util.Properties;
@@ -25,16 +26,15 @@ import java.util.Properties;
/**
* Registry center configuration.
*/
+@RequiredArgsConstructor
@Getter
-public final class RegistryCenterConfiguration extends PersistRepositoryConfiguration {
+public final class RegistryCenterConfiguration implements PersistRepositoryConfiguration {
+
+ private final String type;
private final String namespace;
private final String serverLists;
- public RegistryCenterConfiguration(final String type, final String namespace, final String serverLists, final Properties props) {
- super(type, props);
- this.namespace = namespace;
- this.serverLists = serverLists;
- }
+ private final Properties props;
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java
index 0732376..07d82fa 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java
@@ -17,19 +17,24 @@
package org.apache.shardingsphere.infra.mode.config;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
import java.util.Properties;
/**
* Persist repository configuration.
*/
-@RequiredArgsConstructor
-@Getter
-public class PersistRepositoryConfiguration {
+public interface PersistRepositoryConfiguration {
- private final String type;
+ /**
+ * Get persist repository type.
+ *
+ * @return persist repository type
+ */
+ String getType();
- private final Properties props;
+ /**
+ * Get persist repository properties.
+ *
+ * @return persist repository properties
+ */
+ Properties getProps();
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/StandalonePersistRepositoryConfiguration.java
similarity index 87%
copy from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java
copy to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/StandalonePersistRepositoryConfiguration.java
index 0732376..d6bdfec 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/StandalonePersistRepositoryConfiguration.java
@@ -23,11 +23,11 @@ import lombok.RequiredArgsConstructor;
import java.util.Properties;
/**
- * Persist repository configuration.
+ * Standalone persist repository configuration.
*/
@RequiredArgsConstructor
@Getter
-public class PersistRepositoryConfiguration {
+public class StandalonePersistRepositoryConfiguration implements PersistRepositoryConfiguration {
private final String type;
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandaloneModeBuilder.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandaloneModeBuilder.java
index 9537001..c183e6f 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandaloneModeBuilder.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandaloneModeBuilder.java
@@ -21,6 +21,7 @@ import org.apache.shardingsphere.infra.mode.ShardingSphereMode;
import org.apache.shardingsphere.infra.mode.builder.ModeBuilder;
import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
import org.apache.shardingsphere.infra.mode.config.PersistRepositoryConfiguration;
+import org.apache.shardingsphere.infra.mode.config.StandalonePersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
@@ -38,7 +39,7 @@ public final class StandaloneModeBuilder implements ModeBuilder {
@Override
public ShardingSphereMode build(final ModeConfiguration config) {
- PersistRepositoryConfiguration repositoryConfig = null == config.getRepository() ? new PersistRepositoryConfiguration("Local", new Properties()) : config.getRepository();
+ PersistRepositoryConfiguration repositoryConfig = null == config.getRepository() ? new StandalonePersistRepositoryConfiguration("Local", new Properties()) : config.getRepository();
return new StandaloneMode(TypedSPIRegistry.getRegisteredService(PersistRepository.class, repositoryConfig.getType(), repositoryConfig.getProps()));
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/pojo/mode/YamlModeConfiguration.java
similarity index 68%
copy from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java
copy to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/pojo/mode/YamlModeConfiguration.java
index 0732376..3fb4993 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/pojo/mode/YamlModeConfiguration.java
@@ -15,21 +15,22 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.mode.config;
+package org.apache.shardingsphere.infra.yaml.config.pojo.mode;
import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-import java.util.Properties;
+import lombok.Setter;
+import org.apache.shardingsphere.infra.yaml.config.pojo.YamlConfiguration;
/**
- * Persist repository configuration.
+ * YAML mode configuration.
*/
-@RequiredArgsConstructor
@Getter
-public class PersistRepositoryConfiguration {
+@Setter
+public final class YamlModeConfiguration implements YamlConfiguration {
+
+ private String type;
- private final String type;
+ private YamlPersistRepositoryConfiguration repository;
- private final Properties props;
+ private boolean overwrite;
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/pojo/mode/YamlPersistRepositoryConfiguration.java
similarity index 70%
copy from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java
copy to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/pojo/mode/YamlPersistRepositoryConfiguration.java
index 0732376..1b97520 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/PersistRepositoryConfiguration.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/pojo/mode/YamlPersistRepositoryConfiguration.java
@@ -15,21 +15,22 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.mode.config;
+package org.apache.shardingsphere.infra.yaml.config.pojo.mode;
import lombok.Getter;
-import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import org.apache.shardingsphere.infra.yaml.config.pojo.YamlConfiguration;
import java.util.Properties;
/**
- * Persist repository configuration.
+ * YAML persist repository configuration.
*/
-@RequiredArgsConstructor
@Getter
-public class PersistRepositoryConfiguration {
+@Setter
+public final class YamlPersistRepositoryConfiguration implements YamlConfiguration {
- private final String type;
+ private String type;
- private final Properties props;
+ private Properties props = new Properties();
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/ModeConfigurationYamlSwapper.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/ModeConfigurationYamlSwapper.java
new file mode 100644
index 0000000..327df9e
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/ModeConfigurationYamlSwapper.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.yaml.config.swapper.mode;
+
+import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
+import org.apache.shardingsphere.infra.mode.config.PersistRepositoryConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.swapper.YamlConfigurationSwapper;
+
+/**
+ * Mode rule configuration YAML swapper.
+ */
+public final class ModeConfigurationYamlSwapper implements YamlConfigurationSwapper<YamlModeConfiguration, ModeConfiguration> {
+
+ @Override
+ public YamlModeConfiguration swapToYamlConfiguration(final ModeConfiguration data) {
+ YamlModeConfiguration result = new YamlModeConfiguration();
+ result.setType(data.getType());
+ if (null != data.getRepository()) {
+ result.setRepository(new PersistRepositoryConfigurationYamlSwapperEngine().swapToYamlConfiguration(data.getType(), data.getRepository()));
+ }
+ result.setOverwrite(data.isOverwrite());
+ return result;
+ }
+
+ @Override
+ public ModeConfiguration swapToObject(final YamlModeConfiguration yamlConfig) {
+ PersistRepositoryConfiguration repositoryConfig = null == yamlConfig.getRepository()
+ ? null : new PersistRepositoryConfigurationYamlSwapperEngine().swapToObject(yamlConfig.getType(), yamlConfig.getRepository());
+ return new ModeConfiguration(yamlConfig.getType(), repositoryConfig, yamlConfig.isOverwrite());
+ }
+}
diff --git a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/RegistryCenterConfiguration.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/PersistRepositoryConfigurationYamlSwapper.java
similarity index 59%
copy from shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/RegistryCenterConfiguration.java
copy to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/PersistRepositoryConfigurationYamlSwapper.java
index e13f490..de8a586 100644
--- a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/RegistryCenterConfiguration.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/PersistRepositoryConfigurationYamlSwapper.java
@@ -15,26 +15,17 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.governance.repository.api.config;
+package org.apache.shardingsphere.infra.yaml.config.swapper.mode;
-import lombok.Getter;
import org.apache.shardingsphere.infra.mode.config.PersistRepositoryConfiguration;
-
-import java.util.Properties;
+import org.apache.shardingsphere.infra.spi.typed.TypedSPI;
+import org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.swapper.YamlConfigurationSwapper;
/**
- * Registry center configuration.
+ * Persist repository configuration YAML swapper.
+ *
+ * @param <T> type of persist repository configuration
*/
-@Getter
-public final class RegistryCenterConfiguration extends PersistRepositoryConfiguration {
-
- private final String namespace;
-
- private final String serverLists;
-
- public RegistryCenterConfiguration(final String type, final String namespace, final String serverLists, final Properties props) {
- super(type, props);
- this.namespace = namespace;
- this.serverLists = serverLists;
- }
+public interface PersistRepositoryConfigurationYamlSwapper<T extends PersistRepositoryConfiguration> extends YamlConfigurationSwapper<YamlPersistRepositoryConfiguration, T>, TypedSPI {
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/PersistRepositoryConfigurationYamlSwapperEngine.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/PersistRepositoryConfigurationYamlSwapperEngine.java
new file mode 100644
index 0000000..43e13c1
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/PersistRepositoryConfigurationYamlSwapperEngine.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.yaml.config.swapper.mode;
+
+import org.apache.shardingsphere.infra.mode.config.PersistRepositoryConfiguration;
+import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
+import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
+import org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfiguration;
+
+import java.util.Properties;
+
+/**
+ * Persist repository configuration YAML swapper engine.
+ */
+public final class PersistRepositoryConfigurationYamlSwapperEngine {
+
+ static {
+ ShardingSphereServiceLoader.register(PersistRepositoryConfigurationYamlSwapper.class);
+ }
+
+ /**
+ * Swap to YAML configuration.
+ *
+ * @param type persist repository type
+ * @param config persist repository configuration
+ * @return YAML persist repository configuration
+ */
+ @SuppressWarnings("unchecked")
+ public YamlPersistRepositoryConfiguration swapToYamlConfiguration(final String type, final PersistRepositoryConfiguration config) {
+ return (YamlPersistRepositoryConfiguration) TypedSPIRegistry.getRegisteredService(PersistRepositoryConfigurationYamlSwapper.class, type, new Properties()).swapToYamlConfiguration(config);
+ }
+
+ /**
+ * Swap to YAML configuration.
+ *
+ * @param type persist repository type
+ * @param yamlConfig YAML persist repository configuration
+ * @return persist repository configuration
+ */
+ @SuppressWarnings("unchecked")
+ public PersistRepositoryConfiguration swapToObject(final String type, final YamlPersistRepositoryConfiguration yamlConfig) {
+ return (PersistRepositoryConfiguration) TypedSPIRegistry.getRegisteredService(PersistRepositoryConfigurationYamlSwapper.class, type, new Properties()).swapToObject(yamlConfig);
+ }
+}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/StandalonePersistRepositoryConfigurationYamlSwapper.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/StandalonePersistRepositoryConfigurationYamlSwapper.java
new file mode 100644
index 0000000..c237b19
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/StandalonePersistRepositoryConfigurationYamlSwapper.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.yaml.config.swapper.mode;
+
+import org.apache.shardingsphere.infra.mode.config.StandalonePersistRepositoryConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfiguration;
+
+/**
+ * Standalone persist repository configuration YAML swapper.
+ */
+public final class StandalonePersistRepositoryConfigurationYamlSwapper implements PersistRepositoryConfigurationYamlSwapper<StandalonePersistRepositoryConfiguration> {
+
+ @Override
+ public YamlPersistRepositoryConfiguration swapToYamlConfiguration(final StandalonePersistRepositoryConfiguration data) {
+ YamlPersistRepositoryConfiguration result = new YamlPersistRepositoryConfiguration();
+ result.setType(data.getType());
+ result.setProps(data.getProps());
+ return result;
+ }
+
+ @Override
+ public StandalonePersistRepositoryConfiguration swapToObject(final YamlPersistRepositoryConfiguration yamlConfig) {
+ return new StandalonePersistRepositoryConfiguration(yamlConfig.getType(), yamlConfig.getProps());
+ }
+
+ @Override
+ public String getType() {
+ return "Standalone";
+ }
+}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.mode.PersistRepositoryConfigurationYamlSwapper
similarity index 72%
copy from shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml
copy to shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.mode.PersistRepositoryConfigurationYamlSwapper
index 07a0537..5ce596f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.mode.PersistRepositoryConfigurationYamlSwapper
@@ -15,20 +15,4 @@
# limitations under the License.
#
-rules:
- - !AUTHORITY
- users:
- - root@:root
- provider:
- type: NATIVE
-
- - !GOVERNANCE
- registryCenter:
- type: ZooKeeper
- namespace: test_name_1
- serverLists: localhost:2181
- overwrite: false
-
-props:
- max-connections-size-per-query: 1
- sql-show: false
+org.apache.shardingsphere.infra.yaml.config.swapper.mode.StandalonePersistRepositoryConfigurationYamlSwapper
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
index 248e4da..bc18f5e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
@@ -17,22 +17,14 @@
package org.apache.shardingsphere.proxy;
-import com.google.common.base.Preconditions;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.governance.core.mode.ClusterMode;
-import org.apache.shardingsphere.governance.core.registry.RegistryCenterRepositoryFactory;
-import org.apache.shardingsphere.governance.core.rule.GovernanceRule;
-import org.apache.shardingsphere.governance.repository.api.config.GovernanceConfiguration;
-import org.apache.shardingsphere.infra.config.RuleConfiguration;
-import org.apache.shardingsphere.infra.config.condition.PreConditionRuleConfiguration;
import org.apache.shardingsphere.infra.mode.ShardingSphereMode;
+import org.apache.shardingsphere.infra.mode.builder.ModeBuilderEngine;
+import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
+import org.apache.shardingsphere.infra.mode.config.StandalonePersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.mode.impl.standalone.StandaloneMode;
-import org.apache.shardingsphere.infra.persist.config.DistMetaDataPersistRuleConfiguration;
-import org.apache.shardingsphere.infra.persist.repository.DistMetaDataPersistRepositoryFactory;
-import org.apache.shardingsphere.infra.persist.rule.DistMetaDataPersistRule;
-import org.apache.shardingsphere.infra.rule.builder.ShardingSphereRulesBuilder;
-import org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine;
+import org.apache.shardingsphere.infra.yaml.config.swapper.mode.ModeConfigurationYamlSwapper;
import org.apache.shardingsphere.proxy.arguments.BootstrapArguments;
import org.apache.shardingsphere.proxy.config.ProxyConfigurationLoader;
import org.apache.shardingsphere.proxy.config.YamlProxyConfiguration;
@@ -43,11 +35,7 @@ import org.apache.shardingsphere.proxy.initializer.impl.StandardBootstrapInitial
import java.io.IOException;
import java.sql.SQLException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Optional;
import java.util.Properties;
-import java.util.stream.Collectors;
/**
* ShardingSphere-Proxy Bootstrap.
@@ -71,33 +59,19 @@ public final class Bootstrap {
}
private static BootstrapInitializer createBootstrapInitializer(final YamlProxyConfiguration yamlConfig) {
- PreConditionRuleConfiguration preConditionRuleConfig = getPreConditionRuleConfiguration(yamlConfig);
+ ModeConfiguration modeConfig = getModeConfiguration(yamlConfig);
+ ShardingSphereMode mode = ModeBuilderEngine.build(modeConfig);
// TODO split to pluggable SPI
- if (preConditionRuleConfig instanceof DistMetaDataPersistRuleConfiguration) {
- Optional<DistMetaDataPersistRule> rule = ShardingSphereRulesBuilder.buildGlobalRules(Collections.singleton(preConditionRuleConfig), Collections.emptyMap())
- .stream().filter(each -> each instanceof DistMetaDataPersistRule).map(each -> (DistMetaDataPersistRule) each).findFirst();
- Preconditions.checkState(rule.isPresent());
- // TODO remove hard code of new new StandaloneMode, load from SPI
- ShardingSphereMode mode = new StandaloneMode(DistMetaDataPersistRepositoryFactory.newInstance((DistMetaDataPersistRuleConfiguration) preConditionRuleConfig));
- return new StandardBootstrapInitializer(preConditionRuleConfig, mode);
+ if (mode instanceof StandaloneMode) {
+ return new StandardBootstrapInitializer(mode, modeConfig.isOverwrite());
}
- Optional<GovernanceRule> rule = ShardingSphereRulesBuilder.buildGlobalRules(Collections.singleton(preConditionRuleConfig), Collections.emptyMap())
- .stream().filter(each -> each instanceof GovernanceRule).map(each -> (GovernanceRule) each).findFirst();
- Preconditions.checkState(rule.isPresent());
- // TODO remove hard code of new new ClusterMode, load from SPI
- ShardingSphereMode mode = new ClusterMode(RegistryCenterRepositoryFactory.newInstance(((GovernanceConfiguration) preConditionRuleConfig).getRegistryCenterConfiguration()));
- return new GovernanceBootstrapInitializer(preConditionRuleConfig, mode);
+ // TODO process MemoryMode
+ return new GovernanceBootstrapInitializer(mode, modeConfig.isOverwrite());
}
- // TODO split to pluggable SPI
- private static PreConditionRuleConfiguration getPreConditionRuleConfiguration(final YamlProxyConfiguration yamlConfig) {
- Collection<RuleConfiguration> globalRuleConfigs = new YamlRuleConfigurationSwapperEngine().swapToRuleConfigurations(yamlConfig.getServerConfiguration().getRules());
- Collection<PreConditionRuleConfiguration> preConditionRuleConfigs = globalRuleConfigs.stream().filter(
- each -> each instanceof PreConditionRuleConfiguration).map(each -> (PreConditionRuleConfiguration) each).collect(Collectors.toList());
- if (preConditionRuleConfigs.isEmpty()) {
- return new DistMetaDataPersistRuleConfiguration("Local", true, new Properties());
- }
- // TODO resolve conflict of dist meta data persist rule and governance rule
- return preConditionRuleConfigs.iterator().next();
+ private static ModeConfiguration getModeConfiguration(final YamlProxyConfiguration yamlConfig) {
+ return null == yamlConfig.getServerConfiguration().getMode()
+ ? new ModeConfiguration("Standalone", new StandalonePersistRepositoryConfiguration("Local", new Properties()), true)
+ : new ModeConfigurationYamlSwapper().swapToObject(yamlConfig.getServerConfiguration().getMode());
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/AbstractBootstrapInitializer.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/AbstractBootstrapInitializer.java
index f6b261d..c97414e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/AbstractBootstrapInitializer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/AbstractBootstrapInitializer.java
@@ -66,14 +66,14 @@ import java.util.stream.Collectors;
@Slf4j
public abstract class AbstractBootstrapInitializer implements BootstrapInitializer {
- private final PreConditionRuleConfiguration preConditionRuleConfig;
-
@Getter
private final DistMetaDataPersistService distMetaDataPersistService;
- public AbstractBootstrapInitializer(final PreConditionRuleConfiguration preConditionRuleConfig, final ShardingSphereMode mode) {
- this.preConditionRuleConfig = preConditionRuleConfig;
+ private final boolean isOverwrite;
+
+ public AbstractBootstrapInitializer(final ShardingSphereMode mode, final boolean isOverwrite) {
distMetaDataPersistService = mode.getPersistRepository().isPresent() ? new DistMetaDataPersistService(mode.getPersistRepository().get()) : null;
+ this.isOverwrite = isOverwrite;
}
@Override
@@ -89,7 +89,7 @@ public abstract class AbstractBootstrapInitializer implements BootstrapInitializ
}
private ProxyConfiguration getProxyConfiguration(final YamlProxyConfiguration yamlConfig) {
- persistConfigurations(yamlConfig, isOverwrite(preConditionRuleConfig));
+ persistConfigurations(yamlConfig, isOverwrite);
if (null == distMetaDataPersistService) {
return new YamlProxyConfigurationSwapper().swap(yamlConfig);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializer.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializer.java
index 0a5de4b..f9582b7 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializer.java
@@ -48,8 +48,8 @@ public final class GovernanceBootstrapInitializer extends AbstractBootstrapIniti
private final RegistryCenter registryCenter;
- public GovernanceBootstrapInitializer(final PreConditionRuleConfiguration preConditionRuleConfig, final ShardingSphereMode mode) {
- super(preConditionRuleConfig, mode);
+ public GovernanceBootstrapInitializer(final ShardingSphereMode mode, final boolean isOverwrite) {
+ super(mode, isOverwrite);
Preconditions.checkState(mode.getPersistRepository().isPresent());
registryCenter = new RegistryCenter((RegistryCenterRepository) mode.getPersistRepository().get());
}
@@ -72,6 +72,10 @@ public final class GovernanceBootstrapInitializer extends AbstractBootstrapIniti
@Override
protected void initScaling(final YamlProxyConfiguration yamlConfig) {
Optional<ServerConfiguration> scalingConfig = getScalingConfiguration(yamlConfig);
+ if (!scalingConfig.isPresent()) {
+ return;
+ }
+ // TODO fix scaling with gov config
Optional<YamlGovernanceConfiguration> governanceConfig = yamlConfig.getServerConfiguration().getRules().stream().filter(
each -> each instanceof YamlGovernanceConfiguration).map(each -> (YamlGovernanceConfiguration) each).findFirst();
Preconditions.checkState(governanceConfig.isPresent());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/StandardBootstrapInitializer.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/StandardBootstrapInitializer.java
index bda454a..f8e48fc 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/StandardBootstrapInitializer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/StandardBootstrapInitializer.java
@@ -30,8 +30,8 @@ import org.apache.shardingsphere.transaction.context.TransactionContexts;
*/
public final class StandardBootstrapInitializer extends AbstractBootstrapInitializer {
- public StandardBootstrapInitializer(final PreConditionRuleConfiguration preConditionRuleConfig, final ShardingSphereMode mode) {
- super(preConditionRuleConfig, mode);
+ public StandardBootstrapInitializer(final ShardingSphereMode mode, final boolean isOverwrite) {
+ super(mode, isOverwrite);
}
@Override
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
index 74424d6..79726e0 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
@@ -25,6 +25,19 @@
# blockQueueSize: 10000
# workerThread: 40
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: localhost:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: false
+#
#rules:
# - !AUTHORITY
# users:
@@ -32,18 +45,6 @@
# - sharding@:sharding
# provider:
# type: NATIVE
-#
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: localhost:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: false
#
#props:
# max-connections-size-per-query: 1
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializerTest.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializerTest.java
index 67291bb..438ca48 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializerTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.proxy.initializer.impl;
import lombok.SneakyThrows;
import org.apache.shardingsphere.governance.context.metadata.GovernanceMetaDataContexts;
-import org.apache.shardingsphere.infra.config.condition.PreConditionRuleConfiguration;
import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
import org.apache.shardingsphere.infra.context.metadata.impl.StandardMetaDataContexts;
@@ -59,7 +58,7 @@ public final class GovernanceBootstrapInitializerTest extends AbstractBootstrapI
protected void prepareSpecifiedInitializer() {
ShardingSphereMode mode = mock(ShardingSphereMode.class);
when(mode.getPersistRepository()).thenReturn(Optional.of(registryCenterRepository));
- GovernanceBootstrapInitializer initializer = new GovernanceBootstrapInitializer(mock(PreConditionRuleConfiguration.class), mode);
+ GovernanceBootstrapInitializer initializer = new GovernanceBootstrapInitializer(mode, false);
setDistMetaDataPersistService(initializer);
setInitializer(initializer);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/impl/StandardBootstrapInitializerTest.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/impl/StandardBootstrapInitializerTest.java
index 2c1a882..c79bd4c 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/impl/StandardBootstrapInitializerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/impl/StandardBootstrapInitializerTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.proxy.initializer.impl;
-import org.apache.shardingsphere.infra.config.condition.PreConditionRuleConfiguration;
import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
import org.apache.shardingsphere.infra.mode.ShardingSphereMode;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
@@ -41,6 +40,6 @@ public final class StandardBootstrapInitializerTest extends AbstractBootstrapIni
}
protected void prepareSpecifiedInitializer() {
- setInitializer(new StandardBootstrapInitializer(mock(PreConditionRuleConfiguration.class), mock(ShardingSphereMode.class)));
+ setInitializer(new StandardBootstrapInitializer(mock(ShardingSphereMode.class), false));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/local/server.yaml b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/local/server.yaml
index aa1dec9..5fcd6ec 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/local/server.yaml
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/local/server.yaml
@@ -15,6 +15,19 @@
# limitations under the License.
#
+mode:
+ type: Cluster
+ repository:
+ type: GOV_FIXTURE
+ props:
+ namespace: governance_ds
+ serverLists: localhost:2181
+ retryIntervalMilliseconds: 500
+ timeToLiveSeconds: 60
+ maxRetries: 3
+ operationTimeoutMilliseconds: 500
+ overwrite: false
+
rules:
- !AUTHORITY
users:
@@ -22,18 +35,6 @@ rules:
- sharding@:sharding
provider:
type: NATIVE
-
- - !GOVERNANCE
- registryCenter:
- type: GOV_FIXTURE
- namespace: governance_ds
- serverLists: localhost:2181
- props:
- retryIntervalMilliseconds: 500
- timeToLiveSeconds: 60
- maxRetries: 3
- operationTimeoutMilliseconds: 500
- overwrite: false
props:
alpha-1: alpha-A
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/reg_center/server.yaml b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/reg_center/server.yaml
index dc489e7..1a63fe3 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/reg_center/server.yaml
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/reg_center/server.yaml
@@ -15,6 +15,19 @@
# limitations under the License.
#
+mode:
+ type: Cluster
+ repository:
+ type: GOV_FIXTURE
+ props:
+ namespace: governance_ds
+ serverLists: localhost:2181
+ retryIntervalMilliseconds: 500
+ timeToLiveSeconds: 60
+ maxRetries: 3
+ operationTimeoutMilliseconds: 500
+ overwrite: false
+
rules:
- !AUTHORITY
users:
@@ -22,15 +35,3 @@ rules:
- sharding@:sharding
provider:
type: NATIVE
-
- - !GOVERNANCE
- registryCenter:
- type: GOV_FIXTURE
- namespace: governance_ds
- serverLists: localhost:2181
- props:
- retryIntervalMilliseconds: 500
- timeToLiveSeconds: 60
- maxRetries: 3
- operationTimeoutMilliseconds: 500
- overwrite: false
diff --git a/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyServerConfiguration.java b/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyServerConfiguration.java
index 69e89d5..e06f93e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyServerConfiguration.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/yaml/YamlProxyServerConfiguration.java
@@ -22,6 +22,7 @@ import lombok.Setter;
import org.apache.shardingsphere.governance.core.yaml.pojo.scaling.YamlScalingConfiguration;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlConfiguration;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration;
import java.util.Collection;
import java.util.LinkedList;
@@ -34,9 +35,11 @@ import java.util.Properties;
@Setter
public final class YamlProxyServerConfiguration implements YamlConfiguration {
- private YamlScalingConfiguration scaling;
+ private YamlModeConfiguration mode;
private Collection<YamlRuleConfiguration> rules = new LinkedList<>();
+ private YamlScalingConfiguration scaling;
+
private Properties props = new Properties();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/ProxyConfigurationLoaderTest.java b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/ProxyConfigurationLoaderTest.java
index 53b9b69..ae6b5bf 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/ProxyConfigurationLoaderTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/ProxyConfigurationLoaderTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.proxy.config;
import org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration;
-import org.apache.shardingsphere.governance.core.yaml.pojo.YamlGovernanceConfiguration;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration;
import org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.proxy.config.yaml.YamlDataSourceParameter;
@@ -45,9 +44,9 @@ public final class ProxyConfigurationLoaderTest {
public void assertLoad() throws IOException {
YamlProxyConfiguration actual = ProxyConfigurationLoader.load("/conf/");
Iterator<YamlRuleConfiguration> actualGlobalRules = actual.getServerConfiguration().getRules().iterator();
+ // TODO assert mode
// TODO assert authority rule
actualGlobalRules.next();
- assertThat(((YamlGovernanceConfiguration) (actualGlobalRules.next())).getRegistryCenter().getServerLists(), is("localhost:2181"));
assertThat(actual.getRuleConfigurations().size(), is(3));
assertShardingRuleConfiguration(actual.getRuleConfigurations().get("sharding_db"));
assertReadwriteSplittingRuleConfiguration(actual.getRuleConfigurations().get("readwrite_splitting_db"));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml
index 07a0537..5bc862e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml
+++ b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml
@@ -15,19 +15,21 @@
# limitations under the License.
#
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: governance_ds
+ serverLists: localhost:2181
+ overwrite: false
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
- - !GOVERNANCE
- registryCenter:
- type: ZooKeeper
- namespace: test_name_1
- serverLists: localhost:2181
- overwrite: false
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/h2/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/h2/proxy/conf/server.yaml
index ac1c557..89d333f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/h2/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/h2/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: localhost:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/mysql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/mysql/proxy/conf/server.yaml
index 4a29eff..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/mysql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/mysql/proxy/conf/server.yaml
@@ -15,6 +15,19 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
@@ -22,18 +35,6 @@ rules:
provider:
type: NATIVE
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
-
props:
max-connections-size-per-query: 1
executor-size: 16 # Infinite by default.
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/postgresql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/postgresql/proxy/conf/server.yaml
index ac1c557..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/postgresql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/postgresql/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting/h2/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting/h2/proxy/conf/server.yaml
index ac1c557..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting/h2/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting/h2/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting/mysql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting/mysql/proxy/conf/server.yaml
index ac1c557..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting/mysql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting/mysql/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting/postgresql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting/postgresql/proxy/conf/server.yaml
index ac1c557..34f9c41 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting/postgresql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting/postgresql/proxy/conf/server.yaml
@@ -15,6 +15,19 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
@@ -22,18 +35,6 @@ rules:
provider:
type: NATIVE
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
-
props:
max-connections-size-per-query: 1
executor-size: 16 # Infinite by default.
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting_and_encrypt/h2/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting_and_encrypt/h2/proxy/conf/server.yaml
index ac1c557..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting_and_encrypt/h2/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting_and_encrypt/h2/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting_and_encrypt/mysql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting_and_encrypt/mysql/proxy/conf/server.yaml
index ac1c557..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting_and_encrypt/mysql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting_and_encrypt/mysql/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting_and_encrypt/postgresql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting_and_encrypt/postgresql/proxy/conf/server.yaml
index ac1c557..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting_and_encrypt/postgresql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_readwrite_splitting_and_encrypt/postgresql/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/h2/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/h2/proxy/conf/server.yaml
index ac1c557..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/h2/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/h2/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/mysql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/mysql/proxy/conf/server.yaml
index ac1c557..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/mysql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/mysql/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/postgresql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/postgresql/proxy/conf/server.yaml
index ac1c557..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/postgresql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/postgresql/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/readwrite_splitting/h2/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/readwrite_splitting/h2/proxy/conf/server.yaml
index 4a29eff..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/readwrite_splitting/h2/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/readwrite_splitting/h2/proxy/conf/server.yaml
@@ -15,6 +15,19 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
@@ -22,18 +35,6 @@ rules:
provider:
type: NATIVE
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
-
props:
max-connections-size-per-query: 1
executor-size: 16 # Infinite by default.
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/readwrite_splitting/mysql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/readwrite_splitting/mysql/proxy/conf/server.yaml
index ac1c557..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/readwrite_splitting/mysql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/readwrite_splitting/mysql/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/readwrite_splitting/postgresql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/readwrite_splitting/postgresql/proxy/conf/server.yaml
index ac1c557..89d333f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/readwrite_splitting/postgresql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/readwrite_splitting/postgresql/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: localhost:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/h2/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/h2/proxy/conf/server.yaml
index f3781c8..8fb608b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/h2/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/h2/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: governance_ds
+ serverLists: zk:2181
+ retryIntervalMilliseconds: 500
+ timeToLiveSeconds: 60
+ maxRetries: 3
+ operationTimeoutMilliseconds: 500
+ overwrite: false
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
- - !GOVERNANCE
- registryCenter:
- type: ZooKeeper
- namespace: governance_ds
- serverLists: zk:2181
- props:
- retryIntervalMilliseconds: 500
- timeToLiveSeconds: 60
- maxRetries: 3
- operationTimeoutMilliseconds: 500
- overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/mysql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/mysql/proxy/conf/server.yaml
index f3781c8..5efa8af 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/mysql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/mysql/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: governance_ds
+ serverLists: zk:2181
+ retryIntervalMilliseconds: 500
+ timeToLiveSeconds: 60
+ maxRetries: 3
+ operationTimeoutMilliseconds: 500
+ overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
- - !GOVERNANCE
- registryCenter:
- type: ZooKeeper
- namespace: governance_ds
- serverLists: zk:2181
- props:
- retryIntervalMilliseconds: 500
- timeToLiveSeconds: 60
- maxRetries: 3
- operationTimeoutMilliseconds: 500
- overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/postgresql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/postgresql/proxy/conf/server.yaml
index f3781c8..5efa8af 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/postgresql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/postgresql/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: governance_ds
+ serverLists: zk:2181
+ retryIntervalMilliseconds: 500
+ timeToLiveSeconds: 60
+ maxRetries: 3
+ operationTimeoutMilliseconds: 500
+ overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
- - !GOVERNANCE
- registryCenter:
- type: ZooKeeper
- namespace: governance_ds
- serverLists: zk:2181
- props:
- retryIntervalMilliseconds: 500
- timeToLiveSeconds: 60
- maxRetries: 3
- operationTimeoutMilliseconds: 500
- overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/h2/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/h2/proxy/conf/server.yaml
index 4a29eff..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/h2/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/h2/proxy/conf/server.yaml
@@ -15,6 +15,19 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
@@ -22,18 +35,6 @@ rules:
provider:
type: NATIVE
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
-
props:
max-connections-size-per-query: 1
executor-size: 16 # Infinite by default.
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/mysql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/mysql/proxy/conf/server.yaml
index ac1c557..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/mysql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/mysql/proxy/conf/server.yaml
@@ -15,24 +15,25 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
- root@:root
provider:
type: NATIVE
-
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
props:
max-connections-size-per-query: 1
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/postgresql/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/postgresql/proxy/conf/server.yaml
index 4a29eff..47d31b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/postgresql/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/postgresql/proxy/conf/server.yaml
@@ -15,6 +15,19 @@
# limitations under the License.
#
+#mode:
+# type: Cluster
+# repository:
+# type: ZooKeeper
+# props:
+# namespace: governance_ds
+# serverLists: zk:2181
+# retryIntervalMilliseconds: 500
+# timeToLiveSeconds: 60
+# maxRetries: 3
+# operationTimeoutMilliseconds: 500
+# overwrite: true
+
rules:
- !AUTHORITY
users:
@@ -22,18 +35,6 @@ rules:
provider:
type: NATIVE
-# - !GOVERNANCE
-# registryCenter:
-# type: ZooKeeper
-# namespace: governance_ds
-# serverLists: zk:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: true
-
props:
max-connections-size-per-query: 1
executor-size: 16 # Infinite by default.