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

duanzhengqiang 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 a593ad99ad4 Add readwrite splitting e2e in transaction (#24854)
a593ad99ad4 is described below

commit a593ad99ad4f77d992071ccc30e94edb704f3275
Author: ZhangCheng <[email protected]>
AuthorDate: Mon Mar 27 17:30:41 2023 +0800

    Add readwrite splitting e2e in transaction (#24854)
    
    * Add readwrite splitting e2e in transaction
    
    * Add readwrite splitting e2e in transaction
    
    * Add readwrite splitting e2e in transaction
---
 .../cases/base/BaseTransactionTestCase.java        |   2 +-
 .../cases/nested/NestedTransactionTestCase.java    |   2 +-
 .../ReadwriteSplittingInTransactionTestCase.java   | 106 +++++++++++++++++++++
 .../cases/settype/SetTransactionTypeTestCase.java  |   2 +-
 .../transaction/env/TransactionE2EEnvironment.java |   7 +-
 .../container/compose/DockerContainerComposer.java |  25 ++++-
 .../e2e/transaction/util/TestCaseClassScanner.java |  10 +-
 .../src/test/resources/env/it-env.properties       |   2 +-
 .../readwrite-splitting/data/actual/databases.xml  |  25 +++++
 .../readwrite-splitting/data/actual/dataset.xml    |  19 ++++
 .../data/actual/init-sql/mysql/01-actual-init.sql  |  42 ++++++++
 .../actual/init-sql/opengauss/01-actual-init.sql   |  49 ++++++++++
 .../actual/init-sql/postgresql/01-actual-init.sql  |  49 ++++++++++
 .../data/expected/databases.xml                    |  21 ++++
 .../readwrite-splitting/data/expected/dataset.xml  |  19 ++++
 .../expected/init-sql/mysql/01-expected-init.sql   |  19 ++++
 .../init-sql/opengauss/01-expected-init.sql        |  19 ++++
 .../init-sql/postgresql/01-expected-init.sql       |  19 ++++
 .../mysql/config-readwrite-splitting-local.yaml    |  67 +++++++++++++
 .../config-readwrite-splitting-xa-atomikos.yaml    |  68 +++++++++++++
 .../config-readwrite-splitting-xa-narayana.yaml    |  68 +++++++++++++
 .../conf/mysql/config-readwrite-splitting.yaml     |  65 +++++++++++++
 .../conf/opengauss/config-readwrite-splitting.yaml |  65 +++++++++++++
 .../postgresql/config-readwrite-splitting.yaml     |  65 +++++++++++++
 24 files changed, 817 insertions(+), 18 deletions(-)

diff --git 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/base/BaseTransactionTestCase.java
 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/base/BaseTransactionTestCase.java
index f793b701996..d1e5d8afd12 100644
--- 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/base/BaseTransactionTestCase.java
+++ 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/base/BaseTransactionTestCase.java
@@ -94,7 +94,7 @@ public abstract class BaseTransactionTestCase {
     
     protected static void assertTableRowCount(final Connection connection, 
final String tableName, final int rowNum) throws SQLException {
         Statement statement = connection.createStatement();
-        ResultSet resultSet = statement.executeQuery("select * from " + 
tableName);
+        ResultSet resultSet = statement.executeQuery(String.format("select * 
from %s", tableName));
         int resultSetCount = 0;
         while (resultSet.next()) {
             resultSetCount++;
diff --git 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/nested/NestedTransactionTestCase.java
 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/nested/NestedTransactionTestCase.java
index 768a5f0d99e..ca349201e10 100644
--- 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/nested/NestedTransactionTestCase.java
+++ 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/nested/NestedTransactionTestCase.java
@@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  * Nested transaction test case.
  */
 @TransactionTestCase(transactionTypes = TransactionType.LOCAL, adapters = 
TransactionTestConstants.JDBC)
-public class NestedTransactionTestCase extends BaseTransactionTestCase {
+public final class NestedTransactionTestCase extends BaseTransactionTestCase {
     
     public NestedTransactionTestCase(final TransactionBaseE2EIT 
baseTransactionITCase, final DataSource dataSource) {
         super(baseTransactionITCase, dataSource);
diff --git 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readwritesplitting/ReadwriteSplittingInTransactionTestCase.java
 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readwritesplitting/ReadwriteSplittingInTransactionTestCase.java
new file mode 100644
index 00000000000..9c3a6af0399
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readwritesplitting/ReadwriteSplittingInTransactionTestCase.java
@@ -0,0 +1,106 @@
+/*
+ * 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.test.e2e.transaction.cases.readwritesplitting;
+
+import 
org.apache.shardingsphere.test.e2e.transaction.cases.base.BaseTransactionTestCase;
+import 
org.apache.shardingsphere.test.e2e.transaction.engine.base.TransactionBaseE2EIT;
+import 
org.apache.shardingsphere.test.e2e.transaction.engine.base.TransactionContainerComposer;
+import 
org.apache.shardingsphere.test.e2e.transaction.engine.base.TransactionTestCase;
+import 
org.apache.shardingsphere.test.e2e.transaction.engine.constants.TransactionTestConstants;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Arrays;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@TransactionTestCase(dbTypes = TransactionTestConstants.MYSQL, scenario = 
"readwrite-splitting", adapters = TransactionTestConstants.PROXY)
+public final class ReadwriteSplittingInTransactionTestCase extends 
BaseTransactionTestCase {
+    
+    public ReadwriteSplittingInTransactionTestCase(final TransactionBaseE2EIT 
baseTransactionITCase, final DataSource dataSource) {
+        super(baseTransactionITCase, dataSource);
+    }
+    
+    @Override
+    protected void executeTest(final TransactionContainerComposer 
containerComposer) throws SQLException {
+        assertRollback();
+        assertCommit();
+    }
+    
+    private void assertRollback() throws SQLException {
+        try (Connection connection = getDataSource().getConnection()) {
+            assertRouteToReadDataSource(preview(connection, "SELECT * FROM 
account"));
+            connection.setAutoCommit(false);
+            assertAccountRowCount(connection, 0);
+            assertRouteToWriteDataSource(preview(connection, "INSERT INTO 
account(id, balance, transaction_id) VALUES(1, 1, 1)"));
+            executeWithLog(connection, "INSERT INTO account(id, balance, 
transaction_id) VALUES(1, 1, 1)");
+            assertRouteToReadDataSource(preview(connection, "SELECT * FROM 
account"));
+            assertRouteToWriteDataSource(preview(connection, "SELECT COUNT(*) 
FROM account FOR UPDATE"));
+            assertWriteDataSourceTableRowCount(connection, 1);
+            assertAccountRowCount(connection, 0);
+            connection.rollback();
+        }
+    }
+    
+    private void assertCommit() throws SQLException {
+        try (Connection connection = getDataSource().getConnection()) {
+            assertRouteToReadDataSource(preview(connection, "SELECT * FROM 
account"));
+            connection.setAutoCommit(false);
+            assertAccountRowCount(connection, 0);
+            assertRouteToWriteDataSource(preview(connection, "INSERT INTO 
account(id, balance, transaction_id) VALUES(1, 1, 1)"));
+            executeWithLog(connection, "INSERT INTO account(id, balance, 
transaction_id) VALUES(1, 1, 1)");
+            assertRouteToReadDataSource(preview(connection, "SELECT * FROM 
account"));
+            assertRouteToWriteDataSource(preview(connection, "SELECT COUNT(*) 
FROM account FOR UPDATE"));
+            assertWriteDataSourceTableRowCount(connection, 1);
+            assertAccountRowCount(connection, 0);
+            connection.commit();
+        }
+    }
+    
+    private String preview(final Connection connection, final String sql) 
throws SQLException {
+        ResultSet resultSet = 
connection.createStatement().executeQuery(String.format("PREVIEW %s;", sql));
+        if (resultSet.next()) {
+            return resultSet.getString("data_source_name");
+        }
+        return "";
+    }
+    
+    private void assertWriteDataSourceTableRowCount(final Connection 
connection, final int rowNum) throws SQLException {
+        Statement statement = connection.createStatement();
+        ResultSet resultSet = statement.executeQuery("SELECT COUNT(*) FROM 
account FOR UPDATE");
+        int resultSetCount = 0;
+        while (resultSet.next()) {
+            resultSetCount++;
+        }
+        statement.close();
+        assertThat(String.format("Recode num assert error, expect: %s, actual: 
%s.", rowNum, resultSetCount), resultSetCount, is(rowNum));
+    }
+    
+    private void assertRouteToReadDataSource(final String routedDataSource) {
+        assertTrue(Arrays.asList("read_ds_0", 
"read_ds_1").contains(routedDataSource));
+    }
+    
+    private void assertRouteToWriteDataSource(final String routedDataSource) {
+        assertThat(routedDataSource, is("write_ds"));
+    }
+}
diff --git 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/settype/SetTransactionTypeTestCase.java
 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/settype/SetTransactionTypeTestCase.java
index 2ae28dd7749..7194789ace6 100644
--- 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/settype/SetTransactionTypeTestCase.java
+++ 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/settype/SetTransactionTypeTestCase.java
@@ -36,7 +36,7 @@ import static org.hamcrest.Matchers.is;
  * Set transaction type test case.
  */
 @TransactionTestCase(adapters = TransactionTestConstants.PROXY, 
transactionTypes = TransactionType.XA)
-public class SetTransactionTypeTestCase extends BaseTransactionTestCase {
+public final class SetTransactionTypeTestCase extends BaseTransactionTestCase {
     
     public SetTransactionTypeTestCase(final TransactionBaseE2EIT 
baseTransactionITCase, final DataSource dataSource) {
         super(baseTransactionITCase, dataSource);
diff --git 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/TransactionE2EEnvironment.java
 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/TransactionE2EEnvironment.java
index 8ee5df26eaf..6ee5ac9be0e 100644
--- 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/TransactionE2EEnvironment.java
+++ 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/TransactionE2EEnvironment.java
@@ -76,12 +76,11 @@ public final class TransactionE2EEnvironment {
     }
     
     private Map<String, TransactionTestCaseRegistry> 
initTransactionTestCaseRegistryMap() {
-        final Map<String, TransactionTestCaseRegistry> 
transactionTestCaseRegistryMap;
-        transactionTestCaseRegistryMap = new 
HashMap<>(TransactionTestCaseRegistry.values().length, 1);
+        Map<String, TransactionTestCaseRegistry> result = new 
HashMap<>(TransactionTestCaseRegistry.values().length, 1);
         for (TransactionTestCaseRegistry each : 
TransactionTestCaseRegistry.values()) {
-            
transactionTestCaseRegistryMap.put(each.getTestCaseClass().getName(), each);
+            result.put(each.getTestCaseClass().getName(), each);
         }
-        return transactionTestCaseRegistryMap;
+        return result;
     }
     
     private List<String> splitProperty(final String key) {
diff --git 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/compose/DockerContainerComposer.java
 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/compose/DockerContainerComposer.java
index 81495476eb5..866a9f58049 100644
--- 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/compose/DockerContainerComposer.java
+++ 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/compose/DockerContainerComposer.java
@@ -35,6 +35,7 @@ import 
org.apache.shardingsphere.test.e2e.transaction.framework.container.config
 import 
org.apache.shardingsphere.test.e2e.transaction.framework.container.jdbc.ShardingSphereJDBCContainer;
 import 
org.apache.shardingsphere.test.e2e.transaction.framework.param.TransactionTestParameter;
 
+import java.net.URL;
 import java.util.Objects;
 
 /**
@@ -69,19 +70,33 @@ public final class DockerContainerComposer extends 
BaseContainerComposer {
         } else {
             proxyContainer = null;
             ShardingSphereJDBCContainer jdbcContainer = new 
ShardingSphereJDBCContainer(storageContainer,
-                    
Objects.requireNonNull(ShardingSphereJDBCContainer.class.getClassLoader().getResource(getShardingSphereConfigResource(testParam))).getFile());
+                    
Objects.requireNonNull(getShardingSphereConfigResource(testParam)).getFile());
             this.jdbcContainer = 
getContainers().registerContainer(jdbcContainer);
         }
     }
     
-    private String getShardingSphereConfigResource(final 
TransactionTestParameter testParam) {
-        String result = String.format("env/%s/%s/config-sharding-%s%s.yaml", 
testParam.getAdapter().toLowerCase(),
-                testParam.getDatabaseType().getType().toLowerCase(), 
testParam.getTransactionTypes().get(0).toString().toLowerCase(),
-                getTransactionProvider(testParam.getProviders().get(0)));
+    private URL getShardingSphereConfigResource(final TransactionTestParameter 
testParam) {
+        URL result = 
ShardingSphereJDBCContainer.class.getClassLoader().getResource(getScenarioResource(testParam));
+        if (null != result) {
+            return result;
+        }
+        result = 
ShardingSphereJDBCContainer.class.getClassLoader().getResource(getDefaultResource(testParam));
         log.info("Transaction IT tests use the configuration file: {}", 
result);
         return result;
     }
     
+    private String getDefaultResource(final TransactionTestParameter 
testParam) {
+        return String.format("env/%s/%s/config-sharding-%s%s.yaml", 
testParam.getAdapter().toLowerCase(),
+                testParam.getDatabaseType().getType().toLowerCase(), 
testParam.getTransactionTypes().get(0).toString().toLowerCase(),
+                getTransactionProvider(testParam.getProviders().get(0)));
+    }
+    
+    private String getScenarioResource(final TransactionTestParameter 
testParam) {
+        return String.format("env/scenario/%s/%s/conf/%s/config-%s-%s%s.yaml", 
testParam.getScenario(), testParam.getAdapter().toLowerCase(),
+                testParam.getDatabaseType().getType().toLowerCase(), 
testParam.getScenario(), 
testParam.getTransactionTypes().get(0).toString().toLowerCase(),
+                getTransactionProvider(testParam.getProviders().get(0)));
+    }
+    
     private String getTransactionProvider(final String providerType) {
         return Strings.isNullOrEmpty(providerType) ? "" : "-" + 
providerType.toLowerCase();
     }
diff --git 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/util/TestCaseClassScanner.java
 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/util/TestCaseClassScanner.java
index c80a3259ae0..060256c773a 100644
--- 
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/util/TestCaseClassScanner.java
+++ 
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/util/TestCaseClassScanner.java
@@ -55,27 +55,27 @@ public final class TestCaseClassScanner {
      */
     @SneakyThrows({IOException.class, ClassNotFoundException.class})
     public static List<Class<? extends BaseTransactionTestCase>> scan() {
-        final Enumeration<URL> urls = 
Thread.currentThread().getContextClassLoader().getResources(TEST_CASE_PACKAGE_NAME.replace(".",
 File.separator));
+        Enumeration<URL> urls = 
Thread.currentThread().getContextClassLoader().getResources(TEST_CASE_PACKAGE_NAME.replace(".",
 File.separator));
         return scanURL(urls);
     }
     
     private static List<Class<? extends BaseTransactionTestCase>> 
scanURL(final Enumeration<URL> urls) throws IOException, ClassNotFoundException 
{
-        List<Class<? extends BaseTransactionTestCase>> caseClasses = new 
LinkedList<>();
+        List<Class<? extends BaseTransactionTestCase>> result = new 
LinkedList<>();
         while (urls.hasMoreElements()) {
             URL url = urls.nextElement();
             String protocol = url.getProtocol();
             switch (protocol) {
                 case "file":
-                    addTestCaseClassesFromClassFiles(url, caseClasses);
+                    addTestCaseClassesFromClassFiles(url, result);
                     break;
                 case "jar":
-                    addTestCaseClassesInJars(url, caseClasses);
+                    addTestCaseClassesInJars(url, result);
                     break;
                 default:
                     break;
             }
         }
-        return caseClasses;
+        return result;
     }
     
     private static void addTestCaseClassesFromClassFiles(final URL url, final 
List<Class<? extends BaseTransactionTestCase>> caseClasses) throws 
UnsupportedEncodingException, ClassNotFoundException {
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/it-env.properties 
b/test/e2e/operation/transaction/src/test/resources/env/it-env.properties
index 4dd4e96719c..0990d1cb5b2 100644
--- a/test/e2e/operation/transaction/src/test/resources/env/it-env.properties
+++ b/test/e2e/operation/transaction/src/test/resources/env/it-env.properties
@@ -17,7 +17,7 @@
 # transaction.it.type=NONE,DOCKER,NATIVE
 transaction.it.env.type=NONE
 # transaction.it.env.cases=ClassicTransferTestCase, 
PostgreSQLSavePointTestCase, TransactionTypeHolderTestCase 
-transaction.it.env.cases=MultiJDBCConnectionsTestCase, 
MultiTransactionInConnectionTestCase, MultiOperationsCommitAndRollbackTestCase, 
MySQLAutoCommitTestCase, PostgreSQLAutoCommitTestCase, 
BroadcastTableTransactionTestCase, ExceptionInTransactionTestCase, 
MultiTableCommitAndRollbackTestCase, SingleTableCommitAndRollbackTestCase, 
MySQLSetReadOnlyTestCase, MySQLSavePointTestCase, MySQLLocalTruncateTestCase, 
MySQLXATruncateTestCase, OpenGaussCursorTestCase, NestedTransactionTestCase, 
SetTr [...]
+transaction.it.env.cases=MultiJDBCConnectionsTestCase, 
MultiTransactionInConnectionTestCase, MultiOperationsCommitAndRollbackTestCase, 
MySQLAutoCommitTestCase, PostgreSQLAutoCommitTestCase, 
BroadcastTableTransactionTestCase, ExceptionInTransactionTestCase, 
MultiTableCommitAndRollbackTestCase, SingleTableCommitAndRollbackTestCase, 
MySQLSetReadOnlyTestCase, MySQLSavePointTestCase, MySQLLocalTruncateTestCase, 
MySQLXATruncateTestCase, OpenGaussCursorTestCase, NestedTransactionTestCase, 
SetTr [...]
 # transaction.it.env.transtypes=LOCAL, XA, BASE
 transaction.it.env.transtypes=LOCAL, XA
 # transaction.it.env.xa.providers=Atomikos, Bitronix, Narayana
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/databases.xml
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/databases.xml
new file mode 100644
index 00000000000..ec29710fe6e
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/databases.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<databases>
+    <database>write_ds</database>
+    <database>read_ds_0</database>
+    <database>read_ds_1</database>
+    <database>transaction_ds_0</database>
+    <database>transaction_ds_1</database>
+</databases>
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/dataset.xml
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/dataset.xml
new file mode 100644
index 00000000000..840ad09871f
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/dataset.xml
@@ -0,0 +1,19 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset>
+</dataset>
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/init-sql/mysql/01-actual-init.sql
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/init-sql/mysql/01-actual-init.sql
new file mode 100644
index 00000000000..38344a363ed
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/init-sql/mysql/01-actual-init.sql
@@ -0,0 +1,42 @@
+--
+-- 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.
+--
+
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
+DROP DATABASE IF EXISTS write_ds;
+DROP DATABASE IF EXISTS read_ds_0;
+DROP DATABASE IF EXISTS read_ds_1;
+
+CREATE DATABASE write_ds;
+CREATE DATABASE read_ds_0;
+CREATE DATABASE read_ds_1;
+
+CREATE TABLE write_ds.`t_order` (`order_id` INT PRIMARY KEY, `user_id` INT NOT 
NULL, `status` VARCHAR(45) NULL);
+CREATE TABLE write_ds.`t_order_item` (`item_id` INT PRIMARY KEY, `order_id` 
int NOT NULL, `user_id` int NOT NULL, `status` varchar(50) DEFAULT NULL);
+CREATE TABLE write_ds.`account`(`ID` BIGINT, `BALANCE` FLOAT, `TRANSACTION_ID` 
INT);
+CREATE TABLE write_ds.`t_address` (`id` INT PRIMARY KEY, `code` VARCHAR(36) 
DEFAULT NULL, `address` VARCHAR(36) DEFAULT NULL);
+
+CREATE TABLE read_ds_0.`t_order` (`order_id` INT PRIMARY KEY, `user_id` INT 
NOT NULL, `status` VARCHAR(45) NULL);
+CREATE TABLE read_ds_0.`t_order_item` (`item_id` INT PRIMARY KEY, `order_id` 
int NOT NULL, `user_id` int NOT NULL, `status` varchar(50) DEFAULT NULL);
+CREATE TABLE read_ds_0.`account`(`ID` BIGINT, `BALANCE` FLOAT, 
`TRANSACTION_ID` INT);
+CREATE TABLE read_ds_0.`t_address` (`id` INT PRIMARY KEY, `code` VARCHAR(36) 
DEFAULT NULL, `address` VARCHAR(36) DEFAULT NULL);
+
+CREATE TABLE read_ds_1.`t_order` (`order_id` INT PRIMARY KEY, `user_id` INT 
NOT NULL, `status` VARCHAR(45) NULL);
+CREATE TABLE read_ds_1.`t_order_item` (`item_id` INT PRIMARY KEY, `order_id` 
int NOT NULL, `user_id` int NOT NULL, `status` varchar(50) DEFAULT NULL);
+CREATE TABLE read_ds_1.`account`(`ID` BIGINT, `BALANCE` FLOAT, 
`TRANSACTION_ID` INT);
+CREATE TABLE read_ds_1.`t_address` (`id` INT PRIMARY KEY, `code` VARCHAR(36) 
DEFAULT NULL, `address` VARCHAR(36) DEFAULT NULL);
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/init-sql/opengauss/01-actual-init.sql
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/init-sql/opengauss/01-actual-init.sql
new file mode 100644
index 00000000000..7934967650a
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/init-sql/opengauss/01-actual-init.sql
@@ -0,0 +1,49 @@
+--
+-- 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.
+--
+
+DROP DATABASE IF EXISTS write_ds;
+DROP DATABASE IF EXISTS read_ds_0;
+DROP DATABASE IF EXISTS read_ds_1;
+
+CREATE DATABASE write_ds;
+CREATE DATABASE read_ds_0;
+CREATE DATABASE read_ds_1;
+
+GRANT ALL PRIVILEGES ON DATABASE write_ds TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE read_ds_0 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE read_ds_1 TO test_user;
+
+\c write_ds;
+
+CREATE TABLE "t_order" ("order_id" INT PRIMARY KEY, "user_id" INT NOT NULL, 
"status" VARCHAR(45) NULL);
+CREATE TABLE "t_order_item" ("item_id" INT PRIMARY KEY, "order_id" int NOT 
NULL, "user_id" int NOT NULL, "status" varchar(50) DEFAULT NULL);
+CREATE TABLE "account"("id" INT, "balance" FLOAT, "transaction_id" INT);
+CREATE TABLE "t_address" ("id" INT PRIMARY KEY, "code" VARCHAR(36) DEFAULT 
NULL, "address" VARCHAR(36) DEFAULT NULL);
+
+\c read_ds_0;
+
+CREATE TABLE "t_order" ("order_id" INT PRIMARY KEY, "user_id" INT NOT NULL, 
"status" VARCHAR(45) NULL);
+CREATE TABLE "t_order_item" ("item_id" INT PRIMARY KEY, "order_id" int NOT 
NULL, "user_id" int NOT NULL, "status" varchar(50) DEFAULT NULL);
+CREATE TABLE "account"("id" INT, "balance" FLOAT, "transaction_id" INT);
+CREATE TABLE "t_address" ("id" INT PRIMARY KEY, "code" VARCHAR(36) DEFAULT 
NULL, "address" VARCHAR(36) DEFAULT NULL);
+
+\c read_ds_1;
+
+CREATE TABLE "t_order" ("order_id" INT PRIMARY KEY, "user_id" INT NOT NULL, 
"status" VARCHAR(45) NULL);
+CREATE TABLE "t_order_item" ("item_id" INT PRIMARY KEY, "order_id" int NOT 
NULL, "user_id" int NOT NULL, "status" varchar(50) DEFAULT NULL);
+CREATE TABLE "account"("id" INT, "balance" FLOAT, "transaction_id" INT);
+CREATE TABLE "t_address" ("id" INT PRIMARY KEY, "code" VARCHAR(36) DEFAULT 
NULL, "address" VARCHAR(36) DEFAULT NULL);
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/init-sql/postgresql/01-actual-init.sql
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/init-sql/postgresql/01-actual-init.sql
new file mode 100644
index 00000000000..7934967650a
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/actual/init-sql/postgresql/01-actual-init.sql
@@ -0,0 +1,49 @@
+--
+-- 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.
+--
+
+DROP DATABASE IF EXISTS write_ds;
+DROP DATABASE IF EXISTS read_ds_0;
+DROP DATABASE IF EXISTS read_ds_1;
+
+CREATE DATABASE write_ds;
+CREATE DATABASE read_ds_0;
+CREATE DATABASE read_ds_1;
+
+GRANT ALL PRIVILEGES ON DATABASE write_ds TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE read_ds_0 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE read_ds_1 TO test_user;
+
+\c write_ds;
+
+CREATE TABLE "t_order" ("order_id" INT PRIMARY KEY, "user_id" INT NOT NULL, 
"status" VARCHAR(45) NULL);
+CREATE TABLE "t_order_item" ("item_id" INT PRIMARY KEY, "order_id" int NOT 
NULL, "user_id" int NOT NULL, "status" varchar(50) DEFAULT NULL);
+CREATE TABLE "account"("id" INT, "balance" FLOAT, "transaction_id" INT);
+CREATE TABLE "t_address" ("id" INT PRIMARY KEY, "code" VARCHAR(36) DEFAULT 
NULL, "address" VARCHAR(36) DEFAULT NULL);
+
+\c read_ds_0;
+
+CREATE TABLE "t_order" ("order_id" INT PRIMARY KEY, "user_id" INT NOT NULL, 
"status" VARCHAR(45) NULL);
+CREATE TABLE "t_order_item" ("item_id" INT PRIMARY KEY, "order_id" int NOT 
NULL, "user_id" int NOT NULL, "status" varchar(50) DEFAULT NULL);
+CREATE TABLE "account"("id" INT, "balance" FLOAT, "transaction_id" INT);
+CREATE TABLE "t_address" ("id" INT PRIMARY KEY, "code" VARCHAR(36) DEFAULT 
NULL, "address" VARCHAR(36) DEFAULT NULL);
+
+\c read_ds_1;
+
+CREATE TABLE "t_order" ("order_id" INT PRIMARY KEY, "user_id" INT NOT NULL, 
"status" VARCHAR(45) NULL);
+CREATE TABLE "t_order_item" ("item_id" INT PRIMARY KEY, "order_id" int NOT 
NULL, "user_id" int NOT NULL, "status" varchar(50) DEFAULT NULL);
+CREATE TABLE "account"("id" INT, "balance" FLOAT, "transaction_id" INT);
+CREATE TABLE "t_address" ("id" INT PRIMARY KEY, "code" VARCHAR(36) DEFAULT 
NULL, "address" VARCHAR(36) DEFAULT NULL);
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/databases.xml
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/databases.xml
new file mode 100644
index 00000000000..7d313fee9d0
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/databases.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<databases>
+    <database>dataset</database>
+</databases>
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/dataset.xml
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/dataset.xml
new file mode 100644
index 00000000000..840ad09871f
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/dataset.xml
@@ -0,0 +1,19 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset>
+</dataset>
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/init-sql/mysql/01-expected-init.sql
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/init-sql/mysql/01-expected-init.sql
new file mode 100644
index 00000000000..a7f01e4652d
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/init-sql/mysql/01-expected-init.sql
@@ -0,0 +1,19 @@
+--
+-- 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.
+--
+
+DROP DATABASE IF EXISTS dataset;
+CREATE DATABASE dataset;
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/init-sql/opengauss/01-expected-init.sql
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/init-sql/opengauss/01-expected-init.sql
new file mode 100644
index 00000000000..a7f01e4652d
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/init-sql/opengauss/01-expected-init.sql
@@ -0,0 +1,19 @@
+--
+-- 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.
+--
+
+DROP DATABASE IF EXISTS dataset;
+CREATE DATABASE dataset;
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/init-sql/postgresql/01-expected-init.sql
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/init-sql/postgresql/01-expected-init.sql
new file mode 100644
index 00000000000..a7f01e4652d
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/data/expected/init-sql/postgresql/01-expected-init.sql
@@ -0,0 +1,19 @@
+--
+-- 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.
+--
+
+DROP DATABASE IF EXISTS dataset;
+CREATE DATABASE dataset;
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/jdbc/conf/mysql/config-readwrite-splitting-local.yaml
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/jdbc/conf/mysql/config-readwrite-splitting-local.yaml
new file mode 100644
index 00000000000..8c04c48f47c
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/jdbc/conf/mysql/config-readwrite-splitting-local.yaml
@@ -0,0 +1,67 @@
+#
+# 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.
+#
+
+######################################################################################################
+# 
+# If you want to configure governance, authorization and proxy properties, 
please refer to this file.
+# 
+######################################################################################################
+
+databaseName: sharding_db
+dataSources:
+  write_ds:
+    url: 
jdbc:mysql://mysql.readwrite-splitting.host:3306/write_ds?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  read_ds_0:
+    url: 
jdbc:mysql://mysql.readwrite-splitting.host:3306/read_ds_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  read_ds_1:
+    url: 
jdbc:mysql://mysql.readwrite-splitting.host:3306/read_ds_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+rules:
+  - !TRANSACTION
+    defaultType: Local
+  - !READWRITE_SPLITTING
+    dataSources:
+      readwrite_ds:
+        staticStrategy:
+          writeDataSourceName: write_ds
+          readDataSourceNames:
+            - read_ds_0
+            - read_ds_1
+        loadBalancerName: random
+    loadBalancers:
+      random:
+        type: RANDOM
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/jdbc/conf/mysql/config-readwrite-splitting-xa-atomikos.yaml
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/jdbc/conf/mysql/config-readwrite-splitting-xa-atomikos.yaml
new file mode 100644
index 00000000000..8f9b37e51f2
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/jdbc/conf/mysql/config-readwrite-splitting-xa-atomikos.yaml
@@ -0,0 +1,68 @@
+#
+# 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.
+#
+
+######################################################################################################
+# 
+# If you want to configure governance, authorization and proxy properties, 
please refer to this file.
+# 
+######################################################################################################
+
+databaseName: sharding_db
+dataSources:
+  write_ds:
+    url: 
jdbc:mysql://mysql.readwrite-splitting.host:3306/write_ds?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  read_ds_0:
+    url: 
jdbc:mysql://mysql.readwrite-splitting.host:3306/read_ds_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  read_ds_1:
+    url: 
jdbc:mysql://mysql.readwrite-splitting.host:3306/read_ds_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+rules:
+  - !TRANSACTION
+    defaultType: XA
+    providerType: Atomikos
+  - !READWRITE_SPLITTING
+    dataSources:
+      readwrite_ds:
+        staticStrategy:
+          writeDataSourceName: write_ds
+          readDataSourceNames:
+            - read_ds_0
+            - read_ds_1
+        loadBalancerName: random
+    loadBalancers:
+      random:
+        type: RANDOM
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/jdbc/conf/mysql/config-readwrite-splitting-xa-narayana.yaml
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/jdbc/conf/mysql/config-readwrite-splitting-xa-narayana.yaml
new file mode 100644
index 00000000000..7ff774e8845
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/jdbc/conf/mysql/config-readwrite-splitting-xa-narayana.yaml
@@ -0,0 +1,68 @@
+#
+# 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.
+#
+
+######################################################################################################
+# 
+# If you want to configure governance, authorization and proxy properties, 
please refer to this file.
+# 
+######################################################################################################
+
+databaseName: sharding_db
+dataSources:
+  write_ds:
+    url: 
jdbc:mysql://mysql.readwrite-splitting.host:3306/write_ds?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  read_ds_0:
+    url: 
jdbc:mysql://mysql.readwrite-splitting.host:3306/read_ds_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  read_ds_1:
+    url: 
jdbc:mysql://mysql.readwrite-splitting.host:3306/read_ds_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+rules:
+  - !TRANSACTION
+    defaultType: XA
+    providerType: Narayana
+  - !READWRITE_SPLITTING
+    dataSources:
+      readwrite_ds:
+        staticStrategy:
+          writeDataSourceName: write_ds
+          readDataSourceNames:
+            - read_ds_0
+            - read_ds_1
+        loadBalancerName: random
+    loadBalancers:
+      random:
+        type: RANDOM
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/proxy/conf/mysql/config-readwrite-splitting.yaml
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/proxy/conf/mysql/config-readwrite-splitting.yaml
new file mode 100644
index 00000000000..9bc21c8ead1
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/proxy/conf/mysql/config-readwrite-splitting.yaml
@@ -0,0 +1,65 @@
+#
+# 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.
+#
+
+######################################################################################################
+# 
+# If you want to configure governance, authorization and proxy properties, 
please refer to this file.
+# 
+######################################################################################################
+
+databaseName: sharding_db
+dataSources:
+  write_ds:
+    url: 
jdbc:mysql://mysql.readwrite-splitting.host:3306/write_ds?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  read_ds_0:
+    url: 
jdbc:mysql://mysql.readwrite-splitting.host:3306/read_ds_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  read_ds_1:
+    url: 
jdbc:mysql://mysql.readwrite-splitting.host:3306/read_ds_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+rules:
+  - !READWRITE_SPLITTING
+    dataSources:
+      readwrite_ds:
+        staticStrategy:
+          writeDataSourceName: write_ds
+          readDataSourceNames:
+            - read_ds_0
+            - read_ds_1
+        loadBalancerName: random
+    loadBalancers:
+      random:
+        type: RANDOM
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/proxy/conf/opengauss/config-readwrite-splitting.yaml
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/proxy/conf/opengauss/config-readwrite-splitting.yaml
new file mode 100644
index 00000000000..9dc44606a1e
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/proxy/conf/opengauss/config-readwrite-splitting.yaml
@@ -0,0 +1,65 @@
+#
+# 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.
+#
+
+######################################################################################################
+# 
+# If you want to configure governance, authorization and proxy properties, 
please refer to this file.
+# 
+######################################################################################################
+
+databaseName: sharding_db
+dataSources:
+  write_ds:
+    url: jdbc:opengauss://opengauss.default.host:5432/write_ds
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  read_ds_0:
+    url: jdbc:opengauss://opengauss.default.host:5432/read_ds_0
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  read_ds_1:
+    url: jdbc:opengauss://opengauss.default.host:5432/read_ds_1
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+rules:
+  - !READWRITE_SPLITTING
+    dataSources:
+      readwrite_ds:
+        staticStrategy:
+          writeDataSourceName: write_ds
+          readDataSourceNames:
+            - read_ds_0
+            - read_ds_1
+        loadBalancerName: random
+    loadBalancers:
+      random:
+        type: RANDOM
diff --git 
a/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/proxy/conf/postgresql/config-readwrite-splitting.yaml
 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/proxy/conf/postgresql/config-readwrite-splitting.yaml
new file mode 100644
index 00000000000..fd8050e2437
--- /dev/null
+++ 
b/test/e2e/operation/transaction/src/test/resources/env/scenario/readwrite-splitting/proxy/conf/postgresql/config-readwrite-splitting.yaml
@@ -0,0 +1,65 @@
+#
+# 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.
+#
+
+######################################################################################################
+# 
+# If you want to configure governance, authorization and proxy properties, 
please refer to this file.
+# 
+######################################################################################################
+
+databaseName: sharding_db
+dataSources:
+  write_ds:
+    url: jdbc:postgresql://postgresql.default.host:5432/write_ds
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  read_ds_0:
+    url: jdbc:postgresql://postgresql.default.host:5432/read_ds_0
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  read_ds_1:
+    url: jdbc:postgresql://postgresql.default.host:5432/read_ds_1
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+rules:
+  - !READWRITE_SPLITTING
+    dataSources:
+      readwrite_ds:
+        staticStrategy:
+          writeDataSourceName: write_ds
+          readDataSourceNames:
+            - read_ds_0
+            - read_ds_1
+        loadBalancerName: random
+    loadBalancers:
+      random:
+        type: RANDOM

Reply via email to