This is an automated email from the ASF dual-hosted git repository.
zhaojinchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 791ed75e36b support shadow and readwrite-splitting mix it (#20858)
791ed75e36b is described below
commit 791ed75e36bd9e3536210a60c5eb1493e65b01d7
Author: Chuxin Chen <[email protected]>
AuthorDate: Wed Sep 7 17:10:45 2022 +0800
support shadow and readwrite-splitting mix it (#20858)
---
.github/workflows/it.yml | 2 +-
.../mysql/pro_insert_order_batch_value.xml | 39 ++++++++
.../mysql/pro_insert_order_value.xml | 38 +++++++
.../mysql/pro_update_order_by_user_id.xml | 37 +++++++
.../mysql/shadow_insert_order_batch_value.xml | 39 ++++++++
.../mysql/shadow_insert_order_value.xml | 38 +++++++
.../mysql/shadow_update_order_by_user_id.xml | 37 +++++++
.../postgresql/pro_insert_order_value.xml | 38 +++++++
.../postgresql/pro_update_order_by_user_id.xml | 37 +++++++
.../postgresql/shadow_insert_order_value.xml | 38 +++++++
.../postgresql/shadow_update_order_by_user_id.xml | 37 +++++++
.../pro_delete_order_by_user_id.xml | 35 +++++++
.../shadow_delete_order_by_user_id.xml | 35 +++++++
.../cases/dml/dml-integration-test-cases.xml | 28 +++---
.../cases/dql/dql-integration-test-cases.xml | 4 +
.../src/test/resources/env/it-env.properties | 4 +-
.../readwrite_splitting_and_shadow/authority.xml | 71 +++++++++++++
.../data/actual/databases.xml | 24 +++++
.../data/actual/dataset.xml | 53 ++++++++++
.../data/actual/init-sql/h2/01-actual-init.sql | 19 ++++
.../data/actual/init-sql/mysql/01-actual-init.sql | 39 ++++++++
.../data/actual/init-sql/oracle/01-actual-init.sql | 36 +++++++
.../actual/init-sql/postgresql/01-actual-init.sql | 58 +++++++++++
.../actual/init-sql/sqlserver/01-actual-init.sql | 38 +++++++
.../data/expected/databases.xml | 23 +++++
.../data/expected/dataset.xml | 47 +++++++++
.../data/expected/init-sql/h2/01-expected-init.sql | 20 ++++
.../data/expected/init-sql/mysql/expected-init.sql | 36 +++++++
.../expected/init-sql/oracle/expected-init.sql | 32 ++++++
.../expected/init-sql/postgresql/expected-init.sql | 53 ++++++++++
.../expected/init-sql/sqlserver/expected-init.sql | 32 ++++++
.../proxy/conf/mysql/config-shadow.yaml | 111 +++++++++++++++++++++
.../proxy/conf/postgresql/config-shadow.yaml | 111 +++++++++++++++++++++
.../readwrite_splitting_and_shadow/rules.yaml | 71 +++++++++++++
34 files changed, 1343 insertions(+), 17 deletions(-)
diff --git a/.github/workflows/it.yml b/.github/workflows/it.yml
index 40fc64f03e9..9a6abd7a882 100644
--- a/.github/workflows/it.yml
+++ b/.github/workflows/it.yml
@@ -180,7 +180,7 @@ jobs:
adapter: [ proxy, jdbc ]
mode: [ Standalone, Cluster ]
database: [ MySQL, PostgreSQL ]
- scenario: [ dbtbl_with_readwrite_splitting,
dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt,
encrypt_and_readwrite_splitting, encrypt_shadow ]
+ scenario: [ dbtbl_with_readwrite_splitting,
dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt,
encrypt_and_readwrite_splitting, encrypt_shadow, readwrite_splitting_and_shadow
]
exclude:
- adapter: jdbc
mode: Cluster
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/pro_insert_order_batch_value.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/pro_insert_order_batch_value.xml
new file mode 100644
index 00000000000..344d92ed24d
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/pro_insert_order_batch_value.xml
@@ -0,0 +1,39 @@
+<!--
+ ~ 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 update-count="2">
+ <metadata data-nodes="write_db.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db.t_shadow" values="1, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="2, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="3, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="4, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="5, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="7, 1, pro_order, S, true, 50,
summer, 100.00, 2021-01-01, 12:30:30, 2021-01-01 12:30:30.0" />
+ <row data-node="write_db.t_shadow" values="8, 1, pro_order, S, true, 50,
summer, 100.00, 2021-01-01, 12:30:30, 2021-01-01 12:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/pro_insert_order_value.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/pro_insert_order_value.xml
new file mode 100644
index 00000000000..cf6f48632cc
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/pro_insert_order_value.xml
@@ -0,0 +1,38 @@
+<!--
+ ~ 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 update-count="1">
+ <metadata data-nodes="write_db.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db.t_shadow" values="1, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="2, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="3, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="4, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="5, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="6, 1, pro_order, S, true, 50,
summer, 100.00, 2021-01-01, 12:30:30, 2021-01-01 12:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/pro_update_order_by_user_id.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/pro_update_order_by_user_id.xml
new file mode 100644
index 00000000000..7492b062592
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/pro_update_order_by_user_id.xml
@@ -0,0 +1,37 @@
+<!--
+ ~ 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 update-count="2">
+ <metadata data-nodes="write_db.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db.t_shadow" values="1, 1, pro_order_update, F,
false, 60, spring, 120.00, 2021-01-02, 13:30:30, 2021-01-02 13:30:30.0" />
+ <row data-node="write_db.t_shadow" values="2, 1, pro_order_update, F,
false, 60, spring, 120.00, 2021-01-02, 13:30:30, 2021-01-02 13:30:30.0" />
+ <row data-node="write_db.t_shadow" values="3, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="4, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="5, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/shadow_insert_order_batch_value.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/shadow_insert_order_batch_value.xml
new file mode 100644
index 00000000000..a99e5d8b2c6
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/shadow_insert_order_batch_value.xml
@@ -0,0 +1,39 @@
+<!--
+ ~ 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 update-count="2">
+ <metadata data-nodes="write_db_shadow.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db_shadow.t_shadow" values="1, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="2, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="3, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="4, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="5, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="7, 0, shadow_order, S,
true, 50, summer, 100.00, 2021-01-01, 12:30:30, 2021-01-01 12:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="8, 0, shadow_order, S,
true, 50, summer, 100.00, 2021-01-01, 12:30:30, 2021-01-01 12:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/shadow_insert_order_value.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/shadow_insert_order_value.xml
new file mode 100644
index 00000000000..c7ddbc498e4
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/shadow_insert_order_value.xml
@@ -0,0 +1,38 @@
+<!--
+ ~ 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 update-count="1">
+ <metadata data-nodes="write_db_shadow.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db_shadow.t_shadow" values="1, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="2, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="3, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="4, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="5, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="6, 0, shadow_order, S,
true, 50, summer, 100.00, 2021-01-01, 12:30:30, 2021-01-01 12:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/shadow_update_order_by_user_id.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/shadow_update_order_by_user_id.xml
new file mode 100644
index 00000000000..583850a699d
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/mysql/shadow_update_order_by_user_id.xml
@@ -0,0 +1,37 @@
+<!--
+ ~ 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 update-count="2">
+ <metadata data-nodes="write_db_shadow.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db_shadow.t_shadow" values="1, 0,
shadow_order_update, F, false, 60, spring, 120.00, 2021-01-02, 13:30:30,
2021-01-02 13:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="2, 0,
shadow_order_update, F, false, 60, spring, 120.00, 2021-01-02, 13:30:30,
2021-01-02 13:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="3, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="4, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="5, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/postgresql/pro_insert_order_value.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/postgresql/pro_insert_order_value.xml
new file mode 100644
index 00000000000..8ecdc1854a1
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/postgresql/pro_insert_order_value.xml
@@ -0,0 +1,38 @@
+<!--
+ ~ 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 update-count="1">
+ <metadata data-nodes="write_db.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db.t_shadow" values="1, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0 " />
+ <row data-node="write_db.t_shadow" values="2, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="3, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="4, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="5, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="6, 1, pro_order, S, true, 50,
summer, 120.00, 2021-01-01, 12:30:30, 2021-01-01 12:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/postgresql/pro_update_order_by_user_id.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/postgresql/pro_update_order_by_user_id.xml
new file mode 100644
index 00000000000..9fc34c6c96b
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/postgresql/pro_update_order_by_user_id.xml
@@ -0,0 +1,37 @@
+<!--
+ ~ 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 update-count="2">
+ <metadata data-nodes="write_db.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db.t_shadow" values="1, 1, pro_order_update, F,
false, 60, spring, 120.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="2, 1, pro_order_update, F,
false, 60, spring, 120.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="3, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="4, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="5, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/postgresql/shadow_insert_order_value.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/postgresql/shadow_insert_order_value.xml
new file mode 100644
index 00000000000..eebac0b2d7e
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/postgresql/shadow_insert_order_value.xml
@@ -0,0 +1,38 @@
+<!--
+ ~ 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 update-count="1">
+ <metadata data-nodes="write_db_shadow.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db_shadow.t_shadow" values="1, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="2, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="3, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="4, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="5, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="6, 0, shadow_order, S,
true, 50, summer, 120.00, 2021-01-01, 12:30:30, 2021-01-01 12:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/postgresql/shadow_update_order_by_user_id.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/postgresql/shadow_update_order_by_user_id.xml
new file mode 100644
index 00000000000..5ba7c4c8be9
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/postgresql/shadow_update_order_by_user_id.xml
@@ -0,0 +1,37 @@
+<!--
+ ~ 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 update-count="2">
+ <metadata data-nodes="write_db_shadow.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db_shadow.t_shadow" values="1, 0,
shadow_order_update, F, false, 60, spring, 120.00, 2017-08-08, 18:30:30,
2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="2, 0,
shadow_order_update, F, false, 60, spring, 120.00, 2017-08-08, 18:30:30,
2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="3, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="4, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="5, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/pro_delete_order_by_user_id.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/pro_delete_order_by_user_id.xml
new file mode 100644
index 00000000000..3db7e7afdc6
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/pro_delete_order_by_user_id.xml
@@ -0,0 +1,35 @@
+<!--
+ ~ 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 update-count="2">
+ <metadata data-nodes="write_db.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db.t_shadow" values="1, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="2, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="3, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/shadow_delete_order_by_user_id.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/shadow_delete_order_by_user_id.xml
new file mode 100644
index 00000000000..4b0cfcea928
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/readwrite_splitting_and_shadow/shadow_delete_order_by_user_id.xml
@@ -0,0 +1,35 @@
+<!--
+ ~ 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 update-count="2">
+ <metadata data-nodes="write_db_shadow.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db_shadow.t_shadow" values="1, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="2, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="3, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
index 6eef1391eea..717d2ea818f 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
@@ -210,79 +210,79 @@
<!--</test-case>-->
<test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name,
type_char, type_boolean, type_smallint, type_enum, type_decimal, type_date,
type_time, type_timestamp)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
db-types="MySQL" scenario-types="shadow,encrypt_shadow">
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
db-types="MySQL"
scenario-types="shadow,encrypt_shadow,readwrite_splitting_and_shadow">
<assertion parameters="6:long, 1:int, pro_order:String, S:char,
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date,
12:30:30:time, 2021-01-01 12:30:30:timestamp"
expected-data-file="pro_insert_order_value.xml" />
</test-case>
<test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name,
type_char, type_boolean, type_smallint, type_enum, type_decimal, type_date,
type_time, type_timestamp)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
db-types="MySQL" scenario-types="shadow,encrypt_shadow">
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
db-types="MySQL"
scenario-types="shadow,encrypt_shadow,readwrite_splitting_and_shadow">
<assertion parameters="6:long, 0:int, shadow_order:String, S:char,
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date,
12:30:30:time, 2021-01-01 12:30:30:timestamp"
expected-data-file="shadow_insert_order_value.xml" />
</test-case>
<test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name,
type_char, type_boolean, type_smallint, type_enum, type_decimal, type_date,
type_time, type_timestamp)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?);" db-types="MySQL" scenario-types="shadow,encrypt_shadow">
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?);" db-types="MySQL"
scenario-types="shadow,encrypt_shadow,readwrite_splitting_and_shadow">
<assertion parameters="7:long, 1:int, pro_order:String, S:char,
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date,
12:30:30:time, 2021-01-01 12:30:30:timestamp, 8:long, 1:int, pro_order:String,
S:char, true:boolean, 50:smallint, summer:enum#season, 100.00:decimal,
2021-01-01:Date, 12:30:30:time, 2021-01-01 12:30:30:timestamp"
expected-data-file="pro_insert_order_batch_value.xml" />
</test-case>
<test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name,
type_char, type_boolean, type_smallint, type_enum, type_decimal, type_date,
type_time, type_timestamp)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?);" db-types="MySQL" scenario-types="shadow,encrypt_shadow">
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?);" db-types="MySQL"
scenario-types="shadow,encrypt_shadow,readwrite_splitting_and_shadow">
<assertion parameters="7:long, 0:int, shadow_order:String, S:char,
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date,
12:30:30:time, 2021-01-01 12:30:30:timestamp, 8:long, 0:int,
shadow_order:String, S:char, true:boolean, 50:smallint, summer:enum#season,
100.00:decimal, 2021-01-01:Date, 12:30:30:time, 2021-01-01 12:30:30:timestamp"
expected-data-file="shadow_insert_order_batch_value.xml" />
</test-case>
<test-case sql="UPDATE t_shadow SET order_name = ?, type_char = ?,
type_boolean = ?, type_smallint = ?, type_enum = ?, type_decimal = ?, type_date
= ?, type_time = ?, type_timestamp = ?
- WHERE user_id = ? and order_id in (?, ?)" db-types="MySQL"
scenario-types="shadow,encrypt_shadow">
+ WHERE user_id = ? and order_id in (?, ?)" db-types="MySQL"
scenario-types="shadow,encrypt_shadow,readwrite_splitting_and_shadow">
<assertion parameters="pro_order_update:String, F:char, false:boolean,
60:smallint, spring:enum#season, 120.00:decimal, 2021-01-02:Date,
13:30:30:time, 2021-01-02 13:30:30:timestamp, 1:int, 1:long, 2:long"
expected-data-file="pro_update_order_by_user_id.xml" />
</test-case>
<test-case sql="UPDATE t_shadow SET order_name = ?, type_char = ?,
type_boolean = ?, type_smallint = ?, type_enum = ?, type_decimal = ?, type_date
= ?, type_time = ?, type_timestamp = ?
- WHERE user_id = ? and order_id in (?, ?)" db-types="MySQL"
scenario-types="shadow,encrypt_shadow">
+ WHERE user_id = ? and order_id in (?, ?)" db-types="MySQL"
scenario-types="shadow,encrypt_shadow,readwrite_splitting_and_shadow">
<assertion parameters="shadow_order_update:String, F:char,
false:boolean, 60:smallint, spring:enum#season, 120.00:decimal,
2021-01-02:Date, 13:30:30:time, 2021-01-02 13:30:30:timestamp, 0:int, 1:long,
2:long"
expected-data-file="shadow_update_order_by_user_id.xml" />
</test-case>
- <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?,
?)" db-types="MySQL" scenario-types="shadow,encrypt_shadow">
+ <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?,
?)" db-types="MySQL"
scenario-types="shadow,encrypt_shadow,readwrite_splitting_and_shadow">
<assertion parameters="1:int, 4:long, 5:long"
expected-data-file="pro_delete_order_by_user_id.xml" />
</test-case>
- <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?,
?)" db-types="MySQL" scenario-types="shadow,encrypt_shadow">
+ <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?,
?)" db-types="MySQL"
scenario-types="shadow,encrypt_shadow,readwrite_splitting_and_shadow">
<assertion parameters="0:int, 4:long, 5:long"
expected-data-file="shadow_delete_order_by_user_id.xml" />
</test-case>
<!-- FIXME Support enum types for PostgreSQL -->
<test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name,
type_char, type_boolean, type_smallint, type_decimal, type_date, type_time,
type_timestamp)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
db-types="PostgreSQL" scenario-types="shadow,encrypt_shadow">
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
db-types="PostgreSQL"
scenario-types="shadow,encrypt_shadow,readwrite_splitting_and_shadow">
<assertion parameters="6:long, 1:int, pro_order:String, S:char,
true:boolean, 50:smallint, 120.00:decimal, 2021-01-01:Date, 12:30:30:time,
2021-01-01 12:30:30:timestamp"
expected-data-file="pro_insert_order_value.xml" />
</test-case>
<test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name,
type_char, type_boolean, type_smallint, type_decimal, type_date, type_time,
type_timestamp)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
db-types="PostgreSQL" scenario-types="shadow,encrypt_shadow">
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
db-types="PostgreSQL"
scenario-types="shadow,encrypt_shadow,readwrite_splitting_and_shadow">
<assertion parameters="6:long, 0:int, shadow_order:String, S:char,
true:boolean, 50:smallint, 120.00:decimal, 2021-01-01:Date, 12:30:30:time,
2021-01-01 12:30:30:timestamp"
expected-data-file="shadow_insert_order_value.xml" />
</test-case>
<test-case sql="UPDATE t_shadow SET order_name = ?, type_char = ?,
type_boolean = ?, type_smallint = ?, type_decimal = ?, type_enum = CAST(? AS
season)
- WHERE user_id = ? and order_id in (?, ?)"
db-types="PostgreSQL" scenario-types="shadow">
+ WHERE user_id = ? and order_id in (?, ?)"
db-types="PostgreSQL" scenario-types="shadow,readwrite_splitting_and_shadow">
<assertion parameters="pro_order_update:String, F:char, false:boolean,
60:smallint, 120.00:decimal, spring:enum#season, 1:int, 1:long, 2:long"
expected-data-file="pro_update_order_by_user_id.xml" />
</test-case>
<test-case sql="UPDATE t_shadow SET order_name = ?, type_char = ?,
type_boolean = ?, type_smallint = ?, type_decimal = ?, type_enum = CAST(? AS
season)
- WHERE user_id = ? and order_id in (?, ?)"
db-types="PostgreSQL" scenario-types="shadow">
+ WHERE user_id = ? and order_id in (?, ?)"
db-types="PostgreSQL" scenario-types="shadow,readwrite_splitting_and_shadow">
<assertion parameters="shadow_order_update:String, F:char,
false:boolean, 60:smallint, 120.00:decimal, spring:enum#season, 0:int, 1:long,
2:long"
expected-data-file="shadow_update_order_by_user_id.xml" />
</test-case>
- <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?,
?)" db-types="PostgreSQL" scenario-types="shadow,encrypt_shadow">
+ <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?,
?)" db-types="PostgreSQL"
scenario-types="shadow,encrypt_shadow,readwrite_splitting_and_shadow">
<assertion parameters="1:int, 4:long, 5:long"
expected-data-file="pro_delete_order_by_user_id.xml" />
</test-case>
- <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?,
?)" db-types="PostgreSQL" scenario-types="shadow,encrypt_shadow">
+ <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?,
?)" db-types="PostgreSQL"
scenario-types="shadow,encrypt_shadow,readwrite_splitting_and_shadow">
<assertion parameters="0:int, 4:long, 5:long"
expected-data-file="shadow_delete_order_by_user_id.xml" />
</test-case>
</integration-test-cases>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
index f0146bb444d..49a624b6607 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
@@ -633,4 +633,8 @@
<assertion parameters="1:int" expected-data-source-name="prod_dataset"
/>
<assertion parameters="0:int"
expected-data-source-name="encrypt_shadow_dataset" />
</test-case>
+
+ <test-case sql="SELECT order_id, user_id, order_name, type_char,
type_boolean, type_smallint, type_enum, type_decimal, type_date, type_time,
type_timestamp FROM t_shadow WHERE user_id = ?" db-types="MySQL,PostgreSQL"
scenario-types="readwrite_splitting_and_shadow">
+ <assertion parameters="1:int" expected-data-source-name="read_dataset"
/>
+ </test-case>
</integration-test-cases>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/it-env.properties
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/it-env.properties
index a35b30b5c0b..59d76f92faa 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/it-env.properties
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/it-env.properties
@@ -19,8 +19,8 @@
it.run.modes=
it.run.additional.cases=false
-#it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow
-it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow
+#it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,readwrite_splitting_and_shadow
+it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,readwrite_splitting_and_shadow
# it.cluster.env.type=DOCKER,NATIVE
it.cluster.env.type=DOCKER
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/authority.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/authority.xml
new file mode 100644
index 00000000000..9716123ad15
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/authority.xml
@@ -0,0 +1,71 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<authority>
+ <sqlset db-types="Oracle,SQLServer,PostgreSQL">
+ <user-create>
+ <sql>CREATE USER default_user</sql>
+ <sql>CREATE ROLE default_role</sql>
+ <sql>CREATE ROLE role2</sql>
+ <sql>CREATE ROLE role3</sql>
+ <sql>CREATE ROLE role4</sql>
+ </user-create>
+ <user-drop>
+ <sql>DROP ROLE IF EXISTS default_role</sql>
+ <sql>DROP ROLE IF EXISTS role_dev</sql>
+ <sql>DROP ROLE IF EXISTS role_dev_new</sql>
+ <sql>DROP ROLE IF EXISTS role2</sql>
+ <sql>DROP ROLE IF EXISTS role3</sql>
+ <sql>DROP ROLE IF EXISTS role4</sql>
+ <sql>DROP USER IF EXISTS user_dev</sql>
+ <sql>DROP USER IF EXISTS user_dev_new</sql>
+ <sql>DROP USER IF EXISTS default_user</sql>
+ </user-drop>
+ </sqlset>
+ <sqlset db-types="SQLServer">
+ <user-create>
+ <sql>CREATE LOGIN login_dev</sql>
+ <sql>CREATE USER user_dev FOR LOGIN login_dev</sql>
+ </user-create>
+ <user-drop>
+ <sql>DROP LOGIN IF EXISTS login_dev</sql>
+ <sql>DROP LOGIN IF EXISTS login_dev_new</sql>
+ </user-drop>
+ </sqlset>
+ <sqlset db-types="MySQL">
+ <user-create>
+ <sql>CREATE ROLE default_role</sql>
+ <sql>CREATE USER user_dev@localhost</sql>
+ <sql>GRANT select,update,insert,delete on write_db.* to
user_dev@localhost</sql>
+ <sql>GRANT select,update,insert,delete on write_db_shadow.* to
user_dev@localhost</sql>
+ </user-create>
+ <user-drop>
+ <sql>DROP USER IF EXISTS user_dev@localhost</sql>
+ <sql>DROP USER IF EXISTS user_dev_new@localhost</sql>
+ <sql>DROP USER IF EXISTS [email protected]</sql>
+ <sql>DROP ROLE IF EXISTS default_role</sql>
+ <sql>DROP ROLE IF EXISTS role_dev</sql>
+ <sql>DROP ROLE IF EXISTS role_dev_new</sql>
+ <sql>FLUSH PRIVILEGES</sql>
+ </user-drop>
+ </sqlset>
+ <sqlset db-types="Oracle">
+ <user-create>
+ <sql>CREATE USER user_dev identified by passwd_dev</sql>
+ </user-create>
+ </sqlset>
+</authority>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/databases.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/databases.xml
new file mode 100644
index 00000000000..a0216ede335
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/databases.xml
@@ -0,0 +1,24 @@
+<?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_db</database>
+ <database>write_db_shadow</database>
+ <database>read_0</database>
+ <database>read_1</database>
+</databases>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/dataset.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/dataset.xml
new file mode 100644
index 00000000000..752d0c9adab
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/dataset.xml
@@ -0,0 +1,53 @@
+<!--
+ ~ 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>
+ <metadata
data-nodes="write_db.t_shadow,write_db_shadow.t_shadow,read_0.t_shadow,read_1.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_db.t_shadow" values="1, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="2, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="3, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="4, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db.t_shadow" values="5, 1, pro_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="1, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="2, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="3, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="4, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_db_shadow.t_shadow" values="5, 0, shadow_order, S,
true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_0.t_shadow" values="1, 1, read_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_0.t_shadow" values="2, 1, read_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_0.t_shadow" values="3, 1, read_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_0.t_shadow" values="4, 1, read_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_0.t_shadow" values="5, 1, read_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_1.t_shadow" values="1, 1, read_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_1.t_shadow" values="2, 1, read_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_1.t_shadow" values="3, 1, read_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_1.t_shadow" values="4, 1, read_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_1.t_shadow" values="5, 1, read_order, S, true, 5,
summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/h2/01-actual-init.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/h2/01-actual-init.sql
new file mode 100644
index 00000000000..0ccb7fa42e9
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/h2/01-actual-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 TABLE IF EXISTS t_shadow;
+
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/mysql/01-actual-init.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/mysql/01-actual-init.sql
new file mode 100644
index 00000000000..1af8cf7343e
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/mysql/01-actual-init.sql
@@ -0,0 +1,39 @@
+--
+-- 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_db;
+CREATE DATABASE write_db;
+
+CREATE TABLE write_db.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT
NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
+
+DROP DATABASE IF EXISTS write_db_shadow;
+CREATE DATABASE write_db_shadow;
+
+CREATE TABLE write_db_shadow.t_shadow (order_id BIGINT NOT NULL, user_id INT
NOT NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL,
type_boolean BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum
ENUM('spring', 'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT
NULL, type_date DATE NOT NULL, type_time TIME NOT NULL, type_timestamp
TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
+
+DROP DATABASE IF EXISTS read_0;
+CREATE DATABASE read_0;
+
+CREATE TABLE read_0.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
+
+DROP DATABASE IF EXISTS read_1;
+CREATE DATABASE read_1;
+
+CREATE TABLE read_1.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/oracle/01-actual-init.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/oracle/01-actual-init.sql
new file mode 100644
index 00000000000..f8a3b91d849
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/oracle/01-actual-init.sql
@@ -0,0 +1,36 @@
+--
+-- 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 SCHEMA write_db;
+CREATE SCHEMA write_db;
+
+CREATE TABLE write_db.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT
NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
+
+DROP SCHEMA write_db_shadow;
+CREATE SCHEMA write_db_shadow;
+
+CREATE TABLE write_db_shadow.t_shadow (order_id BIGINT NOT NULL, user_id INT
NOT NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL,
type_boolean BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum
ENUM('spring', 'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT
NULL, type_date DATE NOT NULL, type_time TIME NOT NULL, type_timestamp
TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
+
+DROP SCHEMA read_0;
+CREATE SCHEMA read_0;
+
+CREATE TABLE read_0.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
+
+DROP SCHEMA read_1;
+CREATE SCHEMA read_1;
+
+CREATE TABLE read_1.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/postgresql/01-actual-init.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/postgresql/01-actual-init.sql
new file mode 100644
index 00000000000..12eb096297f
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/postgresql/01-actual-init.sql
@@ -0,0 +1,58 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+CREATE DATABASE write_db;
+CREATE DATABASE write_db_shadow;
+CREATE DATABASE read_0;
+CREATE DATABASE read_1;
+
+GRANT ALL PRIVILEGES ON DATABASE write_db TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE write_db_shadow TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE read_0 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE read_1 TO test_user;
+
+\c write_db
+
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TYPE season AS ENUM ('spring', 'summer', 'autumn', 'winter');
+
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum season DEFAULT
'summer', type_decimal NUMERIC(18,2) DEFAULT NULL, type_date DATE DEFAULT NULL,
type_time TIME DEFAULT NULL, type_timestamp TIMESTAMP DEFAULT NULL, PRIMARY KEY
(order_id));
+
+\c write_db_shadow
+
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TYPE season AS ENUM ('spring', 'summer', 'autumn', 'winter');
+
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum season DEFAULT
'summer', type_decimal NUMERIC(18,2) DEFAULT NULL, type_date DATE DEFAULT NULL,
type_time TIME DEFAULT NULL, type_timestamp TIMESTAMP DEFAULT NULL, PRIMARY KEY
(order_id));
+
+\c read_0
+
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TYPE season AS ENUM ('spring', 'summer', 'autumn', 'winter');
+
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum season DEFAULT
'summer', type_decimal NUMERIC(18,2) DEFAULT NULL, type_date DATE DEFAULT NULL,
type_time TIME DEFAULT NULL, type_timestamp TIMESTAMP DEFAULT NULL, PRIMARY KEY
(order_id));
+
+\c read_1
+
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TYPE season AS ENUM ('spring', 'summer', 'autumn', 'winter');
+
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum season DEFAULT
'summer', type_decimal NUMERIC(18,2) DEFAULT NULL, type_date DATE DEFAULT NULL,
type_time TIME DEFAULT NULL, type_timestamp TIMESTAMP DEFAULT NULL, PRIMARY KEY
(order_id));
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/sqlserver/01-actual-init.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/sqlserver/01-actual-init.sql
new file mode 100644
index 00000000000..cb9340856b2
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/actual/init-sql/sqlserver/01-actual-init.sql
@@ -0,0 +1,38 @@
+--
+-- 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_db;
+CREATE DATABASE write_db;
+
+CREATE TABLE write_db.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT
NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
+
+
+DROP DATABASE IF EXISTS write_db_shadow;
+CREATE DATABASE write_db_shadow;
+
+CREATE TABLE write_db_shadow.t_shadow (order_id BIGINT NOT NULL, user_id INT
NOT NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL,
type_boolean BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum
ENUM('spring', 'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT
NULL, type_date DATE NOT NULL, type_time TIME NOT NULL, type_timestamp
TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
+
+DROP DATABASE IF EXISTS read_0;
+CREATE DATABASE read_0;
+
+CREATE TABLE read_0.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
+
+
+DROP DATABASE IF EXISTS read_1;
+CREATE DATABASE read_1;
+
+CREATE TABLE read_1.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/databases.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/databases.xml
new file mode 100644
index 00000000000..05456ffa441
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/databases.xml
@@ -0,0 +1,23 @@
+<?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_dataset</database>
+ <database>write_shadow_dataset</database>
+ <database>read_dataset</database>
+</databases>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/dataset.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/dataset.xml
new file mode 100644
index 00000000000..517d8392977
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/dataset.xml
@@ -0,0 +1,47 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<dataset>
+ <metadata
data-nodes="write_dataset.t_shadow,write_shadow_dataset.t_shadow,read_dataset.t_shadow">
+ <column name="order_id" type="long" />
+ <column name="user_id" type="int" />
+ <column name="order_name" type="varchar" />
+ <column name="type_char" type="char" />
+ <column name="type_boolean" type="boolean" />
+ <column name="type_smallint" type="smallint" />
+ <column name="type_enum" type="enum#season" />
+ <column name="type_decimal" type="decimal" />
+ <column name="type_date" type="Date" />
+ <column name="type_time" type="time" />
+ <column name="type_timestamp" type="timestamp" />
+ </metadata>
+ <row data-node="write_dataset.t_shadow" values="1, 1, pro_order, S, true,
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_dataset.t_shadow" values="2, 1, pro_order, S, true,
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_dataset.t_shadow" values="3, 1, pro_order, S, true,
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_dataset.t_shadow" values="4, 1, pro_order, S, true,
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_dataset.t_shadow" values="5, 1, pro_order, S, true,
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_shadow_dataset.t_shadow" values="1, 0, shadow_order,
S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_shadow_dataset.t_shadow" values="2, 0, shadow_order,
S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_shadow_dataset.t_shadow" values="3, 0, shadow_order,
S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_shadow_dataset.t_shadow" values="4, 0, shadow_order,
S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="write_shadow_dataset.t_shadow" values="5, 0, shadow_order,
S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_dataset.t_shadow" values="1, 1, read_order, S, true,
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_dataset.t_shadow" values="2, 1, read_order, S, true,
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_dataset.t_shadow" values="3, 1, read_order, S, true,
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_dataset.t_shadow" values="4, 1, read_order, S, true,
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+ <row data-node="read_dataset.t_shadow" values="5, 1, read_order, S, true,
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+</dataset>
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/h2/01-expected-init.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/h2/01-expected-init.sql
new file mode 100644
index 00000000000..5ea66a331fc
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/h2/01-expected-init.sql
@@ -0,0 +1,20 @@
+--
+-- 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 TABLE IF EXISTS t_shadow;
+
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/mysql/expected-init.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/mysql/expected-init.sql
new file mode 100644
index 00000000000..a09b3eaebf1
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/mysql/expected-init.sql
@@ -0,0 +1,36 @@
+--
+-- 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_dataset;
+CREATE DATABASE write_dataset;
+
+CREATE TABLE write_dataset.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT
NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
+
+
+DROP DATABASE IF EXISTS write_shadow_dataset;
+CREATE DATABASE write_shadow_dataset;
+
+CREATE TABLE write_shadow_dataset.t_shadow (order_id BIGINT NOT NULL, user_id
INT NOT NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL,
type_boolean BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum
ENUM('spring', 'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT
NULL, type_date DATE NOT NULL, type_time TIME NOT NULL, type_timestamp
TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
+
+DROP DATABASE IF EXISTS read_dataset;
+CREATE DATABASE read_dataset;
+
+CREATE TABLE read_dataset.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT
NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/oracle/expected-init.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/oracle/expected-init.sql
new file mode 100644
index 00000000000..325190395a2
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/oracle/expected-init.sql
@@ -0,0 +1,32 @@
+--
+-- 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 SCHEMA write_dataset;
+CREATE SCHEMA write_dataset;
+
+CREATE TABLE write_dataset.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT
NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
+
+
+DROP SCHEMA write_shadow_dataset;
+CREATE SCHEMA write_shadow_dataset;
+
+CREATE TABLE write_shadow_dataset.t_shadow (order_id BIGINT NOT NULL, user_id
INT NOT NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL,
type_boolean BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum
ENUM('spring', 'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT
NULL, type_date DATE NOT NULL, type_time TIME NOT NULL, type_timestamp
TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
+
+DROP SCHEMA read_dataset;
+CREATE SCHEMA read_dataset;
+
+CREATE TABLE read_dataset.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT
NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/postgresql/expected-init.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/postgresql/expected-init.sql
new file mode 100644
index 00000000000..c2fcb46241a
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/postgresql/expected-init.sql
@@ -0,0 +1,53 @@
+--
+-- 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_dataset;
+CREATE DATABASE write_dataset;
+
+GRANT ALL PRIVILEGES ON DATABASE write_dataset TO test_user;
+
+\c write_dataset;
+
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TYPE season AS ENUM ('spring', 'summer', 'autumn', 'winter');
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum season DEFAULT
'summer', type_decimal NUMERIC(18,2) DEFAULT NULL, type_date DATE DEFAULT NULL,
type_time TIME DEFAULT NULL, type_timestamp TIMESTAMP DEFAULT NULL, PRIMARY KEY
(order_id));
+
+
+DROP DATABASE IF EXISTS write_shadow_dataset;
+CREATE DATABASE write_shadow_dataset;
+
+GRANT ALL PRIVILEGES ON DATABASE write_shadow_dataset TO test_user;
+
+\c write_shadow_dataset;
+
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TYPE season AS ENUM ('spring', 'summer', 'autumn', 'winter');
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum season DEFAULT
'summer', type_decimal NUMERIC(18,2) DEFAULT NULL, type_date DATE DEFAULT NULL,
type_time TIME DEFAULT NULL, type_timestamp TIMESTAMP DEFAULT NULL, PRIMARY KEY
(order_id));
+
+DROP DATABASE IF EXISTS read_dataset;
+CREATE DATABASE read_dataset;
+
+GRANT ALL PRIVILEGES ON DATABASE read_dataset TO test_user;
+
+\c read_dataset;
+
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TYPE season AS ENUM ('spring', 'summer', 'autumn', 'winter');
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL,
order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum season DEFAULT
'summer', type_decimal NUMERIC(18,2) DEFAULT NULL, type_date DATE DEFAULT NULL,
type_time TIME DEFAULT NULL, type_timestamp TIMESTAMP DEFAULT NULL, PRIMARY KEY
(order_id));
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/sqlserver/expected-init.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/sqlserver/expected-init.sql
new file mode 100644
index 00000000000..484dba7fefe
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/init-sql/sqlserver/expected-init.sql
@@ -0,0 +1,32 @@
+--
+-- 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_dataset;
+CREATE DATABASE write_dataset;
+
+CREATE TABLE write_dataset.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT
NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
+
+
+DROP DATABASE IF EXISTS write_shadow_dataset;
+CREATE DATABASE write_shadow_dataset;
+
+CREATE TABLE write_shadow_dataset.t_shadow (order_id BIGINT NOT NULL, user_id
INT NOT NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL,
type_boolean BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum
ENUM('spring', 'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT
NULL, type_date DATE NOT NULL, type_time TIME NOT NULL, type_timestamp
TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
+
+DROP DATABASE IF EXISTS read_dataset;
+CREATE DATABASE read_dataset;
+
+CREATE TABLE read_dataset.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT
NULL, order_name VARCHAR(32) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring',
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (order_id));
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/proxy/conf/mysql/config-shadow.yaml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/proxy/conf/mysql/config-shadow.yaml
new file mode 100644
index 00000000000..8b4f43c82ff
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/proxy/conf/mysql/config-shadow.yaml
@@ -0,0 +1,111 @@
+#
+# 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.
+#
+
+databaseName: readwrite_splitting_and_shadow
+
+dataSources:
+ write_db:
+ url:
jdbc:mysql://mysql.readwrite_splitting_and_shadow.host:3306/write_db?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+ username: test_user
+ password: Test@123
+ connectionTimeoutMilliseconds: 30000
+ idleTimeoutMilliseconds: 60000
+ maxLifetimeMilliseconds: 1800000
+ maxPoolSize: 2
+ minPoolSize: 2
+ write_db_shadow:
+ url:
jdbc:mysql://mysql.readwrite_splitting_and_shadow.host:3306/write_db_shadow?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+ username: test_user
+ password: Test@123
+ connectionTimeoutMilliseconds: 30000
+ idleTimeoutMilliseconds: 60000
+ maxLifetimeMilliseconds: 1800000
+ maxPoolSize: 2
+ minPoolSize: 2
+ read_0:
+ url:
jdbc:mysql://mysql.readwrite_splitting_and_shadow.host:3306/read_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_1:
+ url:
jdbc:mysql://mysql.readwrite_splitting_and_shadow.host:3306/read_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:
+ write-read-ds:
+ staticStrategy:
+ writeDataSourceName: shadowDataSource
+ readDataSourceNames:
+ - read_0
+ - read_1
+
+- !SHADOW
+ dataSources:
+ shadowDataSource:
+ productionDataSourceName: write_db
+ shadowDataSourceName: write_db_shadow
+ tables:
+ t_shadow:
+ dataSourceNames:
+ - shadowDataSource
+ shadowAlgorithmNames:
+ - user-id-insert-match-algorithm
+ - user-id-update-match-algorithm
+ - user-id-delete-match-algorithm
+ - user-id-select-match-algorithm
+ - simple-hint-algorithm
+ shadowAlgorithms:
+ user-id-insert-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: insert
+ column: user_id
+ value: 0
+ user-id-update-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: update
+ column: user_id
+ value: 0
+ user-id-delete-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: delete
+ column: user_id
+ value: 0
+ user-id-select-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: select
+ column: user_id
+ value: 0
+ simple-hint-algorithm:
+ type: SIMPLE_HINT
+ props:
+ foo: bar
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/proxy/conf/postgresql/config-shadow.yaml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/proxy/conf/postgresql/config-shadow.yaml
new file mode 100644
index 00000000000..d3ce62374a8
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/proxy/conf/postgresql/config-shadow.yaml
@@ -0,0 +1,111 @@
+#
+# 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.
+#
+
+databaseName: readwrite_splitting_and_shadow
+
+dataSources:
+ write_db:
+ url:
jdbc:postgresql://postgresql.readwrite_splitting_and_shadow.host:5432/write_db
+ username: test_user
+ password: Test@123
+ connectionTimeoutMilliseconds: 30000
+ idleTimeoutMilliseconds: 60000
+ maxLifetimeMilliseconds: 1800000
+ maxPoolSize: 2
+ minPoolSize: 2
+ write_db_shadow:
+ url:
jdbc:postgresql://postgresql.readwrite_splitting_and_shadow.host:5432/write_db_shadow
+ username: test_user
+ password: Test@123
+ connectionTimeoutMilliseconds: 30000
+ idleTimeoutMilliseconds: 60000
+ maxLifetimeMilliseconds: 1800000
+ maxPoolSize: 2
+ minPoolSize: 2
+ read_0:
+ url:
jdbc:postgresql://postgresql.readwrite_splitting_and_shadow.host:5432/read_0
+ username: test_user
+ password: Test@123
+ connectionTimeoutMilliseconds: 30000
+ idleTimeoutMilliseconds: 60000
+ maxLifetimeMilliseconds: 1800000
+ maxPoolSize: 2
+ minPoolSize: 2
+ read_1:
+ url:
jdbc:postgresql://postgresql.readwrite_splitting_and_shadow.host:5432/read_1
+ username: test_user
+ password: Test@123
+ connectionTimeoutMilliseconds: 30000
+ idleTimeoutMilliseconds: 60000
+ maxLifetimeMilliseconds: 1800000
+ maxPoolSize: 2
+ minPoolSize: 2
+
+rules:
+ - !READWRITE_SPLITTING
+ dataSources:
+ write-read-ds:
+ staticStrategy:
+ writeDataSourceName: shadowDataSource
+ readDataSourceNames:
+ - read_0
+ - read_1
+
+ - !SHADOW
+ dataSources:
+ shadowDataSource:
+ productionDataSourceName: write_db
+ shadowDataSourceName: write_db_shadow
+ tables:
+ t_shadow:
+ dataSourceNames:
+ - shadowDataSource
+ shadowAlgorithmNames:
+ - user-id-insert-match-algorithm
+ - user-id-update-match-algorithm
+ - user-id-delete-match-algorithm
+ - user-id-select-match-algorithm
+ - simple-hint-algorithm
+ shadowAlgorithms:
+ user-id-insert-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: insert
+ column: user_id
+ value: 0
+ user-id-update-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: update
+ column: user_id
+ value: 0
+ user-id-delete-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: delete
+ column: user_id
+ value: 0
+ user-id-select-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: select
+ column: user_id
+ value: 0
+ simple-hint-algorithm:
+ type: SIMPLE_HINT
+ props:
+ foo: bar
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/rules.yaml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/rules.yaml
new file mode 100644
index 00000000000..142860aba22
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/readwrite_splitting_and_shadow/rules.yaml
@@ -0,0 +1,71 @@
+#
+# 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.
+#
+
+rules:
+ - !READWRITE_SPLITTING
+ dataSources:
+ write-read-ds:
+ staticStrategy:
+ writeDataSourceName: shadowDataSource
+ readDataSourceNames:
+ - read_0
+ - read_1
+
+ - !SHADOW
+ dataSources:
+ shadowDataSource:
+ productionDataSourceName: write_db
+ shadowDataSourceName: write_db_shadow
+ tables:
+ t_shadow:
+ dataSourceNames:
+ - shadowDataSource
+ shadowAlgorithmNames:
+ - user-id-insert-match-algorithm
+ - user-id-update-match-algorithm
+ - user-id-delete-match-algorithm
+ - user-id-select-match-algorithm
+ - simple-hint-algorithm
+ shadowAlgorithms:
+ user-id-insert-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: insert
+ column: user_id
+ value: 0
+ user-id-update-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: update
+ column: user_id
+ value: 0
+ user-id-delete-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: delete
+ column: user_id
+ value: 0
+ user-id-select-match-algorithm:
+ type: VALUE_MATCH
+ props:
+ operation: select
+ column: user_id
+ value: 0
+ simple-hint-algorithm:
+ type: SIMPLE_HINT
+ props:
+ foo: bar