| 1 |
############################################################ |
| 2 |
# Author: MATZ # |
| 3 |
# Date: 2006-03-22 # |
| 4 |
# Purpose: See if replication of partition tables work # |
| 5 |
# Most of this test is copied from the rpl_xxx2yyy tests, # |
| 6 |
# but here we just test some simple basic replication of # |
| 7 |
# partition tables with same engine (MyISAM) in both ends. # |
| 8 |
############################################################ |
| 9 |
|
| 10 |
--source include/have_binlog_format_row.inc |
| 11 |
--source include/have_partition.inc |
| 12 |
--source include/master-slave.inc |
| 13 |
connection master; |
| 14 |
--disable_warnings |
| 15 |
DROP TABLE IF EXISTS t1; |
| 16 |
|
| 17 |
SET @@BINLOG_FORMAT = ROW; |
| 18 |
|
| 19 |
--echo **** Partition RANGE testing **** |
| 20 |
|
| 21 |
# Create table that is partitioned by range on year i.e. year(t) and |
| 22 |
# replicate basice operations such at insert, update delete between 2 |
| 23 |
# different storage engines Alter table and ensure table is handled |
| 24 |
# Correctly on the slave |
| 25 |
# Note that the storage engine should not be explicit: the default |
| 26 |
# storage engine is used on master and slave. |
| 27 |
|
| 28 |
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), |
| 29 |
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, |
| 30 |
f FLOAT DEFAULT 0, total BIGINT UNSIGNED, |
| 31 |
y YEAR, t DATE) |
| 32 |
PARTITION BY RANGE (YEAR(t)) |
| 33 |
(PARTITION p0 VALUES LESS THAN (1901), |
| 34 |
PARTITION p1 VALUES LESS THAN (1946), |
| 35 |
PARTITION p2 VALUES LESS THAN (1966), |
| 36 |
PARTITION p3 VALUES LESS THAN (1986), |
| 37 |
PARTITION p4 VALUES LESS THAN (2005), |
| 38 |
PARTITION p5 VALUES LESS THAN MAXVALUE); |
| 39 |
|
| 40 |
SHOW CREATE TABLE t1; |
| 41 |
|
| 42 |
sync_slave_with_master; |
| 43 |
SHOW CREATE TABLE t1; |
| 44 |
|
| 45 |
--source include/rpl_multi_engine3.inc |
| 46 |
|
| 47 |
connection master; |
| 48 |
# Check that simple Alter statements are replicated correctly |
| 49 |
ALTER TABLE t1 MODIFY vc TEXT; |
| 50 |
|
| 51 |
SHOW CREATE TABLE t1; |
| 52 |
|
| 53 |
sync_slave_with_master; |
| 54 |
SHOW CREATE TABLE t1; |
| 55 |
|
| 56 |
# Perform basic operation on master and ensure replicated correctly |
| 57 |
--source include/rpl_multi_engine3.inc |
| 58 |
|
| 59 |
connection master; |
| 60 |
DROP TABLE IF EXISTS t1; |
| 61 |
|
| 62 |
######################################################## |
| 63 |
|
| 64 |
--echo **** Partition LIST testing **** |
| 65 |
|
| 66 |
# Create table that is partitioned by list on id i.e. (2,4). Pretend |
| 67 |
# that we missed one and alter to add. Then replicate basice |
| 68 |
# operations such at insert, update delete between 2 different storage |
| 69 |
# engines Alter table and ensure table is handled Correctly on the |
| 70 |
# slave. |
| 71 |
|
| 72 |
|
| 73 |
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), |
| 74 |
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, |
| 75 |
f FLOAT DEFAULT 0, total BIGINT UNSIGNED, |
| 76 |
y YEAR, t DATE) |
| 77 |
PARTITION BY LIST(id) |
| 78 |
(PARTITION p0 VALUES IN (2, 4), |
| 79 |
PARTITION p1 VALUES IN (42, 142), |
| 80 |
PARTITION p2 VALUES IN (412)); |
| 81 |
|
| 82 |
SHOW CREATE TABLE t1; |
| 83 |
|
| 84 |
sync_slave_with_master; |
| 85 |
SHOW CREATE TABLE t1; |
| 86 |
|
| 87 |
# Perform basic operation on master and ensure replicated correctly |
| 88 |
--source include/rpl_multi_engine3.inc |
| 89 |
|
| 90 |
connection master; |
| 91 |
# Check that simple Alter statements are replicated correctly --- |
| 92 |
ALTER TABLE t1 MODIFY vc TEXT; |
| 93 |
|
| 94 |
SHOW CREATE TABLE t1; |
| 95 |
|
| 96 |
sync_slave_with_master; |
| 97 |
SHOW CREATE TABLE t1; |
| 98 |
|
| 99 |
# Perform basic operation on master and ensure replicated correctly |
| 100 |
--source include/rpl_multi_engine3.inc |
| 101 |
|
| 102 |
connection master; |
| 103 |
DROP TABLE IF EXISTS t1; |
| 104 |
|
| 105 |
######################################################## |
| 106 |
|
| 107 |
--echo **** Partition HASH testing **** |
| 108 |
|
| 109 |
# Create table that is partitioned by hash on year i.e. YEAR(t). Then |
| 110 |
# replicate basice operations such at insert, update delete between 2 |
| 111 |
# different storage engines Alter table and ensure table is handled |
| 112 |
# Correctly on the slave |
| 113 |
|
| 114 |
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), |
| 115 |
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, |
| 116 |
f FLOAT DEFAULT 0, total BIGINT UNSIGNED, |
| 117 |
y YEAR, t DATE) |
| 118 |
PARTITION BY HASH( YEAR(t) ) |
| 119 |
PARTITIONS 4; |
| 120 |
|
| 121 |
SHOW CREATE TABLE t1; |
| 122 |
|
| 123 |
sync_slave_with_master; |
| 124 |
SHOW CREATE TABLE t1; |
| 125 |
|
| 126 |
--source include/rpl_multi_engine3.inc |
| 127 |
|
| 128 |
# Check that simple Alter statements are replicated correctly |
| 129 |
ALTER TABLE t1 MODIFY vc TEXT; |
| 130 |
|
| 131 |
SHOW CREATE TABLE t1; |
| 132 |
|
| 133 |
sync_slave_with_master; |
| 134 |
SHOW CREATE TABLE t1; |
| 135 |
|
| 136 |
--source include/rpl_multi_engine3.inc |
| 137 |
|
| 138 |
connection master; |
| 139 |
DROP TABLE IF EXISTS t1; |
| 140 |
|
| 141 |
######################################################## |
| 142 |
|
| 143 |
# This part does not work |
| 144 |
--echo **** Partition by KEY **** |
| 145 |
|
| 146 |
# Create table that is partitioned by key on id with 4 parts. Then |
| 147 |
# replicate basice operations such at insert, update delete between 2 |
| 148 |
# different storage engines Alter table and ensure table is handled |
| 149 |
# Correctly on the slave |
| 150 |
|
| 151 |
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), |
| 152 |
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, |
| 153 |
f FLOAT DEFAULT 0, total BIGINT UNSIGNED, |
| 154 |
y YEAR, t DATE,PRIMARY KEY(id)) |
| 155 |
PARTITION BY KEY() |
| 156 |
PARTITIONS 4; |
| 157 |
|
| 158 |
SHOW CREATE TABLE t1; |
| 159 |
|
| 160 |
sync_slave_with_master; |
| 161 |
SHOW CREATE TABLE t1; |
| 162 |
|
| 163 |
--source include/rpl_multi_engine3.inc |
| 164 |
|
| 165 |
connection master; |
| 166 |
# Check that simple Alter statements are replicated correctly |
| 167 |
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); |
| 168 |
|
| 169 |
SHOW CREATE TABLE t1; |
| 170 |
|
| 171 |
sync_slave_with_master; |
| 172 |
SHOW CREATE TABLE t1; |
| 173 |
|
| 174 |
--source include/rpl_multi_engine3.inc |
| 175 |
|
| 176 |
connection master; |
| 177 |
# Check that simple Alter statements are replicated correctly |
| 178 |
ALTER TABLE t1 MODIFY vc TEXT; |
| 179 |
|
| 180 |
SHOW CREATE TABLE t1; |
| 181 |
|
| 182 |
sync_slave_with_master; |
| 183 |
SHOW CREATE TABLE t1; |
| 184 |
|
| 185 |
--source include/rpl_multi_engine3.inc |
| 186 |
|
| 187 |
DROP TABLE IF EXISTS t1; |
| 188 |
|
| 189 |
# End of 5.1 test case |
| 190 |
--source include/rpl_end.inc |