| 1 |
################################################################################ |
| 2 |
# The aim of this test is to verify that Group Replication does not affect |
| 3 |
# partitioning of tables. |
| 4 |
# |
| 5 |
# 0. Start 3 servers with Group Replication |
| 6 |
# 1. Create two tables with "Hash" partition, "Key" partition. |
| 7 |
# 2. Perform few DMLs on tables and check it is replicated properly on other servers. |
| 8 |
# 3. Clean-up |
| 9 |
################################################################################ |
| 10 |
|
| 11 |
--source include/big_test.inc |
| 12 |
--source include/have_group_replication_plugin.inc |
| 13 |
|
| 14 |
--let $rpl_server_count= 3 |
| 15 |
--source include/group_replication.inc |
| 16 |
|
| 17 |
--let $rpl_connection_name= server1 |
| 18 |
--source include/rpl_connection.inc |
| 19 |
|
| 20 |
--echo ## Create table with HASH Partition ## |
| 21 |
CREATE TABLE t1 ( c1 int PRIMARY KEY ) |
| 22 |
CHARSET=utf8mb4 |
| 23 |
PARTITION BY HASH(c1) |
| 24 |
PARTITIONS 3; |
| 25 |
|
| 26 |
--echo ## Create table with KEY Partition ## |
| 27 |
CREATE TABLE t2 ( c1 int PRIMARY KEY ) |
| 28 |
CHARSET=utf8mb4 |
| 29 |
PARTITION BY KEY() |
| 30 |
PARTITIONS 3; |
| 31 |
--source include/rpl_sync.inc |
| 32 |
|
| 33 |
--let $rpl_connection_name= server2 |
| 34 |
--source include/rpl_connection.inc |
| 35 |
SHOW CREATE TABLE t1; |
| 36 |
|
| 37 |
# Insert some values into t1 |
| 38 |
INSERT INTO t1 values (1),(5),(11),(18),(20),(100),(33); |
| 39 |
|
| 40 |
SHOW CREATE TABLE t2; |
| 41 |
# Insert some values into t2 |
| 42 |
INSERT INTO t2 values (1),(5),(11),(18),(20),(100); |
| 43 |
|
| 44 |
--source include/rpl_sync.inc |
| 45 |
|
| 46 |
--let $rpl_connection_name= server1 |
| 47 |
--source include/rpl_connection.inc |
| 48 |
|
| 49 |
# Perform some DMLs |
| 50 |
INSERT INTO t1 VALUES (15); |
| 51 |
|
| 52 |
DELETE FROM t1 WHERE c1= 5; |
| 53 |
|
| 54 |
DELETE FROM t2 WHERE c1= 100; |
| 55 |
|
| 56 |
--let $num_rec_t1p0= `SELECT COUNT(*) FROM t1 PARTITION (p0)` |
| 57 |
--let $num_rec_t1p1= `SELECT COUNT(*) FROM t1 PARTITION (p1)` |
| 58 |
--let $num_rec_t1p2= `SELECT COUNT(*) FROM t1 PARTITION (p2)` |
| 59 |
|
| 60 |
--let $num_rec_t2p0= `SELECT COUNT(*) FROM t2 PARTITION (p0)` |
| 61 |
--let $num_rec_t2p1= `SELECT COUNT(*) FROM t2 PARTITION (p1)` |
| 62 |
--let $num_rec_t2p2= `SELECT COUNT(*) FROM t2 PARTITION (p2)` |
| 63 |
|
| 64 |
--source include/rpl_sync.inc |
| 65 |
|
| 66 |
--let $rpl_connection_name= server3 |
| 67 |
--source include/rpl_connection.inc |
| 68 |
|
| 69 |
# Validate Record counts |
| 70 |
--let $assert_text= 'Check that partition p0 on table t1 has $num_rec_t1p0 row(s)' |
| 71 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 PARTITION (p0), count, 1]= "$num_rec_t1p0" |
| 72 |
--source include/assert.inc |
| 73 |
|
| 74 |
--let $assert_text= 'Check that partition p1 on table t1 has $num_rec_t1p1 row(s)' |
| 75 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 PARTITION (p1), count, 1]= "$num_rec_t1p1" |
| 76 |
--source include/assert.inc |
| 77 |
|
| 78 |
--let $assert_text= 'Check that partition p2 on table t1 has $num_rec_t1p2 row(s)' |
| 79 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 PARTITION (p2), count, 1]= "$num_rec_t1p2" |
| 80 |
--source include/assert.inc |
| 81 |
|
| 82 |
--let $assert_text= 'Check that partition p0 on table t2 has $num_rec_t2p0 row(s)' |
| 83 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 PARTITION (p0), count, 1]= "$num_rec_t2p0" |
| 84 |
--source include/assert.inc |
| 85 |
|
| 86 |
--let $assert_text= 'Check that partition p1 on table t2 has $num_rec_t2p1 row(s)' |
| 87 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 PARTITION (p1), count, 1]= "$num_rec_t2p1" |
| 88 |
--source include/assert.inc |
| 89 |
|
| 90 |
--let $assert_text= 'Check that partition p2 on table t2 has $num_rec_t2p2 row(s)' |
| 91 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 PARTITION (p2), count, 1]= "$num_rec_t2p2" |
| 92 |
--source include/assert.inc |
| 93 |
|
| 94 |
# Clean-up |
| 95 |
DROP TABLE t1; |
| 96 |
DROP TABLE t2; |
| 97 |
--source include/rpl_sync.inc |
| 98 |
|
| 99 |
--source include/group_replication_end.inc |