Debian Codegraph @

mysql-test/suite/rpl/t/rpl_alter_convert_partition.test

raw
1 #
2 # This test ensures that ALTER TABLE ... CONVERT PARTITION ... TO TABLE
3 # works with replication. I.e., the partitioning is done correctly, and
4 # after partitioning, both tables can be updated correctly.
5 #
6 # References:
7 # MDEV-36906: RBR crashes upon DML after CONVERT PARTITION
8 #
9
10 --source include/have_innodb.inc
11 --source include/have_partition.inc
12 --source include/master-slave.inc
13
14
15 --echo #
16 --echo # Ensure initial CREATE TABLE with partitioned data is replicated
17 --echo # correctly
18 --connection master
19 create table t (a int, b int, key(a)) engine=innodb partition by range (b) (partition p1 values less than (10), partition pn values less than (maxvalue));
20 insert into t values (1,5),(2,100);
21 --source include/save_master_gtid.inc
22 --connection slave
23 --source include/sync_with_master_gtid.inc
24 --let $diff_tables=master:test.t,slave:test.t
25
26 --source include/diff_tables.inc
27
28 --echo #
29 --echo # Ensure ALTER TABLE .. CONVERT PARTITION .. TO TABLE replicates
30 --echo # correctly
31 --connection master
32 alter table t convert partition p1 to table offspring;
33 --source include/save_master_gtid.inc
34 --connection slave
35 --source include/sync_with_master_gtid.inc
36 --let $diff_tables=master:test.t,slave:test.t
37 --source include/diff_tables.inc
38 --let $diff_tables=master:test.offspring,slave:test.offspring
39 --source include/diff_tables.inc
40
41
42 --echo #
43 --echo # Ensure data can be inserted into existing table after
44 --echo # ALTER TABLE .. CONVERT PARTITION .. TO TABLE
45 --connection master
46 insert into t values (3, 6);
47 --source include/save_master_gtid.inc
48 --connection slave
49 --source include/sync_with_master_gtid.inc
50 --let $diff_tables=master:test.t,slave:test.t
51 --source include/diff_tables.inc
52
53
54 --echo #
55 --echo # Ensure data can be inserted into offspring table after
56 --echo # ALTER TABLE .. CONVERT PARTITION .. TO TABLE
57 --connection master
58 insert into offspring values (4, 101);
59 --source include/save_master_gtid.inc
60 --connection slave
61 --source include/sync_with_master_gtid.inc
62 --let $diff_tables=master:test.offspring,slave:test.offspring
63 --source include/diff_tables.inc
64
65
66 --echo #
67 --echo # Ensure data can be updated in existing table after
68 --echo # ALTER TABLE .. CONVERT PARTITION .. TO TABLE
69 --connection master
70 update t set b=b+1 where a=3;
71 --source include/save_master_gtid.inc
72 --connection slave
73 --source include/sync_with_master_gtid.inc
74 --let $diff_tables=master:test.t,slave:test.t
75 --source include/diff_tables.inc
76
77
78 --echo #
79 --echo # Ensure data can be updated in offspring table after
80 --echo # ALTER TABLE .. CONVERT PARTITION .. TO TABLE
81 --connection master
82 update offspring set b=b+1 where a=4;
83 --source include/save_master_gtid.inc
84 --connection slave
85 --source include/sync_with_master_gtid.inc
86 --let $diff_tables=master:test.offspring,slave:test.offspring
87 --source include/diff_tables.inc
88
89
90 --echo #
91 --echo # Ensure data can be deleted in existing table after
92 --echo # ALTER TABLE .. CONVERT PARTITION .. TO TABLE
93 --connection master
94 delete from t;
95 --source include/save_master_gtid.inc
96 --connection slave
97 --source include/sync_with_master_gtid.inc
98 --let $diff_tables=master:test.t,slave:test.t
99 --source include/diff_tables.inc
100
101
102 --echo #
103 --echo # Ensure data can be deleted in offspring table after
104 --echo # ALTER TABLE .. CONVERT PARTITION .. TO TABLE
105 --connection master
106 delete from offspring;
107 --source include/save_master_gtid.inc
108 --connection slave
109 --source include/sync_with_master_gtid.inc
110 --let $diff_tables=master:test.offspring,slave:test.offspring
111 --source include/diff_tables.inc
112
113
114 --connection master
115 drop table t, offspring;
116 --source include/rpl_end.inc
117 --echo # End of rpl_alter_convert_partition