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

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 8bbb7c52883 Refactor : replace Proxy Container in scaling with the one 
in env module(#19956) (#19992)
8bbb7c52883 is described below

commit 8bbb7c52883bf6525117ab13795c792d67c055d2
Author: 孙念君 Nianjun Sun <[email protected]>
AuthorDate: Tue Aug 9 12:10:22 2022 +0800

    Refactor : replace Proxy Container in scaling with the one in env 
module(#19956) (#19992)
    
    * Refactor : replace Proxy Container in scaling with the one in env 
module(#19956)
    
    * Remove : remove scenario config from env
    
    * Remove : remove the duplicated container entry in scaling
---
 .../atomic/adapter/AdapterContainerFactory.java    | 18 +++++-
 .../impl/ShardingSphereProxyClusterContainer.java  | 51 +++++++++++++--
 .../src/test/resources/env/scaling/logback.xml     | 39 ++++++++++++
 .../test/resources/env/scaling/mysql/01-initdb.sql | 25 ++++++++
 .../src/test/resources/env/scaling/mysql/my.cnf}   | 38 ++++-------
 .../resources/env/scaling}/mysql/server-5.yaml     |  2 +-
 .../resources/env/scaling}/mysql/server-8.yaml     |  2 +-
 .../resources/env/scaling/postgresql/01-initdb.sql | 28 +++++++++
 .../env/scaling/postgresql/postgresql.conf}        | 36 +++--------
 .../resources/env/scaling/postgresql/server.yaml}  | 28 ++++++---
 .../data/pipeline/cases/base/BaseITCase.java       | 10 +--
 .../container/compose/DockerComposedContainer.java | 12 ++--
 .../proxy/ShardingSphereProxyDockerContainer.java  | 73 ----------------------
 .../src/test/resources/env/mysql/server-5.yaml     |  2 +-
 .../src/test/resources/env/mysql/server-8.yaml     |  2 +-
 15 files changed, 210 insertions(+), 156 deletions(-)

diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/AdapterContainerFactory.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/AdapterContainerFactory.java
index dd92a9c0cac..813fce9761c 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/AdapterContainerFactory.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/AdapterContainerFactory.java
@@ -42,10 +42,26 @@ public final class AdapterContainerFactory {
      * @return created instance
      */
     public static AdapterContainer newInstance(final String mode, final String 
adapter, final DatabaseType databaseType, final StorageContainer 
storageContainer, final String scenario) {
+        return newInstance(mode, adapter, databaseType, storageContainer, 
scenario, "");
+    }
+    
+    /**
+     * Create new instance of adapter container.
+     *
+     * @param mode mode
+     * @param adapter adapter
+     * @param databaseType database type
+     * @param storageContainer storage container
+     * @param scenario scenario
+     * @param module module
+     * @return created instance
+     */
+    public static AdapterContainer newInstance(final String mode, final String 
adapter, final DatabaseType databaseType,
+                                               final StorageContainer 
storageContainer, final String scenario, final String module) {
         switch (adapter) {
             case "proxy":
                 if ("Cluster".equalsIgnoreCase(mode)) {
-                    return new 
ShardingSphereProxyClusterContainer(databaseType, scenario);
+                    return new 
ShardingSphereProxyClusterContainer(databaseType, scenario, storageContainer, 
module);
                 }
                 return new 
ShardingSphereProxyStandaloneContainer(databaseType, scenario);
             case "jdbc":
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyClusterContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyClusterContainer.java
index 3b244e0f04b..43cb9fbe385 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyClusterContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyClusterContainer.java
@@ -19,11 +19,15 @@ package 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.
 
 import com.zaxxer.hikari.HikariDataSource;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.DockerITContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainer;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.StorageContainer;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.util.DatabaseTypeUtil;
 import 
org.apache.shardingsphere.test.integration.env.container.wait.JDBCConnectionWaitStrategy;
 import 
org.apache.shardingsphere.test.integration.env.runtime.DataSourceEnvironment;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.DockerITContainer;
 import org.testcontainers.containers.BindMode;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.shaded.com.google.common.base.Strings;
 
 import javax.sql.DataSource;
 import java.sql.DriverManager;
@@ -43,12 +47,18 @@ public final class ShardingSphereProxyClusterContainer 
extends DockerITContainer
     
     private final String scenario;
     
+    private final String module;
+    
+    private final StorageContainer storageContainer;
+    
     private final AtomicReference<DataSource> targetDataSourceProvider = new 
AtomicReference<>();
     
-    public ShardingSphereProxyClusterContainer(final DatabaseType 
databaseType, final String scenario) {
+    public ShardingSphereProxyClusterContainer(final DatabaseType 
databaseType, final String scenario, final StorageContainer storageContainer, 
final String module) {
         super("ShardingSphere-Proxy", "apache/shardingsphere-proxy-test");
         this.databaseType = databaseType;
         this.scenario = scenario;
+        this.module = module;
+        this.storageContainer = storageContainer;
     }
     
     /**
@@ -67,13 +77,44 @@ public final class ShardingSphereProxyClusterContainer 
extends DockerITContainer
     protected void configure() {
         withExposedPorts(3307);
         mapConfigurationFiles();
-        setWaitStrategy(new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType, 
getHost(), getMappedPort(3307), scenario), "proxy", "Proxy@123")));
+        if (Strings.isNullOrEmpty(module)) {
+            setWaitStrategy(new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType,
+                    getHost(), getMappedPort(3307), scenario), "proxy", 
"Proxy@123")));
+        }
+        if ("scaling".equalsIgnoreCase(module)) {
+            scalingConfigure();
+        }
+    }
+    
+    private void scalingConfigure() {
+        if (DatabaseTypeUtil.isPostgreSQL(databaseType)) {
+            setWaitStrategy(
+                    new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType, 
getHost(), getMappedPort(3307), "postgres"), "proxy", "Proxy@123")));
+        } else if (DatabaseTypeUtil.isMySQL(databaseType)) {
+            setWaitStrategy(new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType, 
getHost(), getMappedPort(3307), ""), "proxy", "Proxy@123")));
+        }
     }
     
     private void mapConfigurationFiles() {
         String pathInContainer = "/opt/shardingsphere-proxy/conf";
-        withClasspathResourceMapping("/env/common/cluster/proxy/conf/", 
pathInContainer, BindMode.READ_ONLY);
-        withClasspathResourceMapping("/env/scenario/" + scenario + 
"/proxy/conf/" + databaseType.getType().toLowerCase(), pathInContainer, 
BindMode.READ_ONLY);
+        if (Strings.isNullOrEmpty(module)) {
+            withClasspathResourceMapping("/env/common/standalone/proxy/conf/", 
pathInContainer, BindMode.READ_ONLY);
+            withClasspathResourceMapping("/env/scenario/" + scenario + 
"/proxy/conf/" + databaseType.getType().toLowerCase(), pathInContainer, 
BindMode.READ_ONLY);
+        }
+        if ("scaling".equalsIgnoreCase(module)) {
+            mapScalingConfigurationFiles();
+        }
+    }
+    
+    private void mapScalingConfigurationFiles() {
+        if (DatabaseTypeUtil.isMySQL(databaseType)) {
+            String majorVersion = 
DatabaseTypeUtil.parseMajorVersion(((GenericContainer<?>) 
storageContainer).getDockerImageName());
+            
withClasspathResourceMapping(String.format("/env/%s/%s/server-%s.yaml", module, 
databaseType.getType().toLowerCase(), majorVersion),
+                    "/opt/shardingsphere-proxy/conf/server.yaml", 
BindMode.READ_ONLY);
+        } else {
+            
withClasspathResourceMapping(String.format("/env/%s/%s/server.yaml", module, 
databaseType.getType().toLowerCase()), 
"/opt/shardingsphere-proxy/conf/server.yaml", BindMode.READ_ONLY);
+        }
+        withClasspathResourceMapping(String.format("/env/%s/logback.xml", 
module), "/opt/shardingsphere-proxy/conf/logback.xml", BindMode.READ_ONLY);
     }
     
     @Override
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/logback.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/logback.xml
new file mode 100644
index 00000000000..7597a483675
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/logback.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+  ~ 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.
+  -->
+
+<configuration>
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] 
%logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+    <logger name="org.apache.shardingsphere.mode" level="INFO" 
additivity="false">
+        <appender-ref ref="console" />
+    </logger>
+    <logger name="org.apache.shardingsphere.data.pipeline" level="INFO" 
additivity="false">
+        <appender-ref ref="console" />
+    </logger>
+    <logger name="org.apache.shardingsphere.driver" level="INFO" 
additivity="false">
+        <appender-ref ref="console" />
+    </logger>
+    <logger name="com.zaxxer.hikari.pool.ProxyConnection" level="OFF" />
+    <root>
+        <level value="WARN" />
+        <appender-ref ref="console" />
+    </root>
+</configuration> 
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/01-initdb.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/01-initdb.sql
new file mode 100644
index 00000000000..6c95fe0c2ba
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/01-initdb.sql
@@ -0,0 +1,25 @@
+--
+-- 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.
+--
+
+CREATE DATABASE scaling_it_0;
+CREATE DATABASE scaling_it_1;
+CREATE DATABASE scaling_it_2;
+CREATE DATABASE scaling_it_3;
+CREATE DATABASE scaling_it_4;
+
+GRANT REPLICATION CLIENT, REPLICATION SLAVE, SELECT, INSERT, UPDATE, DELETE, 
INDEX ON *.* TO `test_user`@`%`;
+GRANT CREATE, DROP ON TABLE *.* TO test_user;
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/my.cnf
similarity index 54%
copy from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
copy to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/my.cnf
index eb988740263..6d55640b7b2 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/my.cnf
@@ -15,31 +15,15 @@
 # limitations under the License.
 #
 
-mode:
-  type: Cluster
-  repository:
-    type: ZooKeeper
-    props:
-      namespace: it_db_mysql
-      server-lists: zk.host:2181
-      timeToLiveSeconds: 60
-      operationTimeoutMilliseconds: 500
-      retryIntervalMilliseconds: 500
-      maxRetries: 3
-  overwrite: false
+[mysql]
 
-rules:
-  - !AUTHORITY
-    users:
-      - root@:Root@123
-    provider:
-      type: ALL_PERMITTED
-
-props:
-  max-connections-size-per-query: 1
-  kernel-executor-size: 16  # Infinite by default.
-  proxy-frontend-flush-threshold: 128  # The default value is 128.
-  proxy-hint-enabled: true
-  sql-show: true
-  sql-federation-enabled: true
-  proxy-mysql-default-version: 8.0.11
+[mysqld]
+log-bin=mysql-bin
+binlog-format=row
+binlog-row-image=full
+max_connections=600
+default-authentication-plugin=mysql_native_password
+sql_mode=
+lower_case_table_names=1
+# for mysql 8.0
+secure_file_priv=/var/lib/mysql
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-5.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/server-5.yaml
similarity index 98%
copy from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-5.yaml
copy to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/server-5.yaml
index f538cf22287..4f15db8bae5 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-5.yaml
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/server-5.yaml
@@ -31,7 +31,7 @@ mode:
 rules:
   - !AUTHORITY
     users:
-      - root@:Root@123
+      - proxy@:Proxy@123
     provider:
       type: ALL_PERMITTED
 
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/server-8.yaml
similarity index 98%
copy from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
copy to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/server-8.yaml
index eb988740263..732f4c4c599 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/server-8.yaml
@@ -31,7 +31,7 @@ mode:
 rules:
   - !AUTHORITY
     users:
-      - root@:Root@123
+      - proxy@:Proxy@123
     provider:
       type: ALL_PERMITTED
 
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/01-initdb.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/01-initdb.sql
new file mode 100644
index 00000000000..bd8f263008e
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/01-initdb.sql
@@ -0,0 +1,28 @@
+--
+-- 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.
+
+CREATE DATABASE scaling_it_0;
+CREATE DATABASE scaling_it_1;
+CREATE DATABASE scaling_it_2;
+CREATE DATABASE scaling_it_3;
+CREATE DATABASE scaling_it_4;
+CREATE DATABASE scaling;
+
+GRANT CREATE, CONNECT ON DATABASE scaling_it_0 TO test_user;
+GRANT CREATE, CONNECT ON DATABASE scaling_it_1 TO test_user;
+GRANT CREATE, CONNECT ON DATABASE scaling_it_2 TO test_user;
+GRANT CREATE, CONNECT ON DATABASE scaling_it_3 TO test_user;
+GRANT CREATE, CONNECT ON DATABASE scaling_it_4 TO test_user;
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/postgresql.conf
similarity index 54%
copy from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
copy to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/postgresql.conf
index eb988740263..9d432a4cab4 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/postgresql.conf
@@ -15,31 +15,11 @@
 # limitations under the License.
 #
 
-mode:
-  type: Cluster
-  repository:
-    type: ZooKeeper
-    props:
-      namespace: it_db_mysql
-      server-lists: zk.host:2181
-      timeToLiveSeconds: 60
-      operationTimeoutMilliseconds: 500
-      retryIntervalMilliseconds: 500
-      maxRetries: 3
-  overwrite: false
-
-rules:
-  - !AUTHORITY
-    users:
-      - root@:Root@123
-    provider:
-      type: ALL_PERMITTED
-
-props:
-  max-connections-size-per-query: 1
-  kernel-executor-size: 16  # Infinite by default.
-  proxy-frontend-flush-threshold: 128  # The default value is 128.
-  proxy-hint-enabled: true
-  sql-show: true
-  sql-federation-enabled: true
-  proxy-mysql-default-version: 8.0.11
+listen_addresses = '*'
+wal_level = logical
+max_connections = 600
+max_replication_slots = 10
+log_timezone = 'Asia/Shanghai'
+datestyle = 'iso, mdy'
+timezone = 'Asia/Shanghai'
+wal_sender_timeout = 0
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-5.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/server.yaml
similarity index 52%
copy from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-5.yaml
copy to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/server.yaml
index f538cf22287..6836217929f 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-5.yaml
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/server.yaml
@@ -20,18 +20,19 @@ mode:
   repository:
     type: ZooKeeper
     props:
-      namespace: it_db_mysql
+      namespace: it_db_postgresql
       server-lists: zk.host:2181
-      timeToLiveSeconds: 60
-      operationTimeoutMilliseconds: 500
       retryIntervalMilliseconds: 500
+      timeToLiveSeconds: 60
       maxRetries: 3
-  overwrite: false
+      operationTimeoutMilliseconds: 500
+  overwrite: true
 
 rules:
   - !AUTHORITY
     users:
-      - root@:Root@123
+      - proxy@:Proxy@123
+      - sharding@:sharding
     provider:
       type: ALL_PERMITTED
 
@@ -39,7 +40,18 @@ props:
   max-connections-size-per-query: 1
   kernel-executor-size: 16  # Infinite by default.
   proxy-frontend-flush-threshold: 128  # The default value is 128.
-  proxy-hint-enabled: true
+  proxy-hint-enabled: false
   sql-show: true
-  sql-federation-enabled: true
-  proxy-mysql-default-version: 5.7.22 
+  check-table-metadata-enabled: false
+  # Proxy backend query fetch size. A larger value may increase the memory 
usage of ShardingSphere Proxy.
+  # The default value is -1, which means set the minimum value for different 
JDBC drivers.
+  proxy-backend-query-fetch-size: -1
+  proxy-frontend-executor-size: 0 # Proxy frontend executor size. The default 
value is 0, which means let Netty decide.
+  # Available options of proxy backend executor suitable: OLAP(default), OLTP. 
The OLTP option may reduce time cost of writing packets to client, but it may 
increase the latency of SQL execution
+  # and block other clients if client connections are more than 
`proxy-frontend-executor-size`, especially executing slow SQL.
+  proxy-backend-executor-suitable: OLAP
+  proxy-frontend-max-connections: 0 # Less than or equal to 0 means no 
limitation.
+  sql-federation-enabled: false
+  # Available proxy backend driver type: JDBC (default), ExperimentalVertx
+  proxy-backend-driver-type: JDBC
+  proxy-frontend-database-protocol-type: PostgreSQL
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
index bf0095f07e9..91f267f5d38 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
@@ -146,7 +146,7 @@ public abstract class BaseITCase {
             defaultDatabaseName = "postgres";
         }
         String jdbcUrl = 
composedContainer.getProxyJdbcUrl(defaultDatabaseName);
-        try (Connection connection = DriverManager.getConnection(jdbcUrl, 
"root", "Root@123")) {
+        try (Connection connection = DriverManager.getConnection(jdbcUrl, 
"proxy", "Proxy@123")) {
             if (ENV.getItEnvType() == ScalingITEnvTypeEnum.NATIVE) {
                 try {
                     executeWithLog(connection, "DROP DATABASE sharding_db");
@@ -165,8 +165,8 @@ public abstract class BaseITCase {
         HikariDataSource result = new HikariDataSource();
         
result.setDriverClassName(DataSourceEnvironment.getDriverClassName(getDatabaseType()));
         result.setJdbcUrl(composedContainer.getProxyJdbcUrl(databaseName));
-        result.setUsername("root");
-        result.setPassword("Root@123");
+        result.setUsername("proxy");
+        result.setPassword("Proxy@123");
         result.setMaximumPoolSize(2);
         result.setTransactionIsolation("TRANSACTION_READ_COMMITTED");
         return result;
@@ -191,12 +191,12 @@ public abstract class BaseITCase {
     protected void addSourceResource() {
         // TODO if mysql can append database firstly, they can be combined
         if (databaseType instanceof MySQLDatabaseType) {
-            try (Connection connection = 
DriverManager.getConnection(getComposedContainer().getProxyJdbcUrl(""), "root", 
"Root@123")) {
+            try (Connection connection = 
DriverManager.getConnection(getComposedContainer().getProxyJdbcUrl(""), 
"proxy", "Proxy@123")) {
                 connection.createStatement().execute("USE sharding_db");
                 addSourceResource0(connection);
             }
         } else {
-            try (Connection connection = 
DriverManager.getConnection(getComposedContainer().getProxyJdbcUrl("sharding_db"),
 "root", "Root@123")) {
+            try (Connection connection = 
DriverManager.getConnection(getComposedContainer().getProxyJdbcUrl("sharding_db"),
 "proxy", "Proxy@123")) {
                 addSourceResource0(connection);
             }
         }
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
index f240584886e..356fea2e2af 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
@@ -19,7 +19,8 @@ package 
org.apache.shardingsphere.integration.data.pipeline.framework.container.
 
 import lombok.Getter;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.proxy.ShardingSphereProxyDockerContainer;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainerFactory;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.impl.ShardingSphereProxyClusterContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.governance.GovernanceContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.governance.impl.ZookeeperContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
@@ -33,7 +34,7 @@ public final class DockerComposedContainer extends 
BaseComposedContainer {
     
     private final DatabaseType databaseType;
     
-    private final ShardingSphereProxyDockerContainer proxyContainer;
+    private final ShardingSphereProxyClusterContainer proxyContainer;
     
     @Getter
     private final DockerStorageContainer storageContainer;
@@ -42,10 +43,11 @@ public final class DockerComposedContainer extends 
BaseComposedContainer {
         this.databaseType = databaseType;
         GovernanceContainer governanceContainer = 
getContainers().registerContainer(new ZookeeperContainer());
         storageContainer = 
getContainers().registerContainer((DockerStorageContainer) 
StorageContainerFactory.newInstance(databaseType, dockerImageName, ""));
-        ShardingSphereProxyDockerContainer proxyContainer = new 
ShardingSphereProxyDockerContainer(databaseType, dockerImageName);
-        proxyContainer.dependsOn(governanceContainer, storageContainer);
+        ShardingSphereProxyClusterContainer proxyClusterContainer =
+                (ShardingSphereProxyClusterContainer) 
AdapterContainerFactory.newInstance("Cluster", "proxy", databaseType, 
storageContainer, "", "scaling");
+        proxyClusterContainer.dependsOn(governanceContainer, storageContainer);
         // TODO use proxy cluster will cause error sometimes, need to fix it.
-        this.proxyContainer = 
getContainers().registerContainer(proxyContainer);
+        this.proxyContainer = 
getContainers().registerContainer(proxyClusterContainer);
     }
     
     @Override
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java
deleted file mode 100644
index 9323b622469..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.integration.data.pipeline.framework.container.proxy;
-
-import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.DockerITContainer;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.util.DatabaseTypeUtil;
-import 
org.apache.shardingsphere.test.integration.env.container.wait.JDBCConnectionWaitStrategy;
-import 
org.apache.shardingsphere.test.integration.env.runtime.DataSourceEnvironment;
-import org.testcontainers.containers.BindMode;
-
-import java.sql.DriverManager;
-
-/**
- * ShardingSphere proxy container.
- */
-@Slf4j
-public final class ShardingSphereProxyDockerContainer extends 
DockerITContainer {
-    
-    private final DatabaseType databaseType;
-    
-    private final String storageImageName;
-    
-    public ShardingSphereProxyDockerContainer(final DatabaseType databaseType, 
final String storageImageName) {
-        super("Scaling-Proxy", "apache/shardingsphere-proxy-test");
-        this.databaseType = databaseType;
-        this.storageImageName = storageImageName;
-    }
-    
-    @Override
-    protected void configure() {
-        withExposedPorts(3307);
-        mapConfigurationFiles();
-        // TODO openGauss can't use this wait strategy now.
-        if (DatabaseTypeUtil.isPostgreSQL(databaseType)) {
-            setWaitStrategy(
-                    new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType, 
getHost(), getMappedPort(3307), "postgres"), "root", "Root@123")));
-        } else if (DatabaseTypeUtil.isMySQL(databaseType)) {
-            setWaitStrategy(new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType, 
getHost(), getMappedPort(3307), ""), "root", "Root@123")));
-        }
-    }
-    
-    private void mapConfigurationFiles() {
-        if (DatabaseTypeUtil.isMySQL(databaseType)) {
-            String majorVersion = 
DatabaseTypeUtil.parseMajorVersion(storageImageName);
-            
withClasspathResourceMapping(String.format("/env/%s/server-%s.yaml", 
databaseType.getType().toLowerCase(), majorVersion), 
"/opt/shardingsphere-proxy/conf/server.yaml", BindMode.READ_ONLY);
-        } else {
-            withClasspathResourceMapping(String.format("/env/%s/server.yaml", 
databaseType.getType().toLowerCase()), 
"/opt/shardingsphere-proxy/conf/server.yaml", BindMode.READ_ONLY);
-        }
-        withClasspathResourceMapping("/env/logback.xml", 
"/opt/shardingsphere-proxy/conf/logback.xml", BindMode.READ_ONLY);
-    }
-    
-    @Override
-    public String getAbbreviation() {
-        return "proxy";
-    }
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-5.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-5.yaml
index f538cf22287..4f15db8bae5 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-5.yaml
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-5.yaml
@@ -31,7 +31,7 @@ mode:
 rules:
   - !AUTHORITY
     users:
-      - root@:Root@123
+      - proxy@:Proxy@123
     provider:
       type: ALL_PERMITTED
 
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
index eb988740263..732f4c4c599 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server-8.yaml
@@ -31,7 +31,7 @@ mode:
 rules:
   - !AUTHORITY
     users:
-      - root@:Root@123
+      - proxy@:Proxy@123
     provider:
       type: ALL_PERMITTED
 

Reply via email to