1
by brian
clean slate |
1 |
##################################################################
|
2 |
# rpl_colSize #
|
|
3 |
# #
|
|
4 |
# This test is designed to test the changes included in WL#3228. #
|
|
5 |
# The changes include the ability to replicate with the master #
|
|
6 |
# having columns that are smaller (shorter) than the slave. #
|
|
7 |
##################################################################
|
|
8 |
||
9 |
-- source include/master-slave.inc |
|
10 |
||
11 |
--disable_warnings |
|
12 |
DROP TABLE IF EXISTS t1; |
|
13 |
--enable_warnings |
|
14 |
||
15 |
--echo **** Testing WL#3228 changes. **** |
|
16 |
--echo *** Create "wider" table on slave *** |
|
17 |
sync_slave_with_master; |
|
18 |
STOP SLAVE; |
|
19 |
RESET SLAVE; |
|
20 |
||
21 |
eval CREATE TABLE t1 ( |
|
22 |
a float (47), |
|
23 |
b double (143,9), |
|
24 |
c decimal (65,30), |
|
25 |
d numeric (4,0), |
|
26 |
e bit (32), |
|
27 |
f char (21), |
|
28 |
g varchar (1300), |
|
29 |
h binary (33), |
|
30 |
j varbinary (200), |
|
31 |
k enum ('5','6','7', '8','9','0'), |
|
32 |
l set ('1','2','3','4','5','6','7','8','9','0','11','12','13','14','15','16','17','18','19','21','22','23','24','25','26','27','28','29'), |
|
33 |
m TINYBLOB, |
|
34 |
n BLOB, |
|
35 |
o MEDIUMBLOB, |
|
36 |
p LONGBLOB, |
|
37 |
q TINYTEXT, |
|
38 |
r TEXT, |
|
39 |
s MEDIUMTEXT, |
|
40 |
t LONGTEXT |
|
41 |
);
|
|
42 |
||
43 |
--echo *** Create same table on master but with narrow columns *** |
|
44 |
connection master; |
|
45 |
eval CREATE TABLE t1 ( |
|
46 |
a float (44), |
|
47 |
b double (10,3), |
|
48 |
c decimal (10,2), |
|
49 |
d numeric (3,0), |
|
50 |
e bit (16), |
|
51 |
f char (10), |
|
52 |
g varchar (100), |
|
53 |
h binary (20), |
|
54 |
j varbinary (20), |
|
55 |
k enum ('5','6','7'), |
|
56 |
l set ('1','2','3','4','5','6','7','8','9','0'), |
|
57 |
m TINYBLOB, |
|
58 |
n BLOB, |
|
59 |
o MEDIUMBLOB, |
|
60 |
p LONGBLOB, |
|
61 |
q TINYTEXT, |
|
62 |
r TEXT, |
|
63 |
s MEDIUMTEXT, |
|
64 |
t LONGTEXT |
|
65 |
);
|
|
66 |
||
67 |
RESET MASTER; |
|
68 |
||
69 |
--echo *** Start replication *** |
|
70 |
connection slave; |
|
71 |
START SLAVE; |
|
72 |
||
73 |
--echo *** Insert data on master and display it. *** |
|
74 |
connection master; |
|
75 |
||
76 |
INSERT INTO t1 () VALUES ( |
|
77 |
17.567, |
|
78 |
2.123, |
|
79 |
10.20, |
|
80 |
125, |
|
81 |
hex(64), |
|
82 |
'TEST', |
|
83 |
'This is a test', |
|
84 |
'binary data', |
|
85 |
'more binary data', |
|
86 |
'6', |
|
87 |
'7', |
|
88 |
"blob 1", |
|
89 |
"blob 2", |
|
90 |
"blob 3", |
|
91 |
"blob 4", |
|
92 |
"text 1", |
|
93 |
"text 2", |
|
94 |
"text 3", |
|
95 |
"text 4"); |
|
96 |
||
97 |
# Replace values in columns that display differently between SBR & RBR
|
|
98 |
--replace_column 5 # 8 # |
|
99 |
SELECT * FROM t1 ORDER BY a; |
|
100 |
||
101 |
--echo *** Select data from slave to compare *** |
|
102 |
sync_slave_with_master; |
|
103 |
connection slave; |
|
104 |
||
105 |
# Replace values in columns that display differently between SBR & RBR
|
|
106 |
--replace_column 5 # 8 # |
|
107 |
SELECT * FROM t1 ORDER BY a; |
|
108 |
||
109 |
# Test boundary limits of varchar and char fields
|
|
110 |
# Master/Slave
|
|
111 |
# <256/<256 with m < s, m > s, and m == s <-- col a
|
|
112 |
# >255/<256 with m < s, m > s, and m == s <-- error will be caught in BUG#22086
|
|
113 |
# <256/>255 with m < s, m > s, and m == s <-- col b
|
|
114 |
# >255/>255 with m < s, m > s, and m == s <-- col c
|
|
115 |
#
|
|
116 |
# Test boundary limits of CHAR fields
|
|
117 |
# Master/Slave
|
|
118 |
# <256/<256 with m < s, m > s, and m == s <-- col d
|
|
119 |
# >255/<256 with m < s, m > s, and m == s <-- error char limited to 255 chars
|
|
120 |
# <256/>255 with m < s, m > s, and m == s <-- error char limited to 255 chars
|
|
121 |
# >255/>255 with m < s, m > s, and m == s <-- error char limited to 255 chars
|
|
122 |
||
123 |
connection master; |
|
124 |
DROP TABLE t1; |
|
125 |
||
126 |
--echo Create varchar table on master |
|
127 |
CREATE TABLE t1 ( |
|
128 |
a VARCHAR(50), |
|
129 |
b VARCHAR(100), |
|
130 |
c VARCHAR(300), |
|
131 |
d CHAR(5) |
|
132 |
);
|
|
133 |
||
134 |
sync_slave_with_master slave; |
|
135 |
||
136 |
--echo Alter varchar table on slave |
|
137 |
ALTER TABLE t1 CHANGE COLUMN a a VARCHAR(100); |
|
138 |
ALTER TABLE t1 CHANGE COLUMN b b VARCHAR(400); |
|
139 |
ALTER TABLE t1 CHANGE COLUMN c c VARCHAR(500); |
|
140 |
ALTER TABLE t1 CHANGE COLUMN d d CHAR(100); |
|
141 |
||
142 |
connection master; |
|
143 |
||
144 |
--echo Insert some values and select them on master |
|
145 |
INSERT INTO t1 VALUES ("This is a test of col a.", |
|
146 |
"This is another test of col b.", |
|
147 |
"This is a test of the large col c.", |
|
148 |
"Col d"); |
|
149 |
SELECT * FROM t1; |
|
150 |
--replace_result default DEFAULT |
|
151 |
SHOW CREATE TABLE t1; |
|
152 |
||
153 |
sync_slave_with_master slave; |
|
154 |
||
155 |
--echo Insert some values and select them on slave |
|
156 |
SELECT * FROM t1; |
|
157 |
--replace_result default DEFAULT |
|
158 |
SHOW CREATE TABLE t1; |
|
159 |
||
160 |
||
161 |
# Test boundary limits of bit fields
|
|
162 |
# m < s, m % 8 != 0, and s % 8 == 0 col a
|
|
163 |
# m < s, m % 8 == 0, and s % 8 != 0 col b
|
|
164 |
# m < s, m % 8 != 0, and s % 8 != 0 col c
|
|
165 |
# m > s, m % 8 != 0, and s % 8 == 0 <-- error will be caught in BUG#22086
|
|
166 |
# m > s, m % 8 == 0, and s % 8 != 0 <-- error will be caught in BUG#22086
|
|
167 |
# m > s, m % 8 != 0, and s % 8 != 0 <-- error will be caught in BUG#22086
|
|
168 |
||
169 |
connection master; |
|
170 |
DROP TABLE t1; |
|
171 |
||
172 |
--echo Create bit table on master |
|
173 |
CREATE TABLE t1 ( |
|
174 |
a BIT(7), |
|
175 |
b BIT(8), |
|
176 |
c BIT(21), |
|
177 |
d BIT(11), |
|
178 |
e BIT(11) |
|
179 |
);
|
|
180 |
||
181 |
sync_slave_with_master slave; |
|
182 |
||
183 |
--echo Create bit table on slave |
|
184 |
DROP TABLE t1; |
|
185 |
CREATE TABLE t1 ( |
|
186 |
a BIT(16), |
|
187 |
b BIT(22), |
|
188 |
c BIT(54), |
|
189 |
d BIT(25), |
|
190 |
e BIT(13) |
|
191 |
);
|
|
192 |
||
193 |
connection master; |
|
194 |
||
195 |
--echo Insert some values and select them on master |
|
196 |
INSERT INTO t1 VALUES ( |
|
197 |
b'1010101', |
|
198 |
b'10101011', |
|
199 |
b'101010110101010101111', |
|
200 |
b'10101010101', |
|
201 |
b'10101011111' |
|
202 |
);
|
|
203 |
||
204 |
SELECT BIN(a), BIN(b), BIN(c), BIN(d), BIN(e) FROM t1; |
|
205 |
--replace_result default DEFAULT |
|
206 |
SHOW CREATE TABLE t1; |
|
207 |
||
208 |
sync_slave_with_master slave; |
|
209 |
||
210 |
--echo Insert some values and select them on master |
|
211 |
SELECT BIN(a), BIN(b), BIN(c), BIN(d), BIN(e) FROM t1; |
|
212 |
--replace_result default DEFAULT |
|
213 |
SHOW CREATE TABLE t1; |
|
214 |
||
215 |
--echo *** Cleanup *** |
|
216 |
connection master; |
|
217 |
DROP TABLE t1; |
|
218 |
sync_slave_with_master; |
|
219 |
||
220 |
# END 5.1 Test Case
|