Debian Codegraph @

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

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