← Back
Editing: gr_list_partition_tables.test
################################################################################ # The aim of this test is to verify that Group Replication does not affect # partitioning of tables. # # 0. Start 3 servers with Group Replication # 1. Create a table with "list" partition. # 2. Perform few DMLs on the table and check it is replicated properly on other servers. # 3. Clean-up ################################################################################ --source ../inc/have_group_replication_plugin.inc --source include/have_partition.inc --let $rpl_server_count= 3 --source ../inc/group_replication.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc --echo ## List Partitioning ## CREATE TABLE t1 (id int PRIMARY KEY, c2 int) PARTITION BY LIST (id) (PARTITION p1 VALUES in (5, 10, 15), PARTITION p2 VALUES in (2, 3), PARTITION p3 VALUES in (11, 21)); --source include/rpl_sync.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc SHOW CREATE TABLE t1; # Insert some values into table # This record should belong to partition p1 INSERT INTO t1 VALUES (05, 2); # This record should belong to partition p1 INSERT INTO t1 VALUES (10, 5); # This record should belong to partition p2 INSERT INTO t1 VALUES (03, 1); # This should throw an error as the value is not defined in any partition of t2 --error ER_NO_PARTITION_FOR_GIVEN_VALUE INSERT INTO t1 VALUES (100, 50); --source include/rpl_sync.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc # Perform some DMLs # This record should belong to partition p3 INSERT INTO t1 VALUES (11, 5); # This record should belong to partition p3 INSERT INTO t1 VALUES (21, 10); DELETE FROM t1 WHERE id= 5; --source include/rpl_sync.inc --let $rpl_connection_name= server3 --source include/rpl_connection.inc # Validate record counts # Assert that partition p1 has 1 row. --let $assert_text= 'Check that partition p1 on table t1 has 1 row' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 PARTITION (p1), count, 1]= 1 --source include/assert.inc # Assert that partition p2 has 1 row. --let $assert_text= 'Check that partition p2 on table t1 has 1 row' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 PARTITION (p2), count, 1]= 1 --source include/assert.inc # Assert that partition p3 has 2 rows. --let $assert_text= 'Check that partition p3 on table t1 has 2 rows' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 PARTITION (p3), count, 1]= 2 --source include/assert.inc # Clean-up DROP TABLE t1; --source include/rpl_sync.inc --source ../inc/group_replication_end.inc
Save File
Cancel