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