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

zhaojinchao 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 e74369fb3a8 Add proxy global yaml config for empty_storage_units 
scenario (#30604)
e74369fb3a8 is described below

commit e74369fb3a849ee25b01938633448e1d499a7b91
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Fri Mar 22 14:48:03 2024 +0800

    Add proxy global yaml config for empty_storage_units scenario (#30604)
    
    * Add new empty_storage_units scenario to test system table query with sql 
federation
    
    * fix checkstyle
    
    * Add proxy global yaml config for empty_storage_units scenario
---
 .../ProxyClusterContainerConfigurationFactory.java | 22 ++++++--
 ...oxyStandaloneContainerConfigurationFactory.java | 22 ++++++--
 .../proxy/mode/cluster/mysql/global.yaml           | 58 ++++++++++++++++++++++
 .../proxy/mode/cluster/opengauss/global.yaml       | 58 ++++++++++++++++++++++
 .../proxy/mode/cluster/postgresql/global.yaml      | 58 ++++++++++++++++++++++
 .../proxy/mode/standalone/mysql/global.yaml        | 45 +++++++++++++++++
 .../proxy/mode/standalone/opengauss/global.yaml    | 45 +++++++++++++++++
 .../proxy/mode/standalone/postgresql/global.yaml   | 45 +++++++++++++++++
 8 files changed, 347 insertions(+), 6 deletions(-)

diff --git 
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/container/config/ProxyClusterContainerConfigurationFactory.java
 
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/container/config/ProxyClusterContainerConfigurationFactory.java
index ac41a89da8f..7bb606c5067 100644
--- 
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/container/config/ProxyClusterContainerConfigurationFactory.java
+++ 
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/container/config/ProxyClusterContainerConfigurationFactory.java
@@ -22,6 +22,7 @@ import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import 
org.apache.shardingsphere.test.e2e.env.container.atomic.adapter.config.AdaptorContainerConfiguration;
 import 
org.apache.shardingsphere.test.e2e.env.container.atomic.constants.ProxyContainerConstants;
+import org.jetbrains.annotations.NotNull;
 
 import java.net.URL;
 import java.util.HashMap;
@@ -49,12 +50,27 @@ public final class 
ProxyClusterContainerConfigurationFactory {
         Map<String, String> result = new HashMap<>(3, 1F);
         result.put("/env/common/cluster/proxy/conf/logback.xml", 
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "logback.xml");
         result.put("/env/scenario/" + scenario + "/proxy/conf/" + 
databaseType.getType().toLowerCase(), 
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER);
-        result.put(serverYamlExists(scenario) ? "/env/scenario/" + scenario + 
"/proxy/mode/cluster/global.yaml"
-                : "/env/common/cluster/proxy/conf/global.yaml", 
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "global.yaml");
+        result.put(getGlobalYamlPath(scenario, databaseType), 
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "global.yaml");
         return result;
     }
     
-    private static boolean serverYamlExists(final String scenario) {
+    @NotNull
+    private static String getGlobalYamlPath(final String scenario, final 
DatabaseType databaseType) {
+        if (isDialectScenarioGlobalYamlExists(scenario, databaseType)) {
+            return "/env/scenario/" + scenario + "/proxy/mode/cluster/" + 
databaseType.getType().toLowerCase() + "/global.yaml";
+        }
+        if (isScenarioGlobalYamlExists(scenario)) {
+            return "/env/scenario/" + scenario + 
"/proxy/mode/cluster/global.yaml";
+        }
+        return "/env/common/cluster/proxy/conf/global.yaml";
+    }
+    
+    private static boolean isDialectScenarioGlobalYamlExists(final String 
scenario, final DatabaseType databaseType) {
+        URL url = 
Thread.currentThread().getContextClassLoader().getResource("env/scenario/" + 
scenario + "/proxy/mode/cluster/" + databaseType.getType().toLowerCase() + 
"/global.yaml");
+        return null != url;
+    }
+    
+    private static boolean isScenarioGlobalYamlExists(final String scenario) {
         URL url = 
Thread.currentThread().getContextClassLoader().getResource("env/scenario/" + 
scenario + "/proxy/mode/cluster/global.yaml");
         return null != url;
     }
diff --git 
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/container/config/ProxyStandaloneContainerConfigurationFactory.java
 
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/container/config/ProxyStandaloneContainerConfigurationFactory.java
index 362c8b3cb8b..e01e26c5eda 100644
--- 
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/container/config/ProxyStandaloneContainerConfigurationFactory.java
+++ 
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/container/config/ProxyStandaloneContainerConfigurationFactory.java
@@ -23,6 +23,7 @@ import 
org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import 
org.apache.shardingsphere.test.e2e.env.container.atomic.adapter.config.AdaptorContainerConfiguration;
 import 
org.apache.shardingsphere.test.e2e.env.container.atomic.constants.ProxyContainerConstants;
 import 
org.apache.shardingsphere.test.e2e.env.container.atomic.util.AdapterContainerUtils;
+import org.jetbrains.annotations.NotNull;
 
 import java.net.URL;
 import java.util.HashMap;
@@ -49,12 +50,27 @@ public final class 
ProxyStandaloneContainerConfigurationFactory {
         Map<String, String> result = new HashMap<>(3, 1F);
         result.put("/env/common/standalone/proxy/conf/logback.xml", 
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "logback.xml");
         result.put("/env/scenario/" + scenario + "/proxy/conf/" + 
databaseType.getType().toLowerCase(), 
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER);
-        result.put(serverYamlExists(scenario) ? "/env/scenario/" + scenario + 
"/proxy/mode/standalone/global.yaml"
-                : "/env/common/standalone/proxy/conf/global.yaml", 
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "global.yaml");
+        result.put(getGlobalYamlPath(scenario, databaseType), 
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "global.yaml");
         return result;
     }
     
-    private static boolean serverYamlExists(final String scenario) {
+    @NotNull
+    private static String getGlobalYamlPath(final String scenario, final 
DatabaseType databaseType) {
+        if (isDialectScenarioGlobalYamlExists(scenario, databaseType)) {
+            return "/env/scenario/" + scenario + "/proxy/mode/standalone/" + 
databaseType.getType().toLowerCase() + "/global.yaml";
+        }
+        if (isScenarioGlobalYamlExists(scenario)) {
+            return "/env/scenario/" + scenario + 
"/proxy/mode/standalone/global.yaml";
+        }
+        return "/env/common/standalone/proxy/conf/global.yaml";
+    }
+    
+    private static boolean isDialectScenarioGlobalYamlExists(final String 
scenario, final DatabaseType databaseType) {
+        URL url = 
Thread.currentThread().getContextClassLoader().getResource("env/scenario/" + 
scenario + "/proxy/mode/standalone/" + databaseType.getType().toLowerCase() + 
"/global.yaml");
+        return null != url;
+    }
+    
+    private static boolean isScenarioGlobalYamlExists(final String scenario) {
         URL url = 
Thread.currentThread().getContextClassLoader().getResource("env/scenario/" + 
scenario + "/proxy/mode/standalone/global.yaml");
         return null != url;
     }
diff --git 
a/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/mysql/global.yaml
 
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/mysql/global.yaml
new file mode 100644
index 00000000000..4ebb9ff2c98
--- /dev/null
+++ 
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/mysql/global.yaml
@@ -0,0 +1,58 @@
+#
+# 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.
+#
+
+mode:
+  type: Cluster
+  repository:
+    type: ZooKeeper
+    props:
+      namespace: it_empty_storage_units
+      server-lists: zk.host:2181
+      timeToLiveSeconds: 60
+      operationTimeoutMilliseconds: 500
+      retryIntervalMilliseconds: 500
+      maxRetries: 3
+
+authority:
+  users:
+    - user: proxy
+      password: Proxy@123
+  privilege:
+    type: ALL_PERMITTED
+    
+sqlParser:
+  sqlStatementCache:
+    initialCapacity: 2000
+    maximumSize: 65535
+  parseTreeCache:
+    initialCapacity: 128
+    maximumSize: 1024
+    
+sqlFederation:
+  sqlFederationEnabled: true
+  executionPlanCache:
+    initialCapacity: 2000
+    maximumSize: 65535
+
+props:
+  max-connections-size-per-query: 1
+  kernel-executor-size: 16  # Infinite by default.
+  proxy-frontend-flush-threshold: 128  # The default value is 128.
+  sql-show: false
+#  proxy-frontend-ssl-enabled: true
+  proxy-meta-data-collector-enabled: true
+  proxy-frontend-database-protocol-type: MySQL
diff --git 
a/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/opengauss/global.yaml
 
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/opengauss/global.yaml
new file mode 100644
index 00000000000..6d094d12c92
--- /dev/null
+++ 
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/opengauss/global.yaml
@@ -0,0 +1,58 @@
+#
+# 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.
+#
+
+mode:
+  type: Cluster
+  repository:
+    type: ZooKeeper
+    props:
+      namespace: it_empty_storage_units
+      server-lists: zk.host:2181
+      timeToLiveSeconds: 60
+      operationTimeoutMilliseconds: 500
+      retryIntervalMilliseconds: 500
+      maxRetries: 3
+
+authority:
+  users:
+    - user: proxy
+      password: Proxy@123
+  privilege:
+    type: ALL_PERMITTED
+    
+sqlParser:
+  sqlStatementCache:
+    initialCapacity: 2000
+    maximumSize: 65535
+  parseTreeCache:
+    initialCapacity: 128
+    maximumSize: 1024
+    
+sqlFederation:
+  sqlFederationEnabled: true
+  executionPlanCache:
+    initialCapacity: 2000
+    maximumSize: 65535
+
+props:
+  max-connections-size-per-query: 1
+  kernel-executor-size: 16  # Infinite by default.
+  proxy-frontend-flush-threshold: 128  # The default value is 128.
+  sql-show: false
+  proxy-frontend-ssl-enabled: true
+  proxy-meta-data-collector-enabled: true
+  proxy-frontend-database-protocol-type: openGauss
diff --git 
a/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/postgresql/global.yaml
 
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/postgresql/global.yaml
new file mode 100644
index 00000000000..afe58d83943
--- /dev/null
+++ 
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/postgresql/global.yaml
@@ -0,0 +1,58 @@
+#
+# 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.
+#
+
+mode:
+  type: Cluster
+  repository:
+    type: ZooKeeper
+    props:
+      namespace: it_empty_storage_units
+      server-lists: zk.host:2181
+      timeToLiveSeconds: 60
+      operationTimeoutMilliseconds: 500
+      retryIntervalMilliseconds: 500
+      maxRetries: 3
+
+authority:
+  users:
+    - user: proxy
+      password: Proxy@123
+  privilege:
+    type: ALL_PERMITTED
+    
+sqlParser:
+  sqlStatementCache:
+    initialCapacity: 2000
+    maximumSize: 65535
+  parseTreeCache:
+    initialCapacity: 128
+    maximumSize: 1024
+    
+sqlFederation:
+  sqlFederationEnabled: true
+  executionPlanCache:
+    initialCapacity: 2000
+    maximumSize: 65535
+
+props:
+  max-connections-size-per-query: 1
+  kernel-executor-size: 16  # Infinite by default.
+  proxy-frontend-flush-threshold: 128  # The default value is 128.
+  sql-show: false
+  proxy-frontend-ssl-enabled: true
+  proxy-meta-data-collector-enabled: true
+  proxy-frontend-database-protocol-type: PostgreSQL
diff --git 
a/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/standalone/mysql/global.yaml
 
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/standalone/mysql/global.yaml
new file mode 100644
index 00000000000..584e48aabc9
--- /dev/null
+++ 
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/standalone/mysql/global.yaml
@@ -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.
+#
+
+authority:
+  users:
+    - user: proxy
+      password: Proxy@123
+  privilege:
+    type: ALL_PERMITTED
+
+sqlParser:
+  sqlStatementCache:
+    initialCapacity: 2000
+    maximumSize: 65535
+  parseTreeCache:
+    initialCapacity: 128
+    maximumSize: 1024
+
+sqlFederation:
+  sqlFederationEnabled: true
+  executionPlanCache:
+    initialCapacity: 2000
+    maximumSize: 65535
+
+props:
+  max-connections-size-per-query: 1
+  kernel-executor-size: 16  # Infinite by default.
+  proxy-frontend-flush-threshold: 128  # The default value is 128.
+  sql-show: false
+  proxy-frontend-ssl-enabled: true
+  proxy-frontend-database-protocol-type: MySQL
diff --git 
a/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/standalone/opengauss/global.yaml
 
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/standalone/opengauss/global.yaml
new file mode 100644
index 00000000000..11695cb7cca
--- /dev/null
+++ 
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/standalone/opengauss/global.yaml
@@ -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.
+#
+
+authority:
+  users:
+    - user: proxy
+      password: Proxy@123
+  privilege:
+    type: ALL_PERMITTED
+
+sqlParser:
+  sqlStatementCache:
+    initialCapacity: 2000
+    maximumSize: 65535
+  parseTreeCache:
+    initialCapacity: 128
+    maximumSize: 1024
+
+sqlFederation:
+  sqlFederationEnabled: true
+  executionPlanCache:
+    initialCapacity: 2000
+    maximumSize: 65535
+
+props:
+  max-connections-size-per-query: 1
+  kernel-executor-size: 16  # Infinite by default.
+  proxy-frontend-flush-threshold: 128  # The default value is 128.
+  sql-show: false
+  proxy-frontend-ssl-enabled: true
+  proxy-frontend-database-protocol-type: openGauss
diff --git 
a/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/standalone/postgresql/global.yaml
 
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/standalone/postgresql/global.yaml
new file mode 100644
index 00000000000..7c7a008a93e
--- /dev/null
+++ 
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/standalone/postgresql/global.yaml
@@ -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.
+#
+
+authority:
+  users:
+    - user: proxy
+      password: Proxy@123
+  privilege:
+    type: ALL_PERMITTED
+
+sqlParser:
+  sqlStatementCache:
+    initialCapacity: 2000
+    maximumSize: 65535
+  parseTreeCache:
+    initialCapacity: 128
+    maximumSize: 1024
+
+sqlFederation:
+  sqlFederationEnabled: true
+  executionPlanCache:
+    initialCapacity: 2000
+    maximumSize: 65535
+
+props:
+  max-connections-size-per-query: 1
+  kernel-executor-size: 16  # Infinite by default.
+  proxy-frontend-flush-threshold: 128  # The default value is 128.
+  sql-show: false
+  proxy-frontend-ssl-enabled: true
+  proxy-frontend-database-protocol-type: PostgreSQL

Reply via email to