Merge lp:~tsarev/percona-server/5.1-18205-wl5151 into lp:percona-server/5.1

Proposed by Oleg Tsarev
Status: Rejected
Rejected by: Alexey Kopytov
Proposed branch: lp:~tsarev/percona-server/5.1-18205-wl5151
Merge into: lp:percona-server/5.1
Prerequisite: lp:~tsarev/percona-server/5.1-18205_03_wl47.patch
Diff against target: 5379 lines (+3366/-486)
47 files modified
Percona-Server/client/mysqlbinlog.cc (+1/-0)
Percona-Server/libmysqld/Makefile.am (+1/-1)
Percona-Server/mysql-test/extra/rpl_tests/check_type.inc (+52/-0)
Percona-Server/mysql-test/extra/rpl_tests/rpl_extra_col_master.test (+7/-6)
Percona-Server/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test (+24/-16)
Percona-Server/mysql-test/extra/rpl_tests/rpl_row_basic.test (+41/-13)
Percona-Server/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test (+4/-4)
Percona-Server/mysql-test/extra/rpl_tests/type_conversions.test (+882/-0)
Percona-Server/mysql-test/include/test_fieldsize.inc (+1/-1)
Percona-Server/mysql-test/r/percona_server_variables_debug.result (+1/-0)
Percona-Server/mysql-test/r/percona_server_variables_release.result (+1/-0)
Percona-Server/mysql-test/suite/binlog/r/binlog_base64_flag.result (+1/-0)
Percona-Server/mysql-test/suite/binlog/t/binlog_base64_flag.test (+1/-0)
Percona-Server/mysql-test/suite/rpl/r/rpl_bug31076.result (+3/-0)
Percona-Server/mysql-test/suite/rpl/r/rpl_colSize.result (+3/-0)
Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result (+18/-18)
Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result (+18/-18)
Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result (+27/-24)
Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result (+27/-24)
Percona-Server/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result (+6/-10)
Percona-Server/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result (+12/-10)
Percona-Server/mysql-test/suite/rpl/r/rpl_row_colSize.result (+26/-26)
Percona-Server/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result (+7/-7)
Percona-Server/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result (+7/-7)
Percona-Server/mysql-test/suite/rpl/r/rpl_typeconv.result (+539/-0)
Percona-Server/mysql-test/suite/rpl/t/rpl_bug31076.test (+6/-0)
Percona-Server/mysql-test/suite/rpl/t/rpl_colSize.test (+5/-0)
Percona-Server/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test (+2/-0)
Percona-Server/mysql-test/suite/rpl/t/rpl_row_colSize.test (+4/-0)
Percona-Server/mysql-test/suite/rpl/t/rpl_typeconv.test (+75/-0)
Percona-Server/sql/field.cc (+291/-66)
Percona-Server/sql/field.h (+29/-23)
Percona-Server/sql/log_event.cc (+55/-34)
Percona-Server/sql/log_event_old.cc (+20/-4)
Percona-Server/sql/mysql_priv.h (+1/-0)
Percona-Server/sql/mysqld.cc (+23/-0)
Percona-Server/sql/rpl_record.cc (+79/-13)
Percona-Server/sql/rpl_rli.h (+14/-6)
Percona-Server/sql/rpl_utility.cc (+869/-44)
Percona-Server/sql/rpl_utility.h (+80/-111)
Percona-Server/sql/set_var.cc (+33/-0)
Percona-Server/sql/set_var.h (+1/-0)
Percona-Server/sql/share/errmsg.txt (+6/-0)
Percona-Server/sql/sql_class.h (+2/-0)
Percona-Server/sql/sql_select.cc (+12/-0)
doc/source/flexibility/rbr_slave_type_conversion.rst (+48/-0)
doc/source/index.rst (+1/-0)
To merge this branch: bzr merge lp:~tsarev/percona-server/5.1-18205-wl5151
Reviewer Review Type Date Requested Status
Percona core Pending
Review via email: mp+94096@code.launchpad.net

This proposal supersedes a proposal from 2012-02-22.

Description of the change

To post a comment you must log in.

Unmerged revisions

431. By Oleg Tsarev

add documentation for wl5151

430. By Oleg Tsarev

Merge feature WL #5151

429. By Oleg Tsarev

Merge feature WL #47 - annotate rows log events

428. By Oleg Tsarev

merge lp:~tsarev/percona-server/5.1-18205_02_wl36.patch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/client/mysqlbinlog.cc'
2--- Percona-Server/client/mysqlbinlog.cc 2012-02-22 07:32:22 +0000
3+++ Percona-Server/client/mysqlbinlog.cc 2012-02-22 07:32:24 +0000
4@@ -44,6 +44,7 @@
5 #include "sql_string.h" // needed for Rpl_filter
6 #include "sql_list.h" // needed for Rpl_filter
7 #include "rpl_filter.h"
8+#include "rpl_utility.cc"
9
10 Rpl_filter *binlog_filter;
11
12
13=== modified file 'Percona-Server/libmysqld/Makefile.am'
14--- Percona-Server/libmysqld/Makefile.am 2011-06-30 15:37:13 +0000
15+++ Percona-Server/libmysqld/Makefile.am 2012-02-22 07:32:24 +0000
16@@ -57,7 +57,7 @@
17 item_xmlfunc.cc \
18 key.cc lock.cc log.cc sql_state.c \
19 log_event.cc rpl_record.cc \
20- log_event_old.cc rpl_record_old.cc \
21+ log_event_old.cc rpl_record_old.cc rpl_utility.cc \
22 protocol.cc net_serv.cc opt_range.cc \
23 opt_sum.cc procedure.cc records.cc sql_acl.cc \
24 sql_load.cc discover.cc sql_locale.cc \
25
26=== added file 'Percona-Server/mysql-test/extra/rpl_tests/check_type.inc'
27--- Percona-Server/mysql-test/extra/rpl_tests/check_type.inc 1970-01-01 00:00:00 +0000
28+++ Percona-Server/mysql-test/extra/rpl_tests/check_type.inc 2012-02-22 07:32:24 +0000
29@@ -0,0 +1,52 @@
30+# Helper file to perform one insert of a value into a table with
31+# different types on master and slave. The file will insert the
32+# result into the type_conversions table *on the slave* to get a
33+# summary of failing and succeeding tests.
34+
35+# Input:
36+# $source_type Type on the master
37+# $target_type Type on the slave
38+# $source_value Value on the master (inserted into the table)
39+# $target_value Value on the slave (expected value in the table
40+# on the slave)
41+# $can_convert True if conversion shall work, false if it
42+# shall generate an error
43+
44+
45+connection master;
46+disable_warnings;
47+DROP TABLE IF EXISTS t1;
48+enable_warnings;
49+eval CREATE TABLE t1 (a $source_type);
50+sync_slave_with_master;
51+eval ALTER TABLE t1 MODIFY a $target_type;
52+
53+connection master;
54+eval INSERT INTO t1 VALUES($source_value);
55+if ($can_convert) {
56+ sync_slave_with_master;
57+ eval SELECT a = $target_value into @compare FROM t1;
58+ eval INSERT INTO type_conversions SET
59+ Source = "$source_type",
60+ Target = "$target_type",
61+ Flags = @@slave_type_conversions,
62+ On_Master = $source_value,
63+ Expected = $target_value,
64+ Compare = @compare;
65+ UPDATE type_conversions
66+ SET On_Slave = (SELECT a FROM t1)
67+ WHERE TestNo = LAST_INSERT_ID();
68+}
69+if (!$can_convert) {
70+ connection slave;
71+ wait_for_slave_to_stop;
72+ let $error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
73+ eval INSERT INTO type_conversions SET
74+ Source = "$source_type",
75+ Target = "$target_type",
76+ Flags = @@slave_type_conversions,
77+ On_Master = $source_value,
78+ Error = "$error";
79+ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
80+ START SLAVE;
81+}
82
83=== modified file 'Percona-Server/mysql-test/extra/rpl_tests/rpl_extra_col_master.test'
84--- Percona-Server/mysql-test/extra/rpl_tests/rpl_extra_col_master.test 2011-03-31 13:48:05 +0000
85+++ Percona-Server/mysql-test/extra/rpl_tests/rpl_extra_col_master.test 2012-02-22 07:32:24 +0000
86@@ -124,6 +124,7 @@
87
88 --disable_query_log
89 call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 2 type mismatch.* 1535");
90+call mtr.add_suppression("Slave SQL.*Column.*of table.*cannot be converted from type.*to type.* 1677");
91 call mtr.add_suppression("Slave.*Can.t DROP .c7.; check that column.key exists.* Error_code: 1091");
92 call mtr.add_suppression("Slave.*Unknown column .c7. in .t15.* Error_code: 1054");
93 call mtr.add_suppression("Slave.*Key column .c6. doesn.t exist in table.* Error_code: 1072");
94@@ -479,12 +480,12 @@
95
96 --echo
97 --echo ********************************************
98---echo *** Expect slave to fail with Error 1535 ***
99+--echo *** Expect slave to fail with Error 1677 ***
100 --echo ********************************************
101 --echo
102 connection slave;
103-# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
104---let $slave_sql_errno= 1535
105+# 1677 = ER_BINLOG_ROW_WRONG_TABLE_DEF
106+--let $slave_sql_errno= 1677
107 --let $slave_skip_counter= 2
108 --let $show_slave_sql_error= 1
109 --source include/wait_for_slave_sql_error_and_skip.inc
110@@ -535,12 +536,12 @@
111
112 --echo
113 --echo ********************************************
114---echo *** Expect slave to fail with Error 1535 ***
115+--echo *** Expect slave to fail with Error 1677 ***
116 --echo ********************************************
117 --echo
118 connection slave;
119-# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
120---let $slave_sql_errno= 1535
121+# 1677 = ER_BINLOG_ROW_WRONG_TABLE_DEF
122+--let $slave_sql_errno= 1677
123 --let $slave_skip_counter= 2
124 --let $show_slave_sql_error= 1
125 --source include/wait_for_slave_sql_error_and_skip.inc
126
127=== modified file 'Percona-Server/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test'
128--- Percona-Server/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test 2011-02-23 09:31:37 +0000
129+++ Percona-Server/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test 2012-02-22 07:32:24 +0000
130@@ -13,6 +13,9 @@
131 # should stop the slave. #
132 #################################################
133
134+--disable_query_log
135+call mtr.add_suppression("Slave SQL.*Column.*of table.*cannot be converted from type.*to type.* 1677");
136+--enable_query_log
137 call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051");
138
139 --echo **** Diff Table Def Start ****
140@@ -27,6 +30,9 @@
141 STOP SLAVE;
142 RESET SLAVE;
143
144+SET @saved_slave_type_conversions = @@slave_type_conversions;
145+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
146+
147 eval CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
148 d FLOAT DEFAULT '2.00',
149 e CHAR(4) DEFAULT 'TEST')
150@@ -53,6 +59,8 @@
151 sync_slave_with_master;
152 SELECT * FROM t1 ORDER BY a;
153
154+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
155+
156 --echo *** Drop t1 ***
157 connection master;
158 DROP TABLE t1;
159@@ -87,7 +95,7 @@
160 --echo *** Start Slave ***
161 connection slave;
162 START SLAVE;
163---let $slave_sql_errno= 1535
164+--let $slave_sql_errno= 1677
165 --let $show_slave_sql_error= 1
166 --source include/wait_for_slave_sql_error.inc
167 STOP SLAVE;
168@@ -136,10 +144,10 @@
169 INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
170
171 --echo ********************************************
172---echo *** Expect slave to fail with Error 1535 ***
173+--echo *** Expect slave to fail with Error 1677 ***
174 --echo ********************************************
175 connection slave;
176---let $slave_sql_errno= 1535
177+--let $slave_sql_errno= 1677
178 --let $slave_skip_counter= 2
179 --let $show_slave_sql_error= 1
180 --source include/wait_for_slave_sql_error_and_skip.inc
181@@ -179,10 +187,10 @@
182 (30000.22,4,'QA TESTING');
183
184 --echo ********************************************
185---echo *** Expect slave to fail with Error 1535 ***
186+--echo *** Expect slave to fail with Error 1677 ***
187 --echo ********************************************
188 connection slave;
189---let $slave_sql_errno= 1535
190+--let $slave_sql_errno= 1677
191 --let $slave_skip_counter= 2
192 --let $show_slave_sql_error= 1
193 --source include/wait_for_slave_sql_error_and_skip.inc
194@@ -222,10 +230,10 @@
195 (2,'JOE',300.01,0,'b2b2',1.0000009);
196
197 --echo ********************************************
198---echo *** Expect slave to fail with Error 1535 ***
199+--echo *** Expect slave to fail with Error 1677 ***
200 --echo ********************************************
201 connection slave;
202---let $slave_sql_errno= 1535
203+--let $slave_sql_errno= 1677
204 --let $slave_skip_counter= 2
205 --let $show_slave_sql_error= 1
206 --source include/wait_for_slave_sql_error_and_skip.inc
207@@ -266,10 +274,10 @@
208 (2,'JOE',300.01,0);
209
210 --echo ********************************************
211---echo *** Expect slave to fail with Error 1535 ***
212+--echo *** Expect slave to fail with Error 1677 ***
213 --echo ********************************************
214 connection slave;
215---let $slave_sql_errno= 1535
216+--let $slave_sql_errno= 1677
217 --let $show_slave_sql_error= 1
218 --source include/wait_for_slave_sql_error.inc
219 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
220@@ -470,10 +478,10 @@
221 INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
222
223 --echo ********************************************
224---echo *** Expect slave to fail with Error 1535 ***
225+--echo *** Expect slave to fail with Error 1677 ***
226 --echo ********************************************
227 connection slave;
228---let $slave_sql_errno= 1535
229+--let $slave_sql_errno= 1677
230 --let $slave_skip_counter= 2
231 --let $show_slave_sql_error= 1
232 --source include/wait_for_slave_sql_error_and_skip.inc
233@@ -492,7 +500,7 @@
234 --echo *** Create t11 on slave ***
235 STOP SLAVE;
236 RESET SLAVE;
237-eval CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
238+eval CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
239 c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
240
241 --echo *** Create t11 on Master ***
242@@ -512,10 +520,10 @@
243 INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
244
245 --echo ********************************************
246---echo *** Expect slave to fail with Error 1535 ***
247+--echo *** Expect slave to fail with Error 1677 ***
248 --echo ********************************************
249 connection slave;
250---let $slave_sql_errno= 1535
251+--let $slave_sql_errno= 1677
252 --let $slave_skip_counter= 2
253 --let $show_slave_sql_error= 1
254 --source include/wait_for_slave_sql_error_and_skip.inc
255@@ -899,10 +907,10 @@
256 INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
257
258 --echo ********************************************
259---echo *** Expect slave to fail with Error 1535 ***
260+--echo *** Expect slave to fail with Error 1677 ***
261 --echo ********************************************
262 connection slave;
263---let $slave_sql_errno= 1535
264+--let $slave_sql_errno= 1677
265 --let $slave_skip_counter= 2
266 --let $show_slave_sql_error= 1
267 --source include/wait_for_slave_sql_error_and_skip.inc
268
269=== modified file 'Percona-Server/mysql-test/extra/rpl_tests/rpl_row_basic.test'
270--- Percona-Server/mysql-test/extra/rpl_tests/rpl_row_basic.test 2011-02-23 09:31:37 +0000
271+++ Percona-Server/mysql-test/extra/rpl_tests/rpl_row_basic.test 2012-02-22 07:32:24 +0000
272@@ -6,6 +6,10 @@
273 # First we test tables with only an index.
274 #
275
276+--disable_query_log
277+call mtr.add_suppression("Slave SQL.*Column.*of table.*cannot be converted from type.*to type.* 1677");
278+--enable_query_log
279+connection master;
280 eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ;
281 SELECT * FROM t1;
282 sync_slave_with_master;
283@@ -156,6 +160,12 @@
284 # Testing special column types
285 #
286
287+if (`select char_length('$bit_field_special') > 0`) {
288+ SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
289+ connection slave;
290+ eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
291+}
292+
293 connection master;
294 eval CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = $type ;
295
296@@ -164,6 +174,10 @@
297 sync_slave_with_master;
298 SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
299
300+if (`select char_length('$bit_field_special') > 0`) {
301+ SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
302+}
303+
304 #
305 # Testing conflicting operations
306 #
307@@ -347,6 +361,10 @@
308 c CHAR(255) CHARACTER SET utf8 NOT NULL,
309 j INT NOT NULL) ENGINE = $type ;
310
311+connection slave;
312+SET @saved_slave_type_conversions = @@slave_type_conversions;
313+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
314+
315 --echo [expecting slave to replicate correctly]
316 connection master;
317 INSERT INTO t1 VALUES (1, "", 1);
318@@ -365,18 +383,9 @@
319 let $diff_tables= master:t2, slave:t2;
320 source include/diff_tables.inc;
321
322---echo [expecting slave to stop]
323-connection master;
324-INSERT INTO t3 VALUES (1, "", 1);
325-INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
326
327 connection slave;
328-# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
329-call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535");
330 call mtr.add_suppression("Slave SQL.*Could not execute Delete_rows event on table test.t1.* Error_code: 1032");
331---let $slave_sql_errno= 1535
332---let $show_slave_sql_error= 1
333---source include/wait_for_slave_sql_error.inc
334
335 --let $rpl_only_running_threads= 1
336 --source include/rpl_reset.inc
337@@ -396,8 +405,8 @@
338 INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
339
340 connection slave;
341-# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
342---let $slave_sql_errno= 1535
343+# 1677 = ER_BINLOG_ROW_WRONG_TABLE_DEF
344+--let $slave_sql_errno= 1677
345 --let $show_slave_sql_error= 1
346 --source include/wait_for_slave_sql_error.inc
347
348@@ -409,8 +418,8 @@
349 INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
350
351 connection slave;
352-# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
353---let $slave_sql_errno= 1535
354+# 1677 = ER_BINLOG_ROW_WRONG_TABLE_DEF
355+--let $slave_sql_errno= 1677
356 --let $show_slave_sql_error= 1
357 --source include/wait_for_slave_sql_error.inc
358
359@@ -575,7 +584,15 @@
360
361 connection master;
362
363+# Since t1 contain a bit field, we have to do this trick to handle InnoDB
364+if (`select char_length('$bit_field_special') > 0`) {
365+ SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
366+ connection slave;
367+ eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
368+}
369+
370 --disable_warnings
371+connection master;
372 eval CREATE TABLE t1 (a bit) ENGINE=$type;
373 INSERT IGNORE INTO t1 VALUES (NULL);
374 INSERT INTO t1 ( a ) VALUES ( 0 );
375@@ -620,9 +637,20 @@
376
377 sync_slave_with_master;
378
379+if (`select char_length('$bit_field_special') > 0`) {
380+ SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
381+}
382+
383 let $diff_tables= master:t1, slave:t1;
384 source include/diff_tables.inc;
385
386 connection master;
387 drop table t1;
388 sync_slave_with_master;
389+
390+--disable_query_log
391+--disable_result_log
392+connection slave;
393+SET GLOBAL SLAVE_TYPE_CONVERSIONS=default;
394+--enable_result_log
395+--enable_query_log
396
397=== modified file 'Percona-Server/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test'
398--- Percona-Server/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test 2011-02-23 09:31:37 +0000
399+++ Percona-Server/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test 2012-02-22 07:32:24 +0000
400@@ -147,9 +147,9 @@
401 connection master;
402 INSERT INTO t4 VALUES (4);
403 connection slave;
404-call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column [012] type mismatch.* Error_code: 1535");
405+call mtr.add_suppression("Slave SQL.*Column.*of table.*cannot be converted from type.*to type.* 1677");
406 --let $slave_skip_counter= 2
407---let $slave_sql_errno= 1535
408+--let $slave_sql_errno= 1677
409 --let $show_slave_sql_error= 1
410 --source include/wait_for_slave_sql_error_and_skip.inc
411
412@@ -161,7 +161,7 @@
413 INSERT INTO t5 VALUES (5,10,25);
414 connection slave;
415 --let $slave_skip_counter= 2
416---let $slave_sql_errno= 1535
417+--let $slave_sql_errno= 1677
418 --let $show_slave_sql_error= 1
419 --source include/wait_for_slave_sql_error_and_skip.inc
420
421@@ -173,7 +173,7 @@
422 INSERT INTO t6 VALUES (6,12,36);
423 connection slave;
424 --let $slave_skip_counter= 2
425---let $slave_sql_errno= 1535
426+--let $slave_sql_errno= 1677
427 --let $show_slave_sql_error= 1
428 --source include/wait_for_slave_sql_error_and_skip.inc
429
430
431=== added file 'Percona-Server/mysql-test/extra/rpl_tests/type_conversions.test'
432--- Percona-Server/mysql-test/extra/rpl_tests/type_conversions.test 1970-01-01 00:00:00 +0000
433+++ Percona-Server/mysql-test/extra/rpl_tests/type_conversions.test 2012-02-22 07:32:24 +0000
434@@ -0,0 +1,882 @@
435+# File containing different lossy and non-lossy type conversions.
436+
437+# Integral conversion testing, we do not reduce the test using
438+# transitivity of conversions since the implementation is not using a
439+# transitivity strategy. Instead we do an exhaustive testing.
440+
441+disable_query_log;
442+connection slave;
443+--let $conv = `select @@slave_type_conversions`
444+--echo **** Running tests with @@SLAVE_TYPE_CONVERSIONS = '$conv' ****
445+
446+let $if_is_lossy = `SELECT FIND_IN_SET('ALL_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
447+let $if_is_non_lossy = `SELECT FIND_IN_SET('ALL_NON_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
448+
449+# TINYBLOB
450+
451+let $source_type = TINYBLOB;
452+let $target_type = TINYBLOB;
453+let $source_value = 'aaa';
454+let $target_value = 'aaa';
455+let $can_convert = 1;
456+source extra/rpl_tests/check_type.inc;
457+
458+let $source_type= TINYBLOB;
459+let $target_type= BLOB;
460+let $source_value= 'aaa';
461+let $target_value= 'aaa';
462+let $can_convert= $if_is_non_lossy;
463+source extra/rpl_tests/check_type.inc;
464+
465+let $source_type= TINYBLOB;
466+let $target_type= MEDIUMBLOB;
467+let $source_value= 'aaa';
468+let $target_value= 'aaa';
469+let $can_convert= $if_is_non_lossy;
470+source extra/rpl_tests/check_type.inc;
471+
472+let $source_type= TINYBLOB;
473+let $target_type= LONGBLOB;
474+let $source_value= 'aaa';
475+let $target_value= 'aaa';
476+let $can_convert= $if_is_non_lossy;
477+source extra/rpl_tests/check_type.inc;
478+
479+# BLOB
480+
481+let $source_type = BLOB;
482+let $target_type = TINYBLOB;
483+let $source_value = 'aaa';
484+let $target_value = 'aaa';
485+let $can_convert = $if_is_lossy;
486+source extra/rpl_tests/check_type.inc;
487+
488+let $source_type= BLOB;
489+let $target_type= BLOB;
490+let $source_value= 'aaa';
491+let $target_value= 'aaa';
492+let $can_convert= 1;
493+source extra/rpl_tests/check_type.inc;
494+
495+let $source_type= BLOB;
496+let $target_type= MEDIUMBLOB;
497+let $source_value= 'aaa';
498+let $target_value= 'aaa';
499+let $can_convert= $if_is_non_lossy;
500+source extra/rpl_tests/check_type.inc;
501+
502+let $source_type= BLOB;
503+let $target_type= LONGBLOB;
504+let $source_value= 'aaa';
505+let $target_value= 'aaa';
506+let $can_convert= $if_is_non_lossy;
507+source extra/rpl_tests/check_type.inc;
508+
509+# MEDIUMBLOB
510+
511+let $source_type = MEDIUMBLOB;
512+let $target_type = TINYBLOB;
513+let $source_value = 'aaa';
514+let $target_value = 'aaa';
515+let $can_convert = $if_is_lossy;
516+source extra/rpl_tests/check_type.inc;
517+
518+let $source_type= MEDIUMBLOB;
519+let $target_type= BLOB;
520+let $source_value= 'aaa';
521+let $target_value= 'aaa';
522+let $can_convert= $if_is_lossy;
523+source extra/rpl_tests/check_type.inc;
524+
525+let $source_type= MEDIUMBLOB;
526+let $target_type= MEDIUMBLOB;
527+let $source_value= 'aaa';
528+let $target_value= 'aaa';
529+let $can_convert= 1;
530+source extra/rpl_tests/check_type.inc;
531+
532+let $source_type= MEDIUMBLOB;
533+let $target_type= LONGBLOB;
534+let $source_value= 'aaa';
535+let $target_value= 'aaa';
536+let $can_convert= $if_is_non_lossy;
537+source extra/rpl_tests/check_type.inc;
538+
539+# LONGBLOB
540+
541+let $source_type = LONGBLOB;
542+let $target_type = TINYBLOB;
543+let $source_value = 'aaa';
544+let $target_value = 'aaa';
545+let $can_convert = $if_is_lossy;
546+source extra/rpl_tests/check_type.inc;
547+
548+let $source_type= LONGBLOB;
549+let $target_type= BLOB;
550+let $source_value= 'aaa';
551+let $target_value= 'aaa';
552+let $can_convert= $if_is_lossy;
553+source extra/rpl_tests/check_type.inc;
554+
555+let $source_type= LONGBLOB;
556+let $target_type= MEDIUMBLOB;
557+let $source_value= 'aaa';
558+let $target_value= 'aaa';
559+let $can_convert= $if_is_lossy;
560+source extra/rpl_tests/check_type.inc;
561+
562+let $source_type= LONGBLOB;
563+let $target_type= LONGBLOB;
564+let $source_value= 'aaa';
565+let $target_value= 'aaa';
566+let $can_convert= 1;
567+source extra/rpl_tests/check_type.inc;
568+
569+# BUG#49836 (additional tests - GEOMETRY TYPE)
570+
571+let $source_type = GEOMETRY;
572+let $target_type = BLOB;
573+let $source_value = PointFromText('POINT(10 10)');
574+let $target_value = PointFromText('POINT(10 10)');
575+let $can_convert = 0;
576+source extra/rpl_tests/check_type.inc;
577+
578+let $source_type = BLOB;
579+let $target_type = GEOMETRY;
580+let $source_value = 'aaa';
581+let $target_value = 'aaa';
582+let $can_convert = 0;
583+source extra/rpl_tests/check_type.inc;
584+
585+let $source_type = GEOMETRY;
586+let $target_type = GEOMETRY;
587+let $source_value = PointFromText('POINT(10 10)');
588+let $target_value = PointFromText('POINT(10 10)');
589+let $can_convert = 1;
590+source extra/rpl_tests/check_type.inc;
591+
592+let $source_type = BIT(1);
593+let $target_type = BIT(1);
594+let $source_value = b'1';
595+let $target_value = b'1';
596+let $can_convert = 1;
597+source extra/rpl_tests/check_type.inc;
598+
599+let $source_type = DATE;
600+let $target_type = DATE;
601+let $source_value = '2009-11-21';
602+let $target_value = '2009-11-21';
603+let $can_convert = 1;
604+source extra/rpl_tests/check_type.inc;
605+
606+let $source_type = ENUM('master','slave');
607+let $target_type = ENUM('master','slave');
608+let $source_value = 'master';
609+let $target_value = 'master';
610+let $can_convert = 1;
611+source extra/rpl_tests/check_type.inc;
612+
613+let $source_type = CHAR(10);
614+let $target_type = ENUM('master','slave');
615+let $source_value = 'master';
616+let $target_value = 'master';
617+let $can_convert = 0;
618+source extra/rpl_tests/check_type.inc;
619+
620+let $source_type = CHAR(10);
621+let $target_type = SET('master','slave');
622+let $source_value = 'master';
623+let $target_value = 'master';
624+let $can_convert = 0;
625+source extra/rpl_tests/check_type.inc;
626+
627+let $source_type = ENUM('master','slave');
628+let $target_type = CHAR(10);
629+let $source_value = 'master';
630+let $target_value = 'master';
631+let $can_convert = 0;
632+source extra/rpl_tests/check_type.inc;
633+
634+let $source_type = SET('master','slave');
635+let $target_type = CHAR(10);
636+let $source_value = 'master';
637+let $target_value = 'master';
638+let $can_convert = 0;
639+source extra/rpl_tests/check_type.inc;
640+
641+let $source_type = SET('master','slave');
642+let $target_type = SET('master','slave');
643+let $source_value = '';
644+let $target_value = '';
645+let $can_convert = 1;
646+source extra/rpl_tests/check_type.inc;
647+
648+let $source_type = SET('master','slave');
649+let $target_type = SET('master','slave');
650+let $source_value = 'master,slave';
651+let $target_value = 'master,slave';
652+let $can_convert = 1;
653+source extra/rpl_tests/check_type.inc;
654+
655+let $source_type = SET('0','1','2','3','4','5','6');
656+let $target_type = SET('0','1','2','3','4','5','6');
657+let $source_value = '5';
658+let $target_value = '5';
659+let $can_convert = 1;
660+source extra/rpl_tests/check_type.inc;
661+
662+let $source_type = SET('0','1','2','3','4','5','6');
663+let $target_type = SET('0','1','2','3','4','5','6','7','8','9','10');
664+let $source_value = '5';
665+let $target_value = '5';
666+let $can_convert = $if_is_non_lossy;
667+source extra/rpl_tests/check_type.inc;
668+
669+let $source_type = SET('0','1','2','3','4','5','6','7','8','9','10');
670+let $target_type = SET('0','1','2','3','4','5','6');
671+let $source_value = '5';
672+let $target_value = '5';
673+let $can_convert = $if_is_lossy;
674+source extra/rpl_tests/check_type.inc;
675+
676+let $source_type = SET('0','1','2','3','4','5','6','7','8','9','10');
677+let $target_type = SET('0','1','2','3','4','5','6');
678+let $source_value = '7';
679+let $target_value = '';
680+let $can_convert = $if_is_lossy;
681+source extra/rpl_tests/check_type.inc;
682+
683+let $source_type = TINYINT;
684+let $target_type = TINYINT;
685+let $source_value = 1;
686+let $target_value = 1;
687+let $can_convert = 1;
688+source extra/rpl_tests/check_type.inc;
689+
690+let $source_type = TINYINT;
691+let $target_type = SMALLINT;
692+let $source_value = 1;
693+let $target_value = 1;
694+let $can_convert = $if_is_non_lossy;
695+source extra/rpl_tests/check_type.inc;
696+
697+let $source_type= TINYINT;
698+let $target_type= MEDIUMINT;
699+let $source_value= 1;
700+let $target_value= 1;
701+let $can_convert = $if_is_non_lossy;
702+source extra/rpl_tests/check_type.inc;
703+
704+let $source_type= TINYINT;
705+let $target_type= INT;
706+let $source_value= 1;
707+let $target_value= 1;
708+let $can_convert = $if_is_non_lossy;
709+source extra/rpl_tests/check_type.inc;
710+
711+let $source_type= TINYINT;
712+let $target_type= BIGINT;
713+let $source_value= 1;
714+let $target_value= 1;
715+let $can_convert = $if_is_non_lossy;
716+source extra/rpl_tests/check_type.inc;
717+
718+let $source_type= SMALLINT;
719+let $target_type= TINYINT;
720+let $source_value= 1;
721+let $target_value= 1;
722+let $can_convert = $if_is_lossy;
723+source extra/rpl_tests/check_type.inc;
724+
725+let $source_type= SMALLINT;
726+let $target_type= TINYINT;
727+let $source_value= 1 << 9;
728+let $target_value= (1 << 7) - 1;
729+let $can_convert = $if_is_lossy;
730+source extra/rpl_tests/check_type.inc;
731+
732+let $source_type= SMALLINT;
733+let $target_type= TINYINT UNSIGNED;
734+let $source_value= 1 << 9;
735+let $target_value= (1 << 8) - 1;
736+let $can_convert = $if_is_lossy;
737+source extra/rpl_tests/check_type.inc;
738+
739+let $source_type= SMALLINT;
740+let $target_type= SMALLINT;
741+let $source_value= 1;
742+let $target_value= 1;
743+let $can_convert = 1;
744+source extra/rpl_tests/check_type.inc;
745+
746+let $source_type= SMALLINT;
747+let $target_type= MEDIUMINT;
748+let $source_value= 1;
749+let $target_value= 1;
750+let $can_convert = $if_is_non_lossy;
751+source extra/rpl_tests/check_type.inc;
752+
753+let $source_type= SMALLINT;
754+let $target_type= INT;
755+let $source_value= 1;
756+let $target_value= 1;
757+let $can_convert = $if_is_non_lossy;
758+source extra/rpl_tests/check_type.inc;
759+
760+let $source_type= SMALLINT;
761+let $target_type= BIGINT;
762+let $source_value= 1;
763+let $target_value= 1;
764+let $can_convert = $if_is_non_lossy;
765+source extra/rpl_tests/check_type.inc;
766+
767+let $source_type= MEDIUMINT;
768+let $target_type= TINYINT;
769+let $source_value= 1;
770+let $target_value= 1;
771+let $can_convert = $if_is_lossy;
772+source extra/rpl_tests/check_type.inc;
773+
774+let $source_type= MEDIUMINT;
775+let $target_type= TINYINT;
776+let $source_value= 1 << 20;
777+let $target_value= (1 << 7) - 1;
778+let $can_convert = $if_is_lossy;
779+source extra/rpl_tests/check_type.inc;
780+
781+let $source_type= MEDIUMINT;
782+let $target_type= TINYINT UNSIGNED;
783+let $source_value= 1 << 20;
784+let $target_value= (1 << 8) - 1;
785+let $can_convert = $if_is_lossy;
786+source extra/rpl_tests/check_type.inc;
787+
788+let $source_type= MEDIUMINT;
789+let $target_type= SMALLINT;
790+let $source_value= 1;
791+let $target_value= 1;
792+let $can_convert = $if_is_lossy;
793+source extra/rpl_tests/check_type.inc;
794+
795+let $source_type= MEDIUMINT;
796+let $target_type= MEDIUMINT;
797+let $source_value= 1;
798+let $target_value= 1;
799+let $can_convert = 1;
800+source extra/rpl_tests/check_type.inc;
801+
802+let $source_type= MEDIUMINT;
803+let $target_type= INT;
804+let $source_value= 1;
805+let $target_value= 1;
806+let $can_convert = $if_is_non_lossy;
807+source extra/rpl_tests/check_type.inc;
808+
809+let $source_type= MEDIUMINT;
810+let $target_type= BIGINT;
811+let $source_value= 1;
812+let $target_value= 1;
813+let $can_convert = $if_is_non_lossy;
814+source extra/rpl_tests/check_type.inc;
815+
816+let $source_type= INT;
817+let $target_type= TINYINT;
818+let $source_value= 1;
819+let $target_value= 1;
820+let $can_convert = $if_is_lossy;
821+source extra/rpl_tests/check_type.inc;
822+
823+let $source_type= INT;
824+let $target_type= TINYINT;
825+let $source_value= (1 << 30);
826+let $target_value= (1 << 7) - 1;
827+let $can_convert = $if_is_lossy;
828+source extra/rpl_tests/check_type.inc;
829+
830+let $source_type= INT;
831+let $target_type= TINYINT UNSIGNED;
832+let $source_value= (1 << 30);
833+let $target_value= (1 << 8) - 1;
834+let $can_convert = $if_is_lossy;
835+source extra/rpl_tests/check_type.inc;
836+
837+let $source_type= INT;
838+let $target_type= SMALLINT;
839+let $source_value= 1;
840+let $target_value= 1;
841+let $can_convert = $if_is_lossy;
842+source extra/rpl_tests/check_type.inc;
843+
844+let $source_type= INT;
845+let $target_type= MEDIUMINT;
846+let $source_value= 1;
847+let $target_value= 1;
848+let $can_convert = $if_is_lossy;
849+source extra/rpl_tests/check_type.inc;
850+
851+let $source_type= INT;
852+let $target_type= INT;
853+let $source_value= 1;
854+let $target_value= 1;
855+let $can_convert = 1;
856+source extra/rpl_tests/check_type.inc;
857+
858+let $source_type= INT;
859+let $target_type= BIGINT;
860+let $source_value= 1;
861+let $target_value= 1;
862+let $can_convert = $if_is_non_lossy;
863+source extra/rpl_tests/check_type.inc;
864+
865+let $source_type= BIGINT;
866+let $target_type= TINYINT;
867+let $source_value= 1;
868+let $target_value= 1;
869+let $can_convert = $if_is_lossy;
870+source extra/rpl_tests/check_type.inc;
871+
872+let $source_type= BIGINT;
873+let $target_type= SMALLINT;
874+let $source_value= 1;
875+let $target_value= 1;
876+let $can_convert = $if_is_lossy;
877+source extra/rpl_tests/check_type.inc;
878+
879+let $source_type= BIGINT;
880+let $target_type= MEDIUMINT;
881+let $source_value= 1;
882+let $target_value= 1;
883+let $can_convert = $if_is_lossy;
884+source extra/rpl_tests/check_type.inc;
885+
886+let $source_type= BIGINT;
887+let $target_type= INT;
888+let $source_value= 1;
889+let $target_value= 1;
890+let $can_convert = $if_is_lossy;
891+source extra/rpl_tests/check_type.inc;
892+
893+let $source_type= BIGINT;
894+let $target_type= BIGINT;
895+let $source_value= 1;
896+let $target_value= 1;
897+let $can_convert = 1;
898+source extra/rpl_tests/check_type.inc;
899+
900+let $source_type= CHAR(20);
901+let $target_type= CHAR(20);
902+let $source_value= 'Smoothnoodlemaps';
903+let $target_value= 'Smoothnoodlemaps';
904+let $can_convert = 1;
905+source extra/rpl_tests/check_type.inc;
906+
907+let $source_type= CHAR(20);
908+let $target_type= CHAR(30);
909+let $source_value= 'Smoothnoodlemaps';
910+let $target_value= 'Smoothnoodlemaps';
911+let $can_convert = $if_is_non_lossy;
912+source extra/rpl_tests/check_type.inc;
913+
914+let $source_type= CHAR(20);
915+let $target_type= CHAR(10);
916+let $source_value= 'Smoothnoodlemaps';
917+let $target_value= 'Smoothnood';
918+let $can_convert = $if_is_lossy;
919+source extra/rpl_tests/check_type.inc;
920+
921+let $source_type= CHAR(20);
922+let $target_type= VARCHAR(20);
923+let $source_value= 'Smoothnoodlemaps';
924+let $target_value= 'Smoothnoodlemaps';
925+let $can_convert = $if_is_non_lossy;
926+source extra/rpl_tests/check_type.inc;
927+
928+let $source_type= CHAR(20);
929+let $target_type= VARCHAR(30);
930+let $source_value= 'Smoothnoodlemaps';
931+let $target_value= 'Smoothnoodlemaps';
932+let $can_convert = $if_is_non_lossy;
933+source extra/rpl_tests/check_type.inc;
934+
935+let $source_type= CHAR(20);
936+let $target_type= VARCHAR(10);
937+let $source_value= 'Smoothnoodlemaps';
938+let $target_value= 'Smoothnood';
939+let $can_convert = $if_is_lossy;
940+source extra/rpl_tests/check_type.inc;
941+
942+let $source_type= CHAR(20);
943+let $target_type= TINYTEXT;
944+let $source_value= 'Smoothnoodlemaps';
945+let $target_value= 'Smoothnoodlemaps';
946+let $can_convert = $if_is_non_lossy;
947+source extra/rpl_tests/check_type.inc;
948+
949+let $source_type= CHAR(20);
950+let $target_type= TEXT;
951+let $source_value= 'Smoothnoodlemaps';
952+let $target_value= 'Smoothnoodlemaps';
953+let $can_convert = $if_is_non_lossy;
954+source extra/rpl_tests/check_type.inc;
955+
956+let $source_type= CHAR(20);
957+let $target_type= MEDIUMTEXT;
958+let $source_value= 'Smoothnoodlemaps';
959+let $target_value= 'Smoothnoodlemaps';
960+let $can_convert = $if_is_non_lossy;
961+source extra/rpl_tests/check_type.inc;
962+
963+let $source_type= CHAR(20);
964+let $target_type= LONGTEXT;
965+let $source_value= 'Smoothnoodlemaps';
966+let $target_value= 'Smoothnoodlemaps';
967+let $can_convert = $if_is_non_lossy;
968+source extra/rpl_tests/check_type.inc;
969+
970+let $source_type= VARCHAR(20);
971+let $target_type= VARCHAR(20);
972+let $source_value= 'Smoothnoodlemaps';
973+let $target_value= 'Smoothnoodlemaps';
974+let $can_convert = 1;
975+source extra/rpl_tests/check_type.inc;
976+
977+let $source_type= VARCHAR(20);
978+let $target_type= VARCHAR(30);
979+let $source_value= 'Smoothnoodlemaps';
980+let $target_value= 'Smoothnoodlemaps';
981+let $can_convert = $if_is_non_lossy;
982+source extra/rpl_tests/check_type.inc;
983+
984+let $source_type= VARCHAR(20);
985+let $target_type= VARCHAR(10);
986+let $source_value= 'Smoothnoodlemaps';
987+let $target_value= 'Smoothnood';
988+let $can_convert = $if_is_lossy;
989+source extra/rpl_tests/check_type.inc;
990+
991+let $source_type= VARCHAR(20);
992+let $target_type= CHAR(30);
993+let $source_value= 'Smoothnoodlemaps';
994+let $target_value= 'Smoothnoodlemaps';
995+let $can_convert = $if_is_non_lossy;
996+source extra/rpl_tests/check_type.inc;
997+
998+let $source_type= VARCHAR(20);
999+let $target_type= CHAR(10);
1000+let $source_value= 'Smoothnoodlemaps';
1001+let $target_value= 'Smoothnood';
1002+let $can_convert = $if_is_lossy;
1003+source extra/rpl_tests/check_type.inc;
1004+
1005+let $source_type= VARCHAR(20);
1006+let $target_type= TINYTEXT;
1007+let $source_value= 'Smoothnoodlemaps';
1008+let $target_value= 'Smoothnoodlemaps';
1009+let $can_convert = $if_is_non_lossy;
1010+source extra/rpl_tests/check_type.inc;
1011+
1012+let $source_type= VARCHAR(20);
1013+let $target_type= TEXT;
1014+let $source_value= 'Smoothnoodlemaps';
1015+let $target_value= 'Smoothnoodlemaps';
1016+let $can_convert = $if_is_non_lossy;
1017+source extra/rpl_tests/check_type.inc;
1018+
1019+let $source_type= VARCHAR(20);
1020+let $target_type= MEDIUMTEXT;
1021+let $source_value= 'Smoothnoodlemaps';
1022+let $target_value= 'Smoothnoodlemaps';
1023+let $can_convert = $if_is_non_lossy;
1024+source extra/rpl_tests/check_type.inc;
1025+
1026+let $source_type= VARCHAR(20);
1027+let $target_type= LONGTEXT;
1028+let $source_value= 'Smoothnoodlemaps';
1029+let $target_value= 'Smoothnoodlemaps';
1030+let $can_convert = $if_is_non_lossy;
1031+source extra/rpl_tests/check_type.inc;
1032+
1033+let $blob = `select repeat('abcd', 125)`;
1034+let $truncated_blob = `select left('$blob', 255)`;
1035+
1036+let $source_type= VARCHAR(500);
1037+let $target_type= VARCHAR(500);
1038+let $source_value= '$blob';
1039+let $target_value= '$blob';
1040+let $can_convert = 1;
1041+source extra/rpl_tests/check_type.inc;
1042+
1043+let $source_type= VARCHAR(500);
1044+let $target_type= VARCHAR(510);
1045+let $source_value= '$blob';
1046+let $target_value= '$blob';
1047+let $can_convert = $if_is_non_lossy;
1048+source extra/rpl_tests/check_type.inc;
1049+
1050+let $source_type= VARCHAR(500);
1051+let $target_type= VARCHAR(255);
1052+let $source_value= '$blob';
1053+let $target_value= '$truncated_blob';
1054+let $can_convert = $if_is_lossy;
1055+source extra/rpl_tests/check_type.inc;
1056+
1057+let $source_type= VARCHAR(500);
1058+let $target_type= TINYTEXT;
1059+let $source_value= '$blob';
1060+let $target_value= '$truncated_blob';
1061+let $can_convert = $if_is_lossy;
1062+source extra/rpl_tests/check_type.inc;
1063+
1064+let $source_type= VARCHAR(500);
1065+let $target_type= TEXT;
1066+let $source_value= '$blob';
1067+let $target_value= '$blob';
1068+let $can_convert = $if_is_non_lossy;
1069+source extra/rpl_tests/check_type.inc;
1070+
1071+let $source_type= VARCHAR(500);
1072+let $target_type= MEDIUMTEXT;
1073+let $source_value= '$blob';
1074+let $target_value= '$blob';
1075+let $can_convert = $if_is_non_lossy;
1076+source extra/rpl_tests/check_type.inc;
1077+
1078+let $source_type= VARCHAR(500);
1079+let $target_type= LONGTEXT;
1080+let $source_value= '$blob';
1081+let $target_value= '$blob';
1082+let $can_convert = $if_is_non_lossy;
1083+source extra/rpl_tests/check_type.inc;
1084+
1085+let $tiny_blob = `select repeat('tiny blob ', 25)`;
1086+let $truncated_tiny_blob = `select left('$tiny_blob', 254)`;
1087+
1088+let $source_type= TINYTEXT;
1089+let $target_type= VARCHAR(500);
1090+let $source_value= '$tiny_blob';
1091+let $target_value= '$tiny_blob';
1092+let $can_convert = $if_is_non_lossy;
1093+source extra/rpl_tests/check_type.inc;
1094+
1095+let $source_type= TEXT;
1096+let $target_type= VARCHAR(500);
1097+let $source_value= '$blob';
1098+let $target_value= '$blob';
1099+let $can_convert = $if_is_lossy;
1100+source extra/rpl_tests/check_type.inc;
1101+
1102+let $source_type= MEDIUMTEXT;
1103+let $target_type= VARCHAR(500);
1104+let $source_value= '$blob';
1105+let $target_value= '$blob';
1106+let $can_convert = $if_is_lossy;
1107+source extra/rpl_tests/check_type.inc;
1108+
1109+let $source_type= LONGTEXT;
1110+let $target_type= VARCHAR(500);
1111+let $source_value= '$blob';
1112+let $target_value= '$blob';
1113+let $can_convert = $if_is_lossy;
1114+source extra/rpl_tests/check_type.inc;
1115+
1116+let $source_type= TINYTEXT;
1117+let $target_type= CHAR(255);
1118+let $source_value= '$tiny_blob';
1119+let $target_value= '$tiny_blob';
1120+let $can_convert = $if_is_non_lossy;
1121+source extra/rpl_tests/check_type.inc;
1122+
1123+let $source_type= TINYTEXT;
1124+let $target_type= CHAR(250);
1125+let $source_value= '$tiny_blob';
1126+let $target_value= left('$tiny_blob', 250);
1127+let $can_convert = $if_is_lossy;
1128+source extra/rpl_tests/check_type.inc;
1129+
1130+let $source_type= TEXT;
1131+let $target_type= CHAR(255);
1132+let $source_value= '$blob';
1133+let $target_value= left('$blob', 255);
1134+let $can_convert = $if_is_lossy;
1135+source extra/rpl_tests/check_type.inc;
1136+
1137+let $source_type= MEDIUMTEXT;
1138+let $target_type= CHAR(255);
1139+let $source_value= '$blob';
1140+let $target_value= left('$blob', 255);
1141+let $can_convert = $if_is_lossy;
1142+source extra/rpl_tests/check_type.inc;
1143+
1144+let $source_type= LONGTEXT;
1145+let $target_type= CHAR(255);
1146+let $source_value= '$blob';
1147+let $target_value= left('$blob', 255);
1148+let $can_convert = $if_is_lossy;
1149+source extra/rpl_tests/check_type.inc;
1150+
1151+let $source_type= TINYTEXT;
1152+let $target_type= TINYTEXT;
1153+let $source_value= '$tiny_blob';
1154+let $target_value= '$tiny_blob';
1155+let $can_convert = 1;
1156+source extra/rpl_tests/check_type.inc;
1157+
1158+let $source_type= TINYTEXT;
1159+let $target_type= TEXT;
1160+let $source_value= '$tiny_blob';
1161+let $target_value= '$tiny_blob';
1162+let $can_convert = $if_is_non_lossy;
1163+source extra/rpl_tests/check_type.inc;
1164+
1165+let $source_type= TEXT;
1166+let $target_type= TINYTEXT;
1167+let $source_value= '$blob';
1168+let $target_value= left('$blob',255);
1169+let $can_convert = $if_is_lossy;
1170+source extra/rpl_tests/check_type.inc;
1171+
1172+let $source_type= DECIMAL(10,5);
1173+let $target_type= DECIMAL(10,5);
1174+let $source_value= 3.14159;
1175+let $target_value= 3.14159;
1176+let $can_convert = 1;
1177+source extra/rpl_tests/check_type.inc;
1178+
1179+let $source_type= DECIMAL(10,5);
1180+let $target_type= DECIMAL(10,6);
1181+let $source_value= 3.14159;
1182+let $target_value= 3.141590;
1183+let $can_convert = $if_is_non_lossy;
1184+source extra/rpl_tests/check_type.inc;
1185+
1186+let $source_type= DECIMAL(10,5);
1187+let $target_type= DECIMAL(11,5);
1188+let $source_value= 3.14159;
1189+let $target_value= 3.14159;
1190+let $can_convert = $if_is_non_lossy;
1191+source extra/rpl_tests/check_type.inc;
1192+
1193+let $source_type= DECIMAL(10,5);
1194+let $target_type= DECIMAL(11,6);
1195+let $source_value= 3.14159;
1196+let $target_value= 3.141590;
1197+let $can_convert = $if_is_non_lossy;
1198+source extra/rpl_tests/check_type.inc;
1199+
1200+let $source_type= DECIMAL(10,5);
1201+let $target_type= DECIMAL(10,4);
1202+let $source_value= 3.14159;
1203+let $target_value= 3.1416;
1204+let $can_convert = $if_is_lossy;
1205+source extra/rpl_tests/check_type.inc;
1206+
1207+let $source_type= DECIMAL(10,5);
1208+let $target_type= DECIMAL(9,5);
1209+let $source_value= 3.14159;
1210+let $target_value= 3.14159;
1211+let $can_convert = $if_is_lossy;
1212+source extra/rpl_tests/check_type.inc;
1213+
1214+let $source_type= DECIMAL(10,5);
1215+let $target_type= DECIMAL(9,4);
1216+let $source_value= 3.14159;
1217+let $target_value= 3.1416;
1218+let $can_convert = $if_is_lossy;
1219+source extra/rpl_tests/check_type.inc;
1220+
1221+let $source_type= FLOAT;
1222+let $target_type= DECIMAL(10,5);
1223+let $source_value= 3.15625;
1224+let $target_value= 3.15625;
1225+let $can_convert = $if_is_lossy;
1226+source extra/rpl_tests/check_type.inc;
1227+
1228+let $source_type= DOUBLE;
1229+let $target_type= DECIMAL(10,5);
1230+let $source_value= 3.15625;
1231+let $target_value= 3.15625;
1232+let $can_convert = $if_is_lossy;
1233+source extra/rpl_tests/check_type.inc;
1234+
1235+let $source_type= DECIMAL(10,5);
1236+let $target_type= FLOAT;
1237+let $source_value= 3.15625;
1238+let $target_value= 3.15625;
1239+let $can_convert = $if_is_lossy;
1240+source extra/rpl_tests/check_type.inc;
1241+
1242+let $source_type= DECIMAL(10,5);
1243+let $target_type= DOUBLE;
1244+let $source_value= 3.15625;
1245+let $target_value= 3.15625;
1246+let $can_convert = $if_is_lossy;
1247+source extra/rpl_tests/check_type.inc;
1248+
1249+let $source_type= FLOAT;
1250+let $target_type= FLOAT;
1251+let $source_value= 3.15625;
1252+let $target_value= 3.15625;
1253+let $can_convert = 1;
1254+source extra/rpl_tests/check_type.inc;
1255+
1256+let $source_type= DOUBLE;
1257+let $target_type= DOUBLE;
1258+let $source_value= 3.15625;
1259+let $target_value= 3.15625;
1260+let $can_convert = 1;
1261+source extra/rpl_tests/check_type.inc;
1262+
1263+let $source_type= FLOAT;
1264+let $target_type= DOUBLE;
1265+let $source_value= 3.15625;
1266+let $target_value= 3.15625;
1267+let $can_convert = $if_is_non_lossy;
1268+source extra/rpl_tests/check_type.inc;
1269+
1270+let $source_type= DOUBLE;
1271+let $target_type= FLOAT;
1272+let $source_value= 3.15625;
1273+let $target_value= 3.15625;
1274+let $can_convert = $if_is_lossy;
1275+source extra/rpl_tests/check_type.inc;
1276+
1277+let $source_type= BIT(5);
1278+let $target_type= BIT(5);
1279+let $source_value= b'11001';
1280+let $target_value= b'11001';
1281+let $can_convert = 1;
1282+source extra/rpl_tests/check_type.inc;
1283+
1284+let $source_type= BIT(5);
1285+let $target_type= BIT(6);
1286+let $source_value= b'11001';
1287+let $target_value= b'11001';
1288+let $can_convert = $if_is_non_lossy;
1289+source extra/rpl_tests/check_type.inc;
1290+
1291+let $source_type= BIT(6);
1292+let $target_type= BIT(5);
1293+let $source_value= b'111001';
1294+let $target_value= b'11111';
1295+let $can_convert = $if_is_lossy;
1296+source extra/rpl_tests/check_type.inc;
1297+
1298+let $source_type= BIT(5);
1299+let $target_type= BIT(12);
1300+let $source_value= b'11001';
1301+let $target_value= b'11001';
1302+let $can_convert = $if_is_non_lossy;
1303+source extra/rpl_tests/check_type.inc;
1304+
1305+let $source_type= BIT(12);
1306+let $target_type= BIT(5);
1307+let $source_value= b'101100111000';
1308+let $target_value= b'11111';
1309+let $can_convert = $if_is_lossy;
1310+source extra/rpl_tests/check_type.inc;
1311+
1312+
1313+disable_warnings;
1314+source include/rpl_reset.inc;
1315+enable_warnings;
1316+enable_query_log;
1317
1318=== modified file 'Percona-Server/mysql-test/include/test_fieldsize.inc'
1319--- Percona-Server/mysql-test/include/test_fieldsize.inc 2010-05-24 13:54:08 +0000
1320+++ Percona-Server/mysql-test/include/test_fieldsize.inc 2012-02-22 07:32:24 +0000
1321@@ -22,7 +22,7 @@
1322
1323 connection slave;
1324 START SLAVE;
1325---let $slave_sql_errno= 1535
1326+--let $slave_sql_errno= 1677
1327 --let $show_slave_sql_error= 1
1328 --source include/wait_for_slave_sql_error.inc
1329
1330
1331=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_debug.result'
1332--- Percona-Server/mysql-test/r/percona_server_variables_debug.result 2012-02-22 07:32:22 +0000
1333+++ Percona-Server/mysql-test/r/percona_server_variables_debug.result 2012-02-22 07:32:24 +0000
1334@@ -293,6 +293,7 @@
1335 SLAVE_NET_TIMEOUT
1336 SLAVE_SKIP_ERRORS
1337 SLAVE_TRANSACTION_RETRIES
1338+SLAVE_TYPE_CONVERSIONS
1339 SLOW_LAUNCH_TIME
1340 SLOW_QUERY_LOG
1341 SLOW_QUERY_LOG_FILE
1342
1343=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_release.result'
1344--- Percona-Server/mysql-test/r/percona_server_variables_release.result 2012-02-22 07:32:22 +0000
1345+++ Percona-Server/mysql-test/r/percona_server_variables_release.result 2012-02-22 07:32:24 +0000
1346@@ -290,6 +290,7 @@
1347 SLAVE_NET_TIMEOUT
1348 SLAVE_SKIP_ERRORS
1349 SLAVE_TRANSACTION_RETRIES
1350+SLAVE_TYPE_CONVERSIONS
1351 SLOW_LAUNCH_TIME
1352 SLOW_QUERY_LOG
1353 SLOW_QUERY_LOG_FILE
1354
1355=== modified file 'Percona-Server/mysql-test/suite/binlog/r/binlog_base64_flag.result'
1356--- Percona-Server/mysql-test/suite/binlog/r/binlog_base64_flag.result 2011-02-23 09:31:37 +0000
1357+++ Percona-Server/mysql-test/suite/binlog/r/binlog_base64_flag.result 2012-02-22 07:32:24 +0000
1358@@ -93,6 +93,7 @@
1359 drop table t1, char63_utf8, char128_utf8;
1360 call mtr.add_suppression("Slave SQL.*master suffers from this bug: http:..bugs.mysql.com.bug.php.id=37426.* Error_code: 1105");
1361 call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535");
1362+call mtr.add_suppression("Slave SQL.*Column.*of table.*cannot be converted from type.*to type.* 1677");
1363 #
1364 # Bug #54393: crash and/or valgrind errors in
1365 # mysql_client_binlog_statement
1366
1367=== modified file 'Percona-Server/mysql-test/suite/binlog/t/binlog_base64_flag.test'
1368--- Percona-Server/mysql-test/suite/binlog/t/binlog_base64_flag.test 2011-02-23 09:31:37 +0000
1369+++ Percona-Server/mysql-test/suite/binlog/t/binlog_base64_flag.test 2012-02-22 07:32:24 +0000
1370@@ -153,6 +153,7 @@
1371
1372 call mtr.add_suppression("Slave SQL.*master suffers from this bug: http:..bugs.mysql.com.bug.php.id=37426.* Error_code: 1105");
1373 call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535");
1374+call mtr.add_suppression("Slave SQL.*Column.*of table.*cannot be converted from type.*to type.* 1677");
1375
1376 --echo #
1377 --echo # Bug #54393: crash and/or valgrind errors in
1378
1379=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_bug31076.result'
1380--- Percona-Server/mysql-test/suite/rpl/r/rpl_bug31076.result 2010-12-19 17:07:28 +0000
1381+++ Percona-Server/mysql-test/suite/rpl/r/rpl_bug31076.result 2012-02-22 07:32:24 +0000
1382@@ -1,5 +1,7 @@
1383 include/master-slave.inc
1384 [connection master]
1385+SET @saved_slave_type_conversions = @@slave_type_conversions;
1386+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
1387 CREATE DATABASE track;
1388 USE track;
1389 CREATE TABLE `visits` (
1390@@ -61,6 +63,7 @@
1391 SELECT * FROM visits_events;
1392 event_id visit_id timestamp src data visits_events_id
1393 20000 21231038 2007-09-18 03:59:02 Downloads/MySQL-4.1/mysql-4.1.12a-win32.zip 33712207
1394+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1395 DROP DATABASE track;
1396 End of 5.1 tests
1397 include/rpl_end.inc
1398
1399=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_colSize.result'
1400--- Percona-Server/mysql-test/suite/rpl/r/rpl_colSize.result 2010-12-19 17:07:28 +0000
1401+++ Percona-Server/mysql-test/suite/rpl/r/rpl_colSize.result 2012-02-22 07:32:24 +0000
1402@@ -5,6 +5,8 @@
1403 *** Create "wider" table on slave ***
1404 STOP SLAVE;
1405 RESET SLAVE;
1406+SET @saved_slave_type_conversions = @@slave_type_conversions;
1407+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
1408 CREATE TABLE t1 (
1409 a float (47),
1410 b double (143,9),
1411@@ -173,4 +175,5 @@
1412 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
1413 *** Cleanup ***
1414 DROP TABLE t1;
1415+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1416 include/rpl_end.inc
1417
1418=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result'
1419--- Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result 2011-03-31 08:33:07 +0000
1420+++ Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result 2012-02-22 07:32:24 +0000
1421@@ -457,11 +457,11 @@
1422 (3,@b1,DEFAULT,'QA',DEFAULT);
1423
1424 ********************************************
1425-*** Expect slave to fail with Error 1535 ***
1426+*** Expect slave to fail with Error 1677 ***
1427 ********************************************
1428
1429-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1430-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254'
1431+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1432+Last_SQL_Error = 'Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)''
1433
1434 *** Drop t10 ***
1435 DROP TABLE t10;
1436@@ -493,11 +493,11 @@
1437 (3,@b1,DEFAULT,'QA',DEFAULT);
1438
1439 ********************************************
1440-*** Expect slave to fail with Error 1535 ***
1441+*** Expect slave to fail with Error 1677 ***
1442 ********************************************
1443
1444-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1445-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15'
1446+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1447+Last_SQL_Error = 'Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)''
1448
1449 *** Drop t11 ***
1450 DROP TABLE t11;
1451@@ -1328,11 +1328,11 @@
1452 (3,@b1,DEFAULT,'QA',DEFAULT);
1453
1454 ********************************************
1455-*** Expect slave to fail with Error 1535 ***
1456+*** Expect slave to fail with Error 1677 ***
1457 ********************************************
1458
1459-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1460-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254'
1461+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1462+Last_SQL_Error = 'Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)''
1463
1464 *** Drop t10 ***
1465 DROP TABLE t10;
1466@@ -1364,11 +1364,11 @@
1467 (3,@b1,DEFAULT,'QA',DEFAULT);
1468
1469 ********************************************
1470-*** Expect slave to fail with Error 1535 ***
1471+*** Expect slave to fail with Error 1677 ***
1472 ********************************************
1473
1474-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1475-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15'
1476+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1477+Last_SQL_Error = 'Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)''
1478
1479 *** Drop t11 ***
1480 DROP TABLE t11;
1481@@ -2199,11 +2199,11 @@
1482 (3,@b1,DEFAULT,'QA',DEFAULT);
1483
1484 ********************************************
1485-*** Expect slave to fail with Error 1535 ***
1486+*** Expect slave to fail with Error 1677 ***
1487 ********************************************
1488
1489-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1490-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254'
1491+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1492+Last_SQL_Error = 'Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)''
1493
1494 *** Drop t10 ***
1495 DROP TABLE t10;
1496@@ -2235,11 +2235,11 @@
1497 (3,@b1,DEFAULT,'QA',DEFAULT);
1498
1499 ********************************************
1500-*** Expect slave to fail with Error 1535 ***
1501+*** Expect slave to fail with Error 1677 ***
1502 ********************************************
1503
1504-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1505-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15'
1506+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1507+Last_SQL_Error = 'Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)''
1508
1509 *** Drop t11 ***
1510 DROP TABLE t11;
1511
1512=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result'
1513--- Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result 2011-03-31 08:33:07 +0000
1514+++ Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result 2012-02-22 07:32:24 +0000
1515@@ -457,11 +457,11 @@
1516 (3,@b1,DEFAULT,'QA',DEFAULT);
1517
1518 ********************************************
1519-*** Expect slave to fail with Error 1535 ***
1520+*** Expect slave to fail with Error 1677 ***
1521 ********************************************
1522
1523-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1524-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254'
1525+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1526+Last_SQL_Error = 'Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)''
1527
1528 *** Drop t10 ***
1529 DROP TABLE t10;
1530@@ -493,11 +493,11 @@
1531 (3,@b1,DEFAULT,'QA',DEFAULT);
1532
1533 ********************************************
1534-*** Expect slave to fail with Error 1535 ***
1535+*** Expect slave to fail with Error 1677 ***
1536 ********************************************
1537
1538-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1539-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15'
1540+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1541+Last_SQL_Error = 'Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)''
1542
1543 *** Drop t11 ***
1544 DROP TABLE t11;
1545@@ -1328,11 +1328,11 @@
1546 (3,@b1,DEFAULT,'QA',DEFAULT);
1547
1548 ********************************************
1549-*** Expect slave to fail with Error 1535 ***
1550+*** Expect slave to fail with Error 1677 ***
1551 ********************************************
1552
1553-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1554-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254'
1555+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1556+Last_SQL_Error = 'Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)''
1557
1558 *** Drop t10 ***
1559 DROP TABLE t10;
1560@@ -1364,11 +1364,11 @@
1561 (3,@b1,DEFAULT,'QA',DEFAULT);
1562
1563 ********************************************
1564-*** Expect slave to fail with Error 1535 ***
1565+*** Expect slave to fail with Error 1677 ***
1566 ********************************************
1567
1568-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1569-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15'
1570+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1571+Last_SQL_Error = 'Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)''
1572
1573 *** Drop t11 ***
1574 DROP TABLE t11;
1575@@ -2199,11 +2199,11 @@
1576 (3,@b1,DEFAULT,'QA',DEFAULT);
1577
1578 ********************************************
1579-*** Expect slave to fail with Error 1535 ***
1580+*** Expect slave to fail with Error 1677 ***
1581 ********************************************
1582
1583-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1584-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254'
1585+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1586+Last_SQL_Error = 'Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)''
1587
1588 *** Drop t10 ***
1589 DROP TABLE t10;
1590@@ -2235,11 +2235,11 @@
1591 (3,@b1,DEFAULT,'QA',DEFAULT);
1592
1593 ********************************************
1594-*** Expect slave to fail with Error 1535 ***
1595+*** Expect slave to fail with Error 1677 ***
1596 ********************************************
1597
1598-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1599-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15'
1600+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1601+Last_SQL_Error = 'Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)''
1602
1603 *** Drop t11 ***
1604 DROP TABLE t11;
1605
1606=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result'
1607--- Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result 2011-02-23 09:31:37 +0000
1608+++ Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result 2012-02-22 07:32:24 +0000
1609@@ -5,6 +5,8 @@
1610 *** On Slave ***
1611 STOP SLAVE;
1612 RESET SLAVE;
1613+SET @saved_slave_type_conversions = @@slave_type_conversions;
1614+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
1615 CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
1616 d FLOAT DEFAULT '2.00',
1617 e CHAR(4) DEFAULT 'TEST')
1618@@ -28,6 +30,7 @@
1619 1 2 TEXAS 2 TEST
1620 2 1 AUSTIN 2 TEST
1621 3 4 QA 2 TEST
1622+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1623 *** Drop t1 ***
1624 DROP TABLE t1;
1625 *** Create t2 on slave ***
1626@@ -50,8 +53,8 @@
1627 3 4 QA TESTING
1628 *** Start Slave ***
1629 START SLAVE;
1630-include/wait_for_slave_sql_error.inc [errno=1535]
1631-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.'
1632+include/wait_for_slave_sql_error.inc [errno=1677]
1633+Last_SQL_Error = 'Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)''
1634 STOP SLAVE;
1635 RESET SLAVE;
1636 SELECT * FROM t2 ORDER BY a;
1637@@ -78,10 +81,10 @@
1638 set @b1 = concat(@b1,@b1);
1639 INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
1640 ********************************************
1641-*** Expect slave to fail with Error 1535 ***
1642+*** Expect slave to fail with Error 1677 ***
1643 ********************************************
1644-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1645-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3'
1646+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1647+Last_SQL_Error = 'Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)''
1648 *** Drop t3 ***
1649 DROP TABLE t3;
1650 *** Create t4 on slave ***
1651@@ -101,10 +104,10 @@
1652 INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
1653 (30000.22,4,'QA TESTING');
1654 ********************************************
1655-*** Expect slave to fail with Error 1535 ***
1656+*** Expect slave to fail with Error 1677 ***
1657 ********************************************
1658-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1659-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3'
1660+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1661+Last_SQL_Error = 'Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)''
1662 *** Drop t4 ***
1663 DROP TABLE t4;
1664 *** Create t5 on slave ***
1665@@ -124,10 +127,10 @@
1666 INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
1667 (2,'JOE',300.01,0,'b2b2',1.0000009);
1668 ********************************************
1669-*** Expect slave to fail with Error 1535 ***
1670+*** Expect slave to fail with Error 1677 ***
1671 ********************************************
1672-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1673-Last_SQL_Error = 'Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246'
1674+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1675+Last_SQL_Error = 'Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)''
1676 *** Drop t5 ***
1677 DROP TABLE t5;
1678 *** Create t6 on slave ***
1679@@ -146,10 +149,10 @@
1680 INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
1681 (2,'JOE',300.01,0);
1682 ********************************************
1683-*** Expect slave to fail with Error 1535 ***
1684+*** Expect slave to fail with Error 1677 ***
1685 ********************************************
1686-include/wait_for_slave_sql_error.inc [errno=1535]
1687-Last_SQL_Error = 'Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3'
1688+include/wait_for_slave_sql_error.inc [errno=1677]
1689+Last_SQL_Error = 'Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)''
1690 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
1691 *** Drop t6 ***
1692 DROP TABLE t6;
1693@@ -246,16 +249,16 @@
1694 set @b1 = concat(@b1,@b1);
1695 INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
1696 ********************************************
1697-*** Expect slave to fail with Error 1535 ***
1698+*** Expect slave to fail with Error 1677 ***
1699 ********************************************
1700-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1701-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5'
1702+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1703+Last_SQL_Error = 'Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double''
1704 *** Drop t10 ***
1705 DROP TABLE t10;
1706 *** Create t11 on slave ***
1707 STOP SLAVE;
1708 RESET SLAVE;
1709-CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
1710+CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
1711 c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='InnoDB';
1712 *** Create t11 on Master ***
1713 CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
1714@@ -268,10 +271,10 @@
1715 set @b1 = concat(@b1,@b1);
1716 INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
1717 ********************************************
1718-*** Expect slave to fail with Error 1535 ***
1719+*** Expect slave to fail with Error 1677 ***
1720 ********************************************
1721-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1722-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252'
1723+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1724+Last_SQL_Error = 'Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)''
1725 *** Drop t11 ***
1726 DROP TABLE t11;
1727 *** Create t12 on slave ***
1728@@ -584,10 +587,10 @@
1729 *** Master Data Insert ***
1730 INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
1731 ********************************************
1732-*** Expect slave to fail with Error 1535 ***
1733+*** Expect slave to fail with Error 1677 ***
1734 ********************************************
1735-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1736-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2'
1737+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1738+Last_SQL_Error = 'Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)''
1739 ** DROP table t17 ***
1740 DROP TABLE t17;
1741 include/rpl_end.inc
1742
1743=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result'
1744--- Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result 2011-02-23 09:31:37 +0000
1745+++ Percona-Server/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result 2012-02-22 07:32:24 +0000
1746@@ -5,6 +5,8 @@
1747 *** On Slave ***
1748 STOP SLAVE;
1749 RESET SLAVE;
1750+SET @saved_slave_type_conversions = @@slave_type_conversions;
1751+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
1752 CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
1753 d FLOAT DEFAULT '2.00',
1754 e CHAR(4) DEFAULT 'TEST')
1755@@ -28,6 +30,7 @@
1756 1 2 TEXAS 2 TEST
1757 2 1 AUSTIN 2 TEST
1758 3 4 QA 2 TEST
1759+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1760 *** Drop t1 ***
1761 DROP TABLE t1;
1762 *** Create t2 on slave ***
1763@@ -50,8 +53,8 @@
1764 3 4 QA TESTING
1765 *** Start Slave ***
1766 START SLAVE;
1767-include/wait_for_slave_sql_error.inc [errno=1535]
1768-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.'
1769+include/wait_for_slave_sql_error.inc [errno=1677]
1770+Last_SQL_Error = 'Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)''
1771 STOP SLAVE;
1772 RESET SLAVE;
1773 SELECT * FROM t2 ORDER BY a;
1774@@ -78,10 +81,10 @@
1775 set @b1 = concat(@b1,@b1);
1776 INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
1777 ********************************************
1778-*** Expect slave to fail with Error 1535 ***
1779+*** Expect slave to fail with Error 1677 ***
1780 ********************************************
1781-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1782-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3'
1783+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1784+Last_SQL_Error = 'Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)''
1785 *** Drop t3 ***
1786 DROP TABLE t3;
1787 *** Create t4 on slave ***
1788@@ -101,10 +104,10 @@
1789 INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
1790 (30000.22,4,'QA TESTING');
1791 ********************************************
1792-*** Expect slave to fail with Error 1535 ***
1793+*** Expect slave to fail with Error 1677 ***
1794 ********************************************
1795-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1796-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3'
1797+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1798+Last_SQL_Error = 'Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)''
1799 *** Drop t4 ***
1800 DROP TABLE t4;
1801 *** Create t5 on slave ***
1802@@ -124,10 +127,10 @@
1803 INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
1804 (2,'JOE',300.01,0,'b2b2',1.0000009);
1805 ********************************************
1806-*** Expect slave to fail with Error 1535 ***
1807+*** Expect slave to fail with Error 1677 ***
1808 ********************************************
1809-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1810-Last_SQL_Error = 'Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246'
1811+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1812+Last_SQL_Error = 'Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)''
1813 *** Drop t5 ***
1814 DROP TABLE t5;
1815 *** Create t6 on slave ***
1816@@ -146,10 +149,10 @@
1817 INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
1818 (2,'JOE',300.01,0);
1819 ********************************************
1820-*** Expect slave to fail with Error 1535 ***
1821+*** Expect slave to fail with Error 1677 ***
1822 ********************************************
1823-include/wait_for_slave_sql_error.inc [errno=1535]
1824-Last_SQL_Error = 'Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3'
1825+include/wait_for_slave_sql_error.inc [errno=1677]
1826+Last_SQL_Error = 'Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)''
1827 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
1828 *** Drop t6 ***
1829 DROP TABLE t6;
1830@@ -246,16 +249,16 @@
1831 set @b1 = concat(@b1,@b1);
1832 INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
1833 ********************************************
1834-*** Expect slave to fail with Error 1535 ***
1835+*** Expect slave to fail with Error 1677 ***
1836 ********************************************
1837-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1838-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5'
1839+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1840+Last_SQL_Error = 'Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double''
1841 *** Drop t10 ***
1842 DROP TABLE t10;
1843 *** Create t11 on slave ***
1844 STOP SLAVE;
1845 RESET SLAVE;
1846-CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
1847+CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
1848 c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
1849 *** Create t11 on Master ***
1850 CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
1851@@ -268,10 +271,10 @@
1852 set @b1 = concat(@b1,@b1);
1853 INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
1854 ********************************************
1855-*** Expect slave to fail with Error 1535 ***
1856+*** Expect slave to fail with Error 1677 ***
1857 ********************************************
1858-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1859-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252'
1860+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1861+Last_SQL_Error = 'Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)''
1862 *** Drop t11 ***
1863 DROP TABLE t11;
1864 *** Create t12 on slave ***
1865@@ -584,10 +587,10 @@
1866 *** Master Data Insert ***
1867 INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
1868 ********************************************
1869-*** Expect slave to fail with Error 1535 ***
1870+*** Expect slave to fail with Error 1677 ***
1871 ********************************************
1872-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
1873-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2'
1874+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
1875+Last_SQL_Error = 'Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)''
1876 ** DROP table t17 ***
1877 DROP TABLE t17;
1878 include/rpl_end.inc
1879
1880=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result'
1881--- Percona-Server/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result 2011-02-23 09:31:37 +0000
1882+++ Percona-Server/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result 2012-02-22 07:32:24 +0000
1883@@ -467,6 +467,8 @@
1884 CREATE TABLE t7 (i INT NOT NULL,
1885 c CHAR(255) CHARACTER SET utf8 NOT NULL,
1886 j INT NOT NULL) ENGINE = 'MYISAM' ;
1887+SET @saved_slave_type_conversions = @@slave_type_conversions;
1888+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
1889 [expecting slave to replicate correctly]
1890 INSERT INTO t1 VALUES (1, "", 1);
1891 INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
1892@@ -475,13 +477,7 @@
1893 INSERT INTO t2 VALUES (1, "", 1);
1894 INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
1895 include/diff_tables.inc [master:t2, slave:t2]
1896-[expecting slave to stop]
1897-INSERT INTO t3 VALUES (1, "", 1);
1898-INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
1899-call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535");
1900 call mtr.add_suppression("Slave SQL.*Could not execute Delete_rows event on table test.t1.* Error_code: 1032");
1901-include/wait_for_slave_sql_error.inc [errno=1535]
1902-Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.'
1903 include/rpl_reset.inc
1904 [expecting slave to replicate correctly]
1905 INSERT INTO t4 VALUES (1, "", 1);
1906@@ -490,14 +486,14 @@
1907 [expecting slave to stop]
1908 INSERT INTO t5 VALUES (1, "", 1);
1909 INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
1910-include/wait_for_slave_sql_error.inc [errno=1535]
1911-Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.'
1912+include/wait_for_slave_sql_error.inc [errno=1677 ]
1913+Last_SQL_Error = 'Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)''
1914 include/rpl_reset.inc
1915 [expecting slave to stop]
1916 INSERT INTO t6 VALUES (1, "", 1);
1917 INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
1918-include/wait_for_slave_sql_error.inc [errno=1535]
1919-Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.'
1920+include/wait_for_slave_sql_error.inc [errno=1677 ]
1921+Last_SQL_Error = 'Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)''
1922 include/rpl_reset.inc
1923 [expecting slave to replicate correctly]
1924 INSERT INTO t7 VALUES (1, "", 1);
1925
1926=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result'
1927--- Percona-Server/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result 2011-02-23 09:31:37 +0000
1928+++ Percona-Server/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result 2012-02-22 07:32:24 +0000
1929@@ -350,6 +350,8 @@
1930 X Q 5 7 R 49 X Z 2 S 2
1931 X Q 5 9 R 81 X Y 2 S 1
1932 X Q 5 9 R 81 X Z 2 S 2
1933+SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
1934+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY';
1935 CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = 'INNODB' ;
1936 INSERT INTO t4 SET C1 = 1;
1937 SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
1938@@ -358,6 +360,7 @@
1939 SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
1940 C1 HEX(B1) HEX(B2)
1941 1 NULL 0
1942+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1943 CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'INNODB' ;
1944 --- on slave: original values ---
1945 INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
1946@@ -467,6 +470,8 @@
1947 CREATE TABLE t7 (i INT NOT NULL,
1948 c CHAR(255) CHARACTER SET utf8 NOT NULL,
1949 j INT NOT NULL) ENGINE = 'INNODB' ;
1950+SET @saved_slave_type_conversions = @@slave_type_conversions;
1951+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
1952 [expecting slave to replicate correctly]
1953 INSERT INTO t1 VALUES (1, "", 1);
1954 INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
1955@@ -475,13 +480,7 @@
1956 INSERT INTO t2 VALUES (1, "", 1);
1957 INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
1958 include/diff_tables.inc [master:t2, slave:t2]
1959-[expecting slave to stop]
1960-INSERT INTO t3 VALUES (1, "", 1);
1961-INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
1962-call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535");
1963 call mtr.add_suppression("Slave SQL.*Could not execute Delete_rows event on table test.t1.* Error_code: 1032");
1964-include/wait_for_slave_sql_error.inc [errno=1535]
1965-Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.'
1966 include/rpl_reset.inc
1967 [expecting slave to replicate correctly]
1968 INSERT INTO t4 VALUES (1, "", 1);
1969@@ -490,14 +489,14 @@
1970 [expecting slave to stop]
1971 INSERT INTO t5 VALUES (1, "", 1);
1972 INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
1973-include/wait_for_slave_sql_error.inc [errno=1535]
1974-Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.'
1975+include/wait_for_slave_sql_error.inc [errno=1677 ]
1976+Last_SQL_Error = 'Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)''
1977 include/rpl_reset.inc
1978 [expecting slave to stop]
1979 INSERT INTO t6 VALUES (1, "", 1);
1980 INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
1981-include/wait_for_slave_sql_error.inc [errno=1535]
1982-Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.'
1983+include/wait_for_slave_sql_error.inc [errno=1677 ]
1984+Last_SQL_Error = 'Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)''
1985 include/rpl_reset.inc
1986 [expecting slave to replicate correctly]
1987 INSERT INTO t7 VALUES (1, "", 1);
1988@@ -581,6 +580,8 @@
1989 UPDATE t1 SET a = 8 WHERE a < 5;
1990 include/diff_tables.inc [master:t1, slave:t1]
1991 drop table t1;
1992+SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
1993+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY';
1994 CREATE TABLE t1 (a bit) ENGINE='INNODB' ;
1995 INSERT IGNORE INTO t1 VALUES (NULL);
1996 INSERT INTO t1 ( a ) VALUES ( 0 );
1997@@ -621,6 +622,7 @@
1998 UPDATE t1 SET a = 8 WHERE a = 5 LIMIT 2;
1999 INSERT INTO t1 ( a ) VALUES ( 1 );
2000 UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3;
2001+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
2002 include/diff_tables.inc [master:t1, slave:t1]
2003 drop table t1;
2004 include/rpl_end.inc
2005
2006=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_row_colSize.result'
2007--- Percona-Server/mysql-test/suite/rpl/r/rpl_row_colSize.result 2011-02-23 09:31:37 +0000
2008+++ Percona-Server/mysql-test/suite/rpl/r/rpl_row_colSize.result 2012-02-22 07:32:24 +0000
2009@@ -14,8 +14,8 @@
2010 RESET MASTER;
2011 INSERT INTO t1 VALUES (901251.90125);
2012 START SLAVE;
2013-include/wait_for_slave_sql_error.inc [errno=1535]
2014-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size.'
2015+include/wait_for_slave_sql_error.inc [errno=1677]
2016+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)''
2017 SELECT COUNT(*) FROM t1;
2018 COUNT(*)
2019 0
2020@@ -31,8 +31,8 @@
2021 RESET MASTER;
2022 INSERT INTO t1 VALUES (901251.90125);
2023 START SLAVE;
2024-include/wait_for_slave_sql_error.inc [errno=1535]
2025-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 12, test.t1 on slave has size 12. Master's column size should be <= the slave's column size.'
2026+include/wait_for_slave_sql_error.inc [errno=1677]
2027+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'decimal(27,18)' to type 'decimal(27,9)''
2028 SELECT COUNT(*) FROM t1;
2029 COUNT(*)
2030 0
2031@@ -48,8 +48,8 @@
2032 RESET MASTER;
2033 INSERT INTO t1 VALUES (901251.90125);
2034 START SLAVE;
2035-include/wait_for_slave_sql_error.inc [errno=1535]
2036-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size.'
2037+include/wait_for_slave_sql_error.inc [errno=1677]
2038+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)''
2039 SELECT COUNT(*) FROM t1;
2040 COUNT(*)
2041 0
2042@@ -66,8 +66,8 @@
2043 RESET MASTER;
2044 INSERT INTO t1 VALUES (901251.90125);
2045 START SLAVE;
2046-include/wait_for_slave_sql_error.inc [errno=1535]
2047-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 5, test.t1 has type 4'
2048+include/wait_for_slave_sql_error.inc [errno=1677]
2049+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'double' to type 'float''
2050 SELECT COUNT(*) FROM t1;
2051 COUNT(*)
2052 0
2053@@ -84,8 +84,8 @@
2054 RESET MASTER;
2055 INSERT INTO t1 VALUES (B'10101');
2056 START SLAVE;
2057-include/wait_for_slave_sql_error.inc [errno=1535]
2058-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 8, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.'
2059+include/wait_for_slave_sql_error.inc [errno=1677]
2060+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'bit(64)' to type 'bit(5)''
2061 SELECT COUNT(*) FROM t1;
2062 COUNT(*)
2063 0
2064@@ -101,8 +101,8 @@
2065 RESET MASTER;
2066 INSERT INTO t1 VALUES (B'10101');
2067 START SLAVE;
2068-include/wait_for_slave_sql_error.inc [errno=1535]
2069-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 2. Master's column size should be <= the slave's column size.'
2070+include/wait_for_slave_sql_error.inc [errno=1677]
2071+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'bit(12)' to type 'bit(11)''
2072 SELECT COUNT(*) FROM t1;
2073 COUNT(*)
2074 0
2075@@ -119,8 +119,8 @@
2076 RESET MASTER;
2077 INSERT INTO t1 VALUES ('4');
2078 START SLAVE;
2079-include/wait_for_slave_sql_error.inc [errno=1535]
2080-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.'
2081+include/wait_for_slave_sql_error.inc [errno=1677]
2082+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'set' to type 'set('4')''
2083 SELECT COUNT(*) FROM t1;
2084 COUNT(*)
2085 0
2086@@ -137,8 +137,8 @@
2087 RESET MASTER;
2088 INSERT INTO t1 VALUES ('This is a test.');
2089 START SLAVE;
2090-include/wait_for_slave_sql_error.inc [errno=1535]
2091-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 20, test.t1 on slave has size 11. Master's column size should be <= the slave's column size.'
2092+include/wait_for_slave_sql_error.inc [errno=1677]
2093+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'char(20)' to type 'char(10)''
2094 SELECT COUNT(*) FROM t1;
2095 COUNT(*)
2096 0
2097@@ -186,8 +186,8 @@
2098 RESET MASTER;
2099 INSERT INTO t1 VALUES ('44');
2100 START SLAVE;
2101-include/wait_for_slave_sql_error.inc [errno=1535]
2102-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.'
2103+include/wait_for_slave_sql_error.inc [errno=1677]
2104+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'enum' to type 'enum('44','54')''
2105 SELECT COUNT(*) FROM t1;
2106 COUNT(*)
2107 0
2108@@ -204,8 +204,8 @@
2109 RESET MASTER;
2110 INSERT INTO t1 VALUES ('This is a test.');
2111 START SLAVE;
2112-include/wait_for_slave_sql_error.inc [errno=1535]
2113-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 100. Master's column size should be <= the slave's column size.'
2114+include/wait_for_slave_sql_error.inc [errno=1677]
2115+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(100)''
2116 SELECT COUNT(*) FROM t1;
2117 COUNT(*)
2118 0
2119@@ -221,8 +221,8 @@
2120 RESET MASTER;
2121 INSERT INTO t1 VALUES ('This is a test.');
2122 START SLAVE;
2123-include/wait_for_slave_sql_error.inc [errno=1535]
2124-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 200, test.t1 on slave has size 10. Master's column size should be <= the slave's column size.'
2125+include/wait_for_slave_sql_error.inc [errno=1677]
2126+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'varchar(200)' to type 'varchar(10)''
2127 SELECT COUNT(*) FROM t1;
2128 COUNT(*)
2129 0
2130@@ -238,8 +238,8 @@
2131 RESET MASTER;
2132 INSERT INTO t1 VALUES ('This is a test.');
2133 START SLAVE;
2134-include/wait_for_slave_sql_error.inc [errno=1535]
2135-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 1000. Master's column size should be <= the slave's column size.'
2136+include/wait_for_slave_sql_error.inc [errno=1677]
2137+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(1000)''
2138 SELECT COUNT(*) FROM t1;
2139 COUNT(*)
2140 0
2141@@ -256,8 +256,8 @@
2142 RESET MASTER;
2143 INSERT INTO t1 VALUES ('This is a test.');
2144 START SLAVE;
2145-include/wait_for_slave_sql_error.inc [errno=1535]
2146-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 size mismatch - master has size 4, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.'
2147+include/wait_for_slave_sql_error.inc [errno=1677]
2148+Last_SQL_Error = 'Column 0 of table 'test.t1' cannot be converted from type 'tinyblob' to type 'tinyblob''
2149 SELECT COUNT(*) FROM t1;
2150 COUNT(*)
2151 0
2152
2153=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result'
2154--- Percona-Server/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result 2011-02-23 09:31:37 +0000
2155+++ Percona-Server/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result 2012-02-22 07:32:24 +0000
2156@@ -117,17 +117,17 @@
2157 include/check_slave_is_running.inc
2158 INSERT INTO t9 VALUES (4);
2159 INSERT INTO t4 VALUES (4);
2160-call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column [012] type mismatch.* Error_code: 1535");
2161-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
2162-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4'
2163+call mtr.add_suppression("Slave SQL.*Column.*of table.*cannot be converted from type.*to type.* 1677");
2164+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
2165+Last_SQL_Error = 'Column 0 of table 'test.t4' cannot be converted from type 'int' to type 'float''
2166 INSERT INTO t9 VALUES (5);
2167 INSERT INTO t5 VALUES (5,10,25);
2168-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
2169-Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4'
2170+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
2171+Last_SQL_Error = 'Column 1 of table 'test.t5' cannot be converted from type 'int' to type 'float''
2172 INSERT INTO t9 VALUES (6);
2173 INSERT INTO t6 VALUES (6,12,36);
2174-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
2175-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4'
2176+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
2177+Last_SQL_Error = 'Column 2 of table 'test.t6' cannot be converted from type 'int' to type 'float''
2178 INSERT INTO t9 VALUES (6);
2179 include/check_slave_is_running.inc
2180 INSERT INTO t7 VALUES (1),(2),(3);
2181
2182=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result'
2183--- Percona-Server/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result 2011-02-23 09:31:37 +0000
2184+++ Percona-Server/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result 2012-02-22 07:32:24 +0000
2185@@ -117,17 +117,17 @@
2186 include/check_slave_is_running.inc
2187 INSERT INTO t9 VALUES (4);
2188 INSERT INTO t4 VALUES (4);
2189-call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column [012] type mismatch.* Error_code: 1535");
2190-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
2191-Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4'
2192+call mtr.add_suppression("Slave SQL.*Column.*of table.*cannot be converted from type.*to type.* 1677");
2193+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
2194+Last_SQL_Error = 'Column 0 of table 'test.t4' cannot be converted from type 'int' to type 'float''
2195 INSERT INTO t9 VALUES (5);
2196 INSERT INTO t5 VALUES (5,10,25);
2197-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
2198-Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4'
2199+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
2200+Last_SQL_Error = 'Column 1 of table 'test.t5' cannot be converted from type 'int' to type 'float''
2201 INSERT INTO t9 VALUES (6);
2202 INSERT INTO t6 VALUES (6,12,36);
2203-include/wait_for_slave_sql_error_and_skip.inc [errno=1535]
2204-Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4'
2205+include/wait_for_slave_sql_error_and_skip.inc [errno=1677]
2206+Last_SQL_Error = 'Column 2 of table 'test.t6' cannot be converted from type 'int' to type 'float''
2207 INSERT INTO t9 VALUES (6);
2208 include/check_slave_is_running.inc
2209 INSERT INTO t7 VALUES (1),(2),(3);
2210
2211=== added file 'Percona-Server/mysql-test/suite/rpl/r/rpl_typeconv.result'
2212--- Percona-Server/mysql-test/suite/rpl/r/rpl_typeconv.result 1970-01-01 00:00:00 +0000
2213+++ Percona-Server/mysql-test/suite/rpl/r/rpl_typeconv.result 2012-02-22 07:32:24 +0000
2214@@ -0,0 +1,539 @@
2215+include/master-slave.inc
2216+[connection master]
2217+set @saved_slave_type_conversions = @@global.slave_type_conversions;
2218+CREATE TABLE type_conversions (
2219+TestNo INT AUTO_INCREMENT PRIMARY KEY,
2220+Source TEXT,
2221+Target TEXT,
2222+Flags TEXT,
2223+On_Master TEXT,
2224+On_Slave TEXT,
2225+Expected TEXT,
2226+Compare INT,
2227+Error TEXT);
2228+SELECT @@global.slave_type_conversions;
2229+@@global.slave_type_conversions
2230+
2231+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
2232+SELECT @@global.slave_type_conversions;
2233+@@global.slave_type_conversions
2234+
2235+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
2236+SELECT @@global.slave_type_conversions;
2237+@@global.slave_type_conversions
2238+ALL_NON_LOSSY
2239+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
2240+SELECT @@global.slave_type_conversions;
2241+@@global.slave_type_conversions
2242+ALL_LOSSY
2243+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
2244+SELECT @@global.slave_type_conversions;
2245+@@global.slave_type_conversions
2246+ALL_LOSSY,ALL_NON_LOSSY
2247+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT';
2248+ERROR 42000: Variable 'slave_type_conversions' can't be set to the value of 'NONEXISTING_BIT'
2249+SELECT @@global.slave_type_conversions;
2250+@@global.slave_type_conversions
2251+ALL_LOSSY,ALL_NON_LOSSY
2252+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
2253+**** Running tests with @@SLAVE_TYPE_CONVERSIONS = '' ****
2254+include/rpl_reset.inc
2255+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
2256+**** Running tests with @@SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY' ****
2257+include/rpl_reset.inc
2258+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
2259+**** Running tests with @@SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY' ****
2260+include/rpl_reset.inc
2261+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
2262+**** Running tests with @@SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY,ALL_NON_LOSSY' ****
2263+include/rpl_reset.inc
2264+**** Result of conversions ****
2265+Source_Type Target_Type All_Type_Conversion_Flags Value_On_Slave
2266+TINYBLOB TINYBLOB <Correct value>
2267+TINYBLOB BLOB <Correct error>
2268+TINYBLOB MEDIUMBLOB <Correct error>
2269+TINYBLOB LONGBLOB <Correct error>
2270+BLOB TINYBLOB <Correct error>
2271+BLOB BLOB <Correct value>
2272+BLOB MEDIUMBLOB <Correct error>
2273+BLOB LONGBLOB <Correct error>
2274+MEDIUMBLOB TINYBLOB <Correct error>
2275+MEDIUMBLOB BLOB <Correct error>
2276+MEDIUMBLOB MEDIUMBLOB <Correct value>
2277+MEDIUMBLOB LONGBLOB <Correct error>
2278+LONGBLOB TINYBLOB <Correct error>
2279+LONGBLOB BLOB <Correct error>
2280+LONGBLOB MEDIUMBLOB <Correct error>
2281+LONGBLOB LONGBLOB <Correct value>
2282+GEOMETRY BLOB <Correct error>
2283+BLOB GEOMETRY <Correct error>
2284+GEOMETRY GEOMETRY <Correct value>
2285+BIT(1) BIT(1) <Correct value>
2286+DATE DATE <Correct value>
2287+ENUM('master',' ENUM('master',' <Correct value>
2288+CHAR(10) ENUM('master',' <Correct error>
2289+CHAR(10) SET('master','s <Correct error>
2290+ENUM('master',' CHAR(10) <Correct error>
2291+SET('master','s CHAR(10) <Correct error>
2292+SET('master','s SET('master','s <Correct value>
2293+SET('master','s SET('master','s <Correct value>
2294+SET('0','1','2' SET('0','1','2' <Correct value>
2295+SET('0','1','2' SET('0','1','2' <Correct error>
2296+SET('0','1','2' SET('0','1','2' <Correct error>
2297+SET('0','1','2' SET('0','1','2' <Correct error>
2298+TINYINT TINYINT <Correct value>
2299+TINYINT SMALLINT <Correct error>
2300+TINYINT MEDIUMINT <Correct error>
2301+TINYINT INT <Correct error>
2302+TINYINT BIGINT <Correct error>
2303+SMALLINT TINYINT <Correct error>
2304+SMALLINT TINYINT <Correct error>
2305+SMALLINT TINYINT UNSIGNE <Correct error>
2306+SMALLINT SMALLINT <Correct value>
2307+SMALLINT MEDIUMINT <Correct error>
2308+SMALLINT INT <Correct error>
2309+SMALLINT BIGINT <Correct error>
2310+MEDIUMINT TINYINT <Correct error>
2311+MEDIUMINT TINYINT <Correct error>
2312+MEDIUMINT TINYINT UNSIGNE <Correct error>
2313+MEDIUMINT SMALLINT <Correct error>
2314+MEDIUMINT MEDIUMINT <Correct value>
2315+MEDIUMINT INT <Correct error>
2316+MEDIUMINT BIGINT <Correct error>
2317+INT TINYINT <Correct error>
2318+INT TINYINT <Correct error>
2319+INT TINYINT UNSIGNE <Correct error>
2320+INT SMALLINT <Correct error>
2321+INT MEDIUMINT <Correct error>
2322+INT INT <Correct value>
2323+INT BIGINT <Correct error>
2324+BIGINT TINYINT <Correct error>
2325+BIGINT SMALLINT <Correct error>
2326+BIGINT MEDIUMINT <Correct error>
2327+BIGINT INT <Correct error>
2328+BIGINT BIGINT <Correct value>
2329+CHAR(20) CHAR(20) <Correct value>
2330+CHAR(20) CHAR(30) <Correct error>
2331+CHAR(20) CHAR(10) <Correct error>
2332+CHAR(20) VARCHAR(20) <Correct error>
2333+CHAR(20) VARCHAR(30) <Correct error>
2334+CHAR(20) VARCHAR(10) <Correct error>
2335+CHAR(20) TINYTEXT <Correct error>
2336+CHAR(20) TEXT <Correct error>
2337+CHAR(20) MEDIUMTEXT <Correct error>
2338+CHAR(20) LONGTEXT <Correct error>
2339+VARCHAR(20) VARCHAR(20) <Correct value>
2340+VARCHAR(20) VARCHAR(30) <Correct error>
2341+VARCHAR(20) VARCHAR(10) <Correct error>
2342+VARCHAR(20) CHAR(30) <Correct error>
2343+VARCHAR(20) CHAR(10) <Correct error>
2344+VARCHAR(20) TINYTEXT <Correct error>
2345+VARCHAR(20) TEXT <Correct error>
2346+VARCHAR(20) MEDIUMTEXT <Correct error>
2347+VARCHAR(20) LONGTEXT <Correct error>
2348+VARCHAR(500) VARCHAR(500) <Correct value>
2349+VARCHAR(500) VARCHAR(510) <Correct error>
2350+VARCHAR(500) VARCHAR(255) <Correct error>
2351+VARCHAR(500) TINYTEXT <Correct error>
2352+VARCHAR(500) TEXT <Correct error>
2353+VARCHAR(500) MEDIUMTEXT <Correct error>
2354+VARCHAR(500) LONGTEXT <Correct error>
2355+TINYTEXT VARCHAR(500) <Correct error>
2356+TEXT VARCHAR(500) <Correct error>
2357+MEDIUMTEXT VARCHAR(500) <Correct error>
2358+LONGTEXT VARCHAR(500) <Correct error>
2359+TINYTEXT CHAR(255) <Correct error>
2360+TINYTEXT CHAR(250) <Correct error>
2361+TEXT CHAR(255) <Correct error>
2362+MEDIUMTEXT CHAR(255) <Correct error>
2363+LONGTEXT CHAR(255) <Correct error>
2364+TINYTEXT TINYTEXT <Correct value>
2365+TINYTEXT TEXT <Correct error>
2366+TEXT TINYTEXT <Correct error>
2367+DECIMAL(10,5) DECIMAL(10,5) <Correct value>
2368+DECIMAL(10,5) DECIMAL(10,6) <Correct error>
2369+DECIMAL(10,5) DECIMAL(11,5) <Correct error>
2370+DECIMAL(10,5) DECIMAL(11,6) <Correct error>
2371+DECIMAL(10,5) DECIMAL(10,4) <Correct error>
2372+DECIMAL(10,5) DECIMAL(9,5) <Correct error>
2373+DECIMAL(10,5) DECIMAL(9,4) <Correct error>
2374+FLOAT DECIMAL(10,5) <Correct error>
2375+DOUBLE DECIMAL(10,5) <Correct error>
2376+DECIMAL(10,5) FLOAT <Correct error>
2377+DECIMAL(10,5) DOUBLE <Correct error>
2378+FLOAT FLOAT <Correct value>
2379+DOUBLE DOUBLE <Correct value>
2380+FLOAT DOUBLE <Correct error>
2381+DOUBLE FLOAT <Correct error>
2382+BIT(5) BIT(5) <Correct value>
2383+BIT(5) BIT(6) <Correct error>
2384+BIT(6) BIT(5) <Correct error>
2385+BIT(5) BIT(12) <Correct error>
2386+BIT(12) BIT(5) <Correct error>
2387+TINYBLOB TINYBLOB ALL_NON_LOSSY <Correct value>
2388+TINYBLOB BLOB ALL_NON_LOSSY <Correct value>
2389+TINYBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
2390+TINYBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
2391+BLOB TINYBLOB ALL_NON_LOSSY <Correct error>
2392+BLOB BLOB ALL_NON_LOSSY <Correct value>
2393+BLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
2394+BLOB LONGBLOB ALL_NON_LOSSY <Correct value>
2395+MEDIUMBLOB TINYBLOB ALL_NON_LOSSY <Correct error>
2396+MEDIUMBLOB BLOB ALL_NON_LOSSY <Correct error>
2397+MEDIUMBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
2398+MEDIUMBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
2399+LONGBLOB TINYBLOB ALL_NON_LOSSY <Correct error>
2400+LONGBLOB BLOB ALL_NON_LOSSY <Correct error>
2401+LONGBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct error>
2402+LONGBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
2403+GEOMETRY BLOB ALL_NON_LOSSY <Correct error>
2404+BLOB GEOMETRY ALL_NON_LOSSY <Correct error>
2405+GEOMETRY GEOMETRY ALL_NON_LOSSY <Correct value>
2406+BIT(1) BIT(1) ALL_NON_LOSSY <Correct value>
2407+DATE DATE ALL_NON_LOSSY <Correct value>
2408+ENUM('master',' ENUM('master',' ALL_NON_LOSSY <Correct value>
2409+CHAR(10) ENUM('master',' ALL_NON_LOSSY <Correct error>
2410+CHAR(10) SET('master','s ALL_NON_LOSSY <Correct error>
2411+ENUM('master',' CHAR(10) ALL_NON_LOSSY <Correct error>
2412+SET('master','s CHAR(10) ALL_NON_LOSSY <Correct error>
2413+SET('master','s SET('master','s ALL_NON_LOSSY <Correct value>
2414+SET('master','s SET('master','s ALL_NON_LOSSY <Correct value>
2415+SET('0','1','2' SET('0','1','2' ALL_NON_LOSSY <Correct value>
2416+SET('0','1','2' SET('0','1','2' ALL_NON_LOSSY <Correct value>
2417+SET('0','1','2' SET('0','1','2' ALL_NON_LOSSY <Correct error>
2418+SET('0','1','2' SET('0','1','2' ALL_NON_LOSSY <Correct error>
2419+TINYINT TINYINT ALL_NON_LOSSY <Correct value>
2420+TINYINT SMALLINT ALL_NON_LOSSY <Correct value>
2421+TINYINT MEDIUMINT ALL_NON_LOSSY <Correct value>
2422+TINYINT INT ALL_NON_LOSSY <Correct value>
2423+TINYINT BIGINT ALL_NON_LOSSY <Correct value>
2424+SMALLINT TINYINT ALL_NON_LOSSY <Correct error>
2425+SMALLINT TINYINT ALL_NON_LOSSY <Correct error>
2426+SMALLINT TINYINT UNSIGNE ALL_NON_LOSSY <Correct error>
2427+SMALLINT SMALLINT ALL_NON_LOSSY <Correct value>
2428+SMALLINT MEDIUMINT ALL_NON_LOSSY <Correct value>
2429+SMALLINT INT ALL_NON_LOSSY <Correct value>
2430+SMALLINT BIGINT ALL_NON_LOSSY <Correct value>
2431+MEDIUMINT TINYINT ALL_NON_LOSSY <Correct error>
2432+MEDIUMINT TINYINT ALL_NON_LOSSY <Correct error>
2433+MEDIUMINT TINYINT UNSIGNE ALL_NON_LOSSY <Correct error>
2434+MEDIUMINT SMALLINT ALL_NON_LOSSY <Correct error>
2435+MEDIUMINT MEDIUMINT ALL_NON_LOSSY <Correct value>
2436+MEDIUMINT INT ALL_NON_LOSSY <Correct value>
2437+MEDIUMINT BIGINT ALL_NON_LOSSY <Correct value>
2438+INT TINYINT ALL_NON_LOSSY <Correct error>
2439+INT TINYINT ALL_NON_LOSSY <Correct error>
2440+INT TINYINT UNSIGNE ALL_NON_LOSSY <Correct error>
2441+INT SMALLINT ALL_NON_LOSSY <Correct error>
2442+INT MEDIUMINT ALL_NON_LOSSY <Correct error>
2443+INT INT ALL_NON_LOSSY <Correct value>
2444+INT BIGINT ALL_NON_LOSSY <Correct value>
2445+BIGINT TINYINT ALL_NON_LOSSY <Correct error>
2446+BIGINT SMALLINT ALL_NON_LOSSY <Correct error>
2447+BIGINT MEDIUMINT ALL_NON_LOSSY <Correct error>
2448+BIGINT INT ALL_NON_LOSSY <Correct error>
2449+BIGINT BIGINT ALL_NON_LOSSY <Correct value>
2450+CHAR(20) CHAR(20) ALL_NON_LOSSY <Correct value>
2451+CHAR(20) CHAR(30) ALL_NON_LOSSY <Correct value>
2452+CHAR(20) CHAR(10) ALL_NON_LOSSY <Correct error>
2453+CHAR(20) VARCHAR(20) ALL_NON_LOSSY <Correct value>
2454+CHAR(20) VARCHAR(30) ALL_NON_LOSSY <Correct value>
2455+CHAR(20) VARCHAR(10) ALL_NON_LOSSY <Correct error>
2456+CHAR(20) TINYTEXT ALL_NON_LOSSY <Correct value>
2457+CHAR(20) TEXT ALL_NON_LOSSY <Correct value>
2458+CHAR(20) MEDIUMTEXT ALL_NON_LOSSY <Correct value>
2459+CHAR(20) LONGTEXT ALL_NON_LOSSY <Correct value>
2460+VARCHAR(20) VARCHAR(20) ALL_NON_LOSSY <Correct value>
2461+VARCHAR(20) VARCHAR(30) ALL_NON_LOSSY <Correct value>
2462+VARCHAR(20) VARCHAR(10) ALL_NON_LOSSY <Correct error>
2463+VARCHAR(20) CHAR(30) ALL_NON_LOSSY <Correct value>
2464+VARCHAR(20) CHAR(10) ALL_NON_LOSSY <Correct error>
2465+VARCHAR(20) TINYTEXT ALL_NON_LOSSY <Correct value>
2466+VARCHAR(20) TEXT ALL_NON_LOSSY <Correct value>
2467+VARCHAR(20) MEDIUMTEXT ALL_NON_LOSSY <Correct value>
2468+VARCHAR(20) LONGTEXT ALL_NON_LOSSY <Correct value>
2469+VARCHAR(500) VARCHAR(500) ALL_NON_LOSSY <Correct value>
2470+VARCHAR(500) VARCHAR(510) ALL_NON_LOSSY <Correct value>
2471+VARCHAR(500) VARCHAR(255) ALL_NON_LOSSY <Correct error>
2472+VARCHAR(500) TINYTEXT ALL_NON_LOSSY <Correct error>
2473+VARCHAR(500) TEXT ALL_NON_LOSSY <Correct value>
2474+VARCHAR(500) MEDIUMTEXT ALL_NON_LOSSY <Correct value>
2475+VARCHAR(500) LONGTEXT ALL_NON_LOSSY <Correct value>
2476+TINYTEXT VARCHAR(500) ALL_NON_LOSSY <Correct value>
2477+TEXT VARCHAR(500) ALL_NON_LOSSY <Correct error>
2478+MEDIUMTEXT VARCHAR(500) ALL_NON_LOSSY <Correct error>
2479+LONGTEXT VARCHAR(500) ALL_NON_LOSSY <Correct error>
2480+TINYTEXT CHAR(255) ALL_NON_LOSSY <Correct value>
2481+TINYTEXT CHAR(250) ALL_NON_LOSSY <Correct error>
2482+TEXT CHAR(255) ALL_NON_LOSSY <Correct error>
2483+MEDIUMTEXT CHAR(255) ALL_NON_LOSSY <Correct error>
2484+LONGTEXT CHAR(255) ALL_NON_LOSSY <Correct error>
2485+TINYTEXT TINYTEXT ALL_NON_LOSSY <Correct value>
2486+TINYTEXT TEXT ALL_NON_LOSSY <Correct value>
2487+TEXT TINYTEXT ALL_NON_LOSSY <Correct error>
2488+DECIMAL(10,5) DECIMAL(10,5) ALL_NON_LOSSY <Correct value>
2489+DECIMAL(10,5) DECIMAL(10,6) ALL_NON_LOSSY <Correct value>
2490+DECIMAL(10,5) DECIMAL(11,5) ALL_NON_LOSSY <Correct value>
2491+DECIMAL(10,5) DECIMAL(11,6) ALL_NON_LOSSY <Correct value>
2492+DECIMAL(10,5) DECIMAL(10,4) ALL_NON_LOSSY <Correct error>
2493+DECIMAL(10,5) DECIMAL(9,5) ALL_NON_LOSSY <Correct error>
2494+DECIMAL(10,5) DECIMAL(9,4) ALL_NON_LOSSY <Correct error>
2495+FLOAT DECIMAL(10,5) ALL_NON_LOSSY <Correct error>
2496+DOUBLE DECIMAL(10,5) ALL_NON_LOSSY <Correct error>
2497+DECIMAL(10,5) FLOAT ALL_NON_LOSSY <Correct error>
2498+DECIMAL(10,5) DOUBLE ALL_NON_LOSSY <Correct error>
2499+FLOAT FLOAT ALL_NON_LOSSY <Correct value>
2500+DOUBLE DOUBLE ALL_NON_LOSSY <Correct value>
2501+FLOAT DOUBLE ALL_NON_LOSSY <Correct value>
2502+DOUBLE FLOAT ALL_NON_LOSSY <Correct error>
2503+BIT(5) BIT(5) ALL_NON_LOSSY <Correct value>
2504+BIT(5) BIT(6) ALL_NON_LOSSY <Correct value>
2505+BIT(6) BIT(5) ALL_NON_LOSSY <Correct error>
2506+BIT(5) BIT(12) ALL_NON_LOSSY <Correct value>
2507+BIT(12) BIT(5) ALL_NON_LOSSY <Correct error>
2508+TINYBLOB TINYBLOB ALL_LOSSY <Correct value>
2509+TINYBLOB BLOB ALL_LOSSY <Correct error>
2510+TINYBLOB MEDIUMBLOB ALL_LOSSY <Correct error>
2511+TINYBLOB LONGBLOB ALL_LOSSY <Correct error>
2512+BLOB TINYBLOB ALL_LOSSY <Correct value>
2513+BLOB BLOB ALL_LOSSY <Correct value>
2514+BLOB MEDIUMBLOB ALL_LOSSY <Correct error>
2515+BLOB LONGBLOB ALL_LOSSY <Correct error>
2516+MEDIUMBLOB TINYBLOB ALL_LOSSY <Correct value>
2517+MEDIUMBLOB BLOB ALL_LOSSY <Correct value>
2518+MEDIUMBLOB MEDIUMBLOB ALL_LOSSY <Correct value>
2519+MEDIUMBLOB LONGBLOB ALL_LOSSY <Correct error>
2520+LONGBLOB TINYBLOB ALL_LOSSY <Correct value>
2521+LONGBLOB BLOB ALL_LOSSY <Correct value>
2522+LONGBLOB MEDIUMBLOB ALL_LOSSY <Correct value>
2523+LONGBLOB LONGBLOB ALL_LOSSY <Correct value>
2524+GEOMETRY BLOB ALL_LOSSY <Correct error>
2525+BLOB GEOMETRY ALL_LOSSY <Correct error>
2526+GEOMETRY GEOMETRY ALL_LOSSY <Correct value>
2527+BIT(1) BIT(1) ALL_LOSSY <Correct value>
2528+DATE DATE ALL_LOSSY <Correct value>
2529+ENUM('master',' ENUM('master',' ALL_LOSSY <Correct value>
2530+CHAR(10) ENUM('master',' ALL_LOSSY <Correct error>
2531+CHAR(10) SET('master','s ALL_LOSSY <Correct error>
2532+ENUM('master',' CHAR(10) ALL_LOSSY <Correct error>
2533+SET('master','s CHAR(10) ALL_LOSSY <Correct error>
2534+SET('master','s SET('master','s ALL_LOSSY <Correct value>
2535+SET('master','s SET('master','s ALL_LOSSY <Correct value>
2536+SET('0','1','2' SET('0','1','2' ALL_LOSSY <Correct value>
2537+SET('0','1','2' SET('0','1','2' ALL_LOSSY <Correct error>
2538+SET('0','1','2' SET('0','1','2' ALL_LOSSY <Correct value>
2539+SET('0','1','2' SET('0','1','2' ALL_LOSSY <Correct value>
2540+TINYINT TINYINT ALL_LOSSY <Correct value>
2541+TINYINT SMALLINT ALL_LOSSY <Correct error>
2542+TINYINT MEDIUMINT ALL_LOSSY <Correct error>
2543+TINYINT INT ALL_LOSSY <Correct error>
2544+TINYINT BIGINT ALL_LOSSY <Correct error>
2545+SMALLINT TINYINT ALL_LOSSY <Correct value>
2546+SMALLINT TINYINT ALL_LOSSY <Correct value>
2547+SMALLINT TINYINT UNSIGNE ALL_LOSSY <Correct value>
2548+SMALLINT SMALLINT ALL_LOSSY <Correct value>
2549+SMALLINT MEDIUMINT ALL_LOSSY <Correct error>
2550+SMALLINT INT ALL_LOSSY <Correct error>
2551+SMALLINT BIGINT ALL_LOSSY <Correct error>
2552+MEDIUMINT TINYINT ALL_LOSSY <Correct value>
2553+MEDIUMINT TINYINT ALL_LOSSY <Correct value>
2554+MEDIUMINT TINYINT UNSIGNE ALL_LOSSY <Correct value>
2555+MEDIUMINT SMALLINT ALL_LOSSY <Correct value>
2556+MEDIUMINT MEDIUMINT ALL_LOSSY <Correct value>
2557+MEDIUMINT INT ALL_LOSSY <Correct error>
2558+MEDIUMINT BIGINT ALL_LOSSY <Correct error>
2559+INT TINYINT ALL_LOSSY <Correct value>
2560+INT TINYINT ALL_LOSSY <Correct value>
2561+INT TINYINT UNSIGNE ALL_LOSSY <Correct value>
2562+INT SMALLINT ALL_LOSSY <Correct value>
2563+INT MEDIUMINT ALL_LOSSY <Correct value>
2564+INT INT ALL_LOSSY <Correct value>
2565+INT BIGINT ALL_LOSSY <Correct error>
2566+BIGINT TINYINT ALL_LOSSY <Correct value>
2567+BIGINT SMALLINT ALL_LOSSY <Correct value>
2568+BIGINT MEDIUMINT ALL_LOSSY <Correct value>
2569+BIGINT INT ALL_LOSSY <Correct value>
2570+BIGINT BIGINT ALL_LOSSY <Correct value>
2571+CHAR(20) CHAR(20) ALL_LOSSY <Correct value>
2572+CHAR(20) CHAR(30) ALL_LOSSY <Correct error>
2573+CHAR(20) CHAR(10) ALL_LOSSY <Correct value>
2574+CHAR(20) VARCHAR(20) ALL_LOSSY <Correct error>
2575+CHAR(20) VARCHAR(30) ALL_LOSSY <Correct error>
2576+CHAR(20) VARCHAR(10) ALL_LOSSY <Correct value>
2577+CHAR(20) TINYTEXT ALL_LOSSY <Correct error>
2578+CHAR(20) TEXT ALL_LOSSY <Correct error>
2579+CHAR(20) MEDIUMTEXT ALL_LOSSY <Correct error>
2580+CHAR(20) LONGTEXT ALL_LOSSY <Correct error>
2581+VARCHAR(20) VARCHAR(20) ALL_LOSSY <Correct value>
2582+VARCHAR(20) VARCHAR(30) ALL_LOSSY <Correct error>
2583+VARCHAR(20) VARCHAR(10) ALL_LOSSY <Correct value>
2584+VARCHAR(20) CHAR(30) ALL_LOSSY <Correct error>
2585+VARCHAR(20) CHAR(10) ALL_LOSSY <Correct value>
2586+VARCHAR(20) TINYTEXT ALL_LOSSY <Correct error>
2587+VARCHAR(20) TEXT ALL_LOSSY <Correct error>
2588+VARCHAR(20) MEDIUMTEXT ALL_LOSSY <Correct error>
2589+VARCHAR(20) LONGTEXT ALL_LOSSY <Correct error>
2590+VARCHAR(500) VARCHAR(500) ALL_LOSSY <Correct value>
2591+VARCHAR(500) VARCHAR(510) ALL_LOSSY <Correct error>
2592+VARCHAR(500) VARCHAR(255) ALL_LOSSY <Correct value>
2593+VARCHAR(500) TINYTEXT ALL_LOSSY <Correct value>
2594+VARCHAR(500) TEXT ALL_LOSSY <Correct error>
2595+VARCHAR(500) MEDIUMTEXT ALL_LOSSY <Correct error>
2596+VARCHAR(500) LONGTEXT ALL_LOSSY <Correct error>
2597+TINYTEXT VARCHAR(500) ALL_LOSSY <Correct error>
2598+TEXT VARCHAR(500) ALL_LOSSY <Correct value>
2599+MEDIUMTEXT VARCHAR(500) ALL_LOSSY <Correct value>
2600+LONGTEXT VARCHAR(500) ALL_LOSSY <Correct value>
2601+TINYTEXT CHAR(255) ALL_LOSSY <Correct error>
2602+TINYTEXT CHAR(250) ALL_LOSSY <Correct value>
2603+TEXT CHAR(255) ALL_LOSSY <Correct value>
2604+MEDIUMTEXT CHAR(255) ALL_LOSSY <Correct value>
2605+LONGTEXT CHAR(255) ALL_LOSSY <Correct value>
2606+TINYTEXT TINYTEXT ALL_LOSSY <Correct value>
2607+TINYTEXT TEXT ALL_LOSSY <Correct error>
2608+TEXT TINYTEXT ALL_LOSSY <Correct value>
2609+DECIMAL(10,5) DECIMAL(10,5) ALL_LOSSY <Correct value>
2610+DECIMAL(10,5) DECIMAL(10,6) ALL_LOSSY <Correct error>
2611+DECIMAL(10,5) DECIMAL(11,5) ALL_LOSSY <Correct error>
2612+DECIMAL(10,5) DECIMAL(11,6) ALL_LOSSY <Correct error>
2613+DECIMAL(10,5) DECIMAL(10,4) ALL_LOSSY <Correct value>
2614+DECIMAL(10,5) DECIMAL(9,5) ALL_LOSSY <Correct value>
2615+DECIMAL(10,5) DECIMAL(9,4) ALL_LOSSY <Correct value>
2616+FLOAT DECIMAL(10,5) ALL_LOSSY <Correct value>
2617+DOUBLE DECIMAL(10,5) ALL_LOSSY <Correct value>
2618+DECIMAL(10,5) FLOAT ALL_LOSSY <Correct value>
2619+DECIMAL(10,5) DOUBLE ALL_LOSSY <Correct value>
2620+FLOAT FLOAT ALL_LOSSY <Correct value>
2621+DOUBLE DOUBLE ALL_LOSSY <Correct value>
2622+FLOAT DOUBLE ALL_LOSSY <Correct error>
2623+DOUBLE FLOAT ALL_LOSSY <Correct value>
2624+BIT(5) BIT(5) ALL_LOSSY <Correct value>
2625+BIT(5) BIT(6) ALL_LOSSY <Correct error>
2626+BIT(6) BIT(5) ALL_LOSSY <Correct value>
2627+BIT(5) BIT(12) ALL_LOSSY <Correct error>
2628+BIT(12) BIT(5) ALL_LOSSY <Correct value>
2629+TINYBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2630+TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2631+TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2632+TINYBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2633+BLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2634+BLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2635+BLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2636+BLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2637+MEDIUMBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2638+MEDIUMBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2639+MEDIUMBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2640+MEDIUMBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2641+LONGBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2642+LONGBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2643+LONGBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2644+LONGBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2645+GEOMETRY BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct error>
2646+BLOB GEOMETRY ALL_LOSSY,ALL_NON_LOSSY <Correct error>
2647+GEOMETRY GEOMETRY ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2648+BIT(1) BIT(1) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2649+DATE DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2650+ENUM('master',' ENUM('master',' ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2651+CHAR(10) ENUM('master',' ALL_LOSSY,ALL_NON_LOSSY <Correct error>
2652+CHAR(10) SET('master','s ALL_LOSSY,ALL_NON_LOSSY <Correct error>
2653+ENUM('master',' CHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct error>
2654+SET('master','s CHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct error>
2655+SET('master','s SET('master','s ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2656+SET('master','s SET('master','s ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2657+SET('0','1','2' SET('0','1','2' ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2658+SET('0','1','2' SET('0','1','2' ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2659+SET('0','1','2' SET('0','1','2' ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2660+SET('0','1','2' SET('0','1','2' ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2661+TINYINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2662+TINYINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2663+TINYINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2664+TINYINT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2665+TINYINT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2666+SMALLINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2667+SMALLINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2668+SMALLINT TINYINT UNSIGNE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2669+SMALLINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2670+SMALLINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2671+SMALLINT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2672+SMALLINT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2673+MEDIUMINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2674+MEDIUMINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2675+MEDIUMINT TINYINT UNSIGNE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2676+MEDIUMINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2677+MEDIUMINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2678+MEDIUMINT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2679+MEDIUMINT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2680+INT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2681+INT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2682+INT TINYINT UNSIGNE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2683+INT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2684+INT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2685+INT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2686+INT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2687+BIGINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2688+BIGINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2689+BIGINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2690+BIGINT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2691+BIGINT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2692+CHAR(20) CHAR(20) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2693+CHAR(20) CHAR(30) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2694+CHAR(20) CHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2695+CHAR(20) VARCHAR(20) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2696+CHAR(20) VARCHAR(30) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2697+CHAR(20) VARCHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2698+CHAR(20) TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2699+CHAR(20) TEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2700+CHAR(20) MEDIUMTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2701+CHAR(20) LONGTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2702+VARCHAR(20) VARCHAR(20) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2703+VARCHAR(20) VARCHAR(30) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2704+VARCHAR(20) VARCHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2705+VARCHAR(20) CHAR(30) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2706+VARCHAR(20) CHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2707+VARCHAR(20) TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2708+VARCHAR(20) TEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2709+VARCHAR(20) MEDIUMTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2710+VARCHAR(20) LONGTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2711+VARCHAR(500) VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2712+VARCHAR(500) VARCHAR(510) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2713+VARCHAR(500) VARCHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2714+VARCHAR(500) TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2715+VARCHAR(500) TEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2716+VARCHAR(500) MEDIUMTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2717+VARCHAR(500) LONGTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2718+TINYTEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2719+TEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2720+MEDIUMTEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2721+LONGTEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2722+TINYTEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2723+TINYTEXT CHAR(250) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2724+TEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2725+MEDIUMTEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2726+LONGTEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2727+TINYTEXT TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2728+TINYTEXT TEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2729+TEXT TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2730+DECIMAL(10,5) DECIMAL(10,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2731+DECIMAL(10,5) DECIMAL(10,6) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2732+DECIMAL(10,5) DECIMAL(11,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2733+DECIMAL(10,5) DECIMAL(11,6) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2734+DECIMAL(10,5) DECIMAL(10,4) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2735+DECIMAL(10,5) DECIMAL(9,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2736+DECIMAL(10,5) DECIMAL(9,4) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2737+FLOAT DECIMAL(10,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2738+DOUBLE DECIMAL(10,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2739+DECIMAL(10,5) FLOAT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2740+DECIMAL(10,5) DOUBLE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2741+FLOAT FLOAT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2742+DOUBLE DOUBLE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2743+FLOAT DOUBLE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2744+DOUBLE FLOAT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2745+BIT(5) BIT(5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2746+BIT(5) BIT(6) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2747+BIT(6) BIT(5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2748+BIT(5) BIT(12) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2749+BIT(12) BIT(5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2750+DROP TABLE type_conversions;
2751+DROP TABLE t1;
2752+set global slave_type_conversions = @saved_slave_type_conversions;
2753+include/rpl_end.inc
2754
2755=== modified file 'Percona-Server/mysql-test/suite/rpl/t/rpl_bug31076.test'
2756--- Percona-Server/mysql-test/suite/rpl/t/rpl_bug31076.test 2010-12-19 17:07:28 +0000
2757+++ Percona-Server/mysql-test/suite/rpl/t/rpl_bug31076.test 2012-02-22 07:32:24 +0000
2758@@ -1,5 +1,8 @@
2759 source include/master-slave.inc;
2760
2761+SET @saved_slave_type_conversions = @@slave_type_conversions;
2762+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
2763+
2764 CREATE DATABASE track;
2765 USE track;
2766
2767@@ -130,8 +133,11 @@
2768 SELECT * FROM visits;
2769 SELECT * FROM visits_events;
2770
2771+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
2772+
2773 # Cleanup
2774 DROP DATABASE track;
2775 sync_slave_with_master;
2776+
2777 --echo End of 5.1 tests
2778 --source include/rpl_end.inc
2779
2780=== modified file 'Percona-Server/mysql-test/suite/rpl/t/rpl_colSize.test'
2781--- Percona-Server/mysql-test/suite/rpl/t/rpl_colSize.test 2010-12-19 17:07:28 +0000
2782+++ Percona-Server/mysql-test/suite/rpl/t/rpl_colSize.test 2012-02-22 07:32:24 +0000
2783@@ -18,6 +18,9 @@
2784 STOP SLAVE;
2785 RESET SLAVE;
2786
2787+SET @saved_slave_type_conversions = @@slave_type_conversions;
2788+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
2789+
2790 eval CREATE TABLE t1 (
2791 a float (47),
2792 b double (143,9),
2793@@ -217,5 +220,7 @@
2794 DROP TABLE t1;
2795 sync_slave_with_master;
2796
2797+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
2798+
2799 # END 5.1 Test Case
2800 --source include/rpl_end.inc
2801
2802=== modified file 'Percona-Server/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test'
2803--- Percona-Server/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test 2010-12-19 17:07:28 +0000
2804+++ Percona-Server/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test 2012-02-22 07:32:24 +0000
2805@@ -2,6 +2,8 @@
2806 -- source include/have_binlog_format_row.inc
2807 -- source include/master-slave.inc
2808
2809+connection slave;
2810+let $bit_field_special = ALL_LOSSY;
2811 let $type= 'INNODB' ;
2812 let $extra_index= ;
2813 -- source extra/rpl_tests/rpl_row_basic.test
2814
2815=== modified file 'Percona-Server/mysql-test/suite/rpl/t/rpl_row_colSize.test'
2816--- Percona-Server/mysql-test/suite/rpl/t/rpl_row_colSize.test 2011-02-23 09:31:37 +0000
2817+++ Percona-Server/mysql-test/suite/rpl/t/rpl_row_colSize.test 2012-02-22 07:32:24 +0000
2818@@ -9,6 +9,10 @@
2819 -- source include/master-slave.inc
2820 -- source include/have_binlog_format_row.inc
2821
2822+--disable_query_log
2823+call mtr.add_suppression("Slave SQL.*Column.*of table.*cannot be converted from type.*to type.* 1677");
2824+--enable_query_log
2825+
2826 --disable_warnings
2827 DROP TABLE IF EXISTS t1;
2828 --enable_warnings
2829
2830=== added file 'Percona-Server/mysql-test/suite/rpl/t/rpl_typeconv.test'
2831--- Percona-Server/mysql-test/suite/rpl/t/rpl_typeconv.test 1970-01-01 00:00:00 +0000
2832+++ Percona-Server/mysql-test/suite/rpl/t/rpl_typeconv.test 2012-02-22 07:32:24 +0000
2833@@ -0,0 +1,75 @@
2834+--source include/have_binlog_format_row.inc
2835+--source include/master-slave.inc
2836+
2837+connection slave;
2838+set @saved_slave_type_conversions = @@global.slave_type_conversions;
2839+CREATE TABLE type_conversions (
2840+ TestNo INT AUTO_INCREMENT PRIMARY KEY,
2841+ Source TEXT,
2842+ Target TEXT,
2843+ Flags TEXT,
2844+ On_Master TEXT,
2845+ On_Slave TEXT,
2846+ Expected TEXT,
2847+ Compare INT,
2848+ Error TEXT);
2849+
2850+SELECT @@global.slave_type_conversions;
2851+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
2852+SELECT @@global.slave_type_conversions;
2853+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
2854+SELECT @@global.slave_type_conversions;
2855+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
2856+SELECT @@global.slave_type_conversions;
2857+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
2858+SELECT @@global.slave_type_conversions;
2859+--error ER_WRONG_VALUE_FOR_VAR
2860+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT';
2861+SELECT @@global.slave_type_conversions;
2862+
2863+# ignore error in mysqld.err
2864+--disable_query_log
2865+call mtr.add_suppression("Slave SQL.*Column.*of table.*cannot be converted from type.*to type.* 1677");
2866+--enable_query_log
2867+
2868+# Checking strict interpretation of type conversions
2869+connection slave;
2870+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
2871+source extra/rpl_tests/type_conversions.test;
2872+
2873+# Checking lossy integer type conversions
2874+connection slave;
2875+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
2876+source extra/rpl_tests/type_conversions.test;
2877+
2878+# Checking non-lossy integer type conversions
2879+connection slave;
2880+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
2881+source extra/rpl_tests/type_conversions.test;
2882+
2883+# Checking all type conversions
2884+connection slave;
2885+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
2886+source extra/rpl_tests/type_conversions.test;
2887+
2888+connection slave;
2889+--echo **** Result of conversions ****
2890+disable_query_log;
2891+SELECT RPAD(Source, 15, ' ') AS Source_Type,
2892+ RPAD(Target, 15, ' ') AS Target_Type,
2893+ RPAD(Flags, 25, ' ') AS All_Type_Conversion_Flags,
2894+ IF(Compare IS NULL AND Error IS NOT NULL, '<Correct error>',
2895+ IF(Compare, '<Correct value>',
2896+ CONCAT("'", On_Slave, "' != '", Expected, "'")))
2897+ AS Value_On_Slave
2898+ FROM type_conversions;
2899+enable_query_log;
2900+DROP TABLE type_conversions;
2901+
2902+connection master;
2903+DROP TABLE t1;
2904+sync_slave_with_master;
2905+
2906+set global slave_type_conversions = @saved_slave_type_conversions;
2907+
2908+source include/rpl_end.inc;
2909
2910=== modified file 'Percona-Server/sql/field.cc'
2911--- Percona-Server/sql/field.cc 2011-07-03 15:47:37 +0000
2912+++ Percona-Server/sql/field.cc 2012-02-22 07:32:24 +0000
2913@@ -60,6 +60,8 @@
2914 #define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(!table || (!table->read_set || bitmap_is_set(table->read_set, field_index)))
2915 #define ASSERT_COLUMN_MARKED_FOR_WRITE DBUG_ASSERT(!table || (!table->write_set || bitmap_is_set(table->write_set, field_index)))
2916
2917+#define FLAGSTR(S,F) ((S) & (F) ? #F " " : "")
2918+
2919 /*
2920 Rules for merging different types of fields in UNION
2921
2922@@ -998,6 +1000,23 @@
2923
2924
2925 /**
2926+ Function to compare two unsigned integers for their relative order.
2927+ Used below. In an anonymous namespace to not clash with definitions
2928+ in other files.
2929+ */
2930+namespace
2931+{
2932+ int compare(unsigned int a, unsigned int b)
2933+ {
2934+ if (a < b)
2935+ return -1;
2936+ if (b < a)
2937+ return 1;
2938+ return 0;
2939+ }
2940+}
2941+
2942+/**
2943 Detect Item_result by given field type of UNION merge result.
2944
2945 @param field_type given field type
2946@@ -1368,24 +1387,48 @@
2947 /**
2948 Check to see if field size is compatible with destination.
2949
2950- This method is used in row-based replication to verify that the slave's
2951- field size is less than or equal to the master's field size. The
2952- encoded field metadata (from the master or source) is decoded and compared
2953- to the size of this field (the slave or destination).
2954+ This method is used in row-based replication to verify that the
2955+ slave's field size is less than or equal to the master's field
2956+ size. The encoded field metadata (from the master or source) is
2957+ decoded and compared to the size of this field (the slave or
2958+ destination).
2959+
2960+ @note
2961+
2962+ The comparison is made so that if the source data (from the master)
2963+ is less than the target data (on the slave), -1 is returned in @c
2964+ <code>*order_var</code>. This implies that a conversion is
2965+ necessary, but that it is lossy and can result in truncation of the
2966+ value.
2967+
2968+ If the source data is strictly greater than the target data, 1 is
2969+ returned in <code>*order_var</code>. This implies that the source
2970+ type can is contained in the target type and that a conversion is
2971+ necessary but is non-lossy.
2972+
2973+ If no conversion is required to fit the source type in the target
2974+ type, 0 is returned in <code>*order_var</code>.
2975
2976 @param field_metadata Encoded size in field metadata
2977 @param mflags Flags from the table map event for the table.
2978-
2979- @retval 0 if this field's size is < the source field's size
2980- @retval 1 if this field's size is >= the source field's size
2981+ @param order_var Pointer to variable where the order
2982+ between the source field and this field
2983+ will be returned.
2984+
2985+ @return @c true if this field's size is compatible with the
2986+ master's field size, @c false otherwise.
2987 */
2988-int Field::compatible_field_size(uint field_metadata,
2989- const Relay_log_info *rli_arg __attribute__((unused)),
2990- uint16 mflags __attribute__((unused)))
2991+bool Field::compatible_field_size(uint field_metadata,
2992+ Relay_log_info *__attribute__((unused)),
2993+ uint16 __attribute__((unused)),
2994+ int *order_var)
2995 {
2996 uint const source_size= pack_length_from_metadata(field_metadata);
2997 uint const destination_size= row_pack_length();
2998- return (source_size <= destination_size);
2999+ DBUG_PRINT("debug", ("real_type: %d, source_size: %u, destination_size: %u",
3000+ real_type(), source_size, destination_size));
3001+ *order_var= compare(source_size, destination_size);
3002+ return true;
3003 }
3004
3005
3006@@ -2869,33 +2912,45 @@
3007
3008
3009 /**
3010- Check to see if field size is compatible with destination.
3011-
3012- This method is used in row-based replication to verify that the slave's
3013- field size is less than or equal to the master's field size. The
3014- encoded field metadata (from the master or source) is decoded and compared
3015- to the size of this field (the slave or destination).
3016-
3017+ This method is used in row-based replication to verify that the
3018+ slave's field size is less than or equal to the master's field
3019+ size. The encoded field metadata (from the master or source) is
3020+ decoded and compared to the size of this field (the slave or
3021+ destination).
3022+
3023+ @note
3024+
3025+ The comparison is made so that if the source data (from the master)
3026+ is less than the target data (on the slave), -1 is returned in @c
3027+ <code>*order_var</code>. This implies that a conversion is
3028+ necessary, but that it is lossy and can result in truncation of the
3029+ value.
3030+
3031+ If the source data is strictly greater than the target data, 1 is
3032+ returned in <code>*order_var</code>. This implies that the source
3033+ type can is contained in the target type and that a conversion is
3034+ necessary but is non-lossy.
3035+
3036+ If no conversion is required to fit the source type in the target
3037+ type, 0 is returned in <code>*order_var</code>.
3038 @param field_metadata Encoded size in field metadata
3039-
3040- @retval 0 if this field's size is < the source field's size
3041- @retval 1 if this field's size is >= the source field's size
3042+ @param order_var Pointer to variable where the order
3043+ between the source field and this field
3044+ will be returned.
3045+
3046+ @return @c true if this field's size is compatible with the
3047+ master's field size, @c false otherwise.
3048 */
3049-int Field_new_decimal::compatible_field_size(uint field_metadata,
3050- const Relay_log_info * __attribute__((unused)),
3051- uint16 mflags __attribute__((unused)))
3052+bool Field_new_decimal::compatible_field_size(uint field_metadata,
3053+ Relay_log_info *__attribute__((unused)),
3054+ uint16 __attribute__((unused)),
3055+ int *order_var)
3056 {
3057- int compatible= 0;
3058- uint const source_precision= (field_metadata >> 8U) & 0x00ff;
3059- uint const source_decimal= field_metadata & 0x00ff;
3060- uint const source_size= my_decimal_get_binary_size(source_precision,
3061- source_decimal);
3062- uint const destination_size= row_pack_length();
3063- compatible= (source_size <= destination_size);
3064- if (compatible)
3065- compatible= (source_precision <= precision) &&
3066- (source_decimal <= decimals());
3067- return (compatible);
3068+ uint const src_precision= (field_metadata >> 8U) & 0x00ff;
3069+ uint const src_decimal= field_metadata & 0x00ff;
3070+ int order= compare(src_precision, precision);
3071+ *order_var= order != 0 ? order : compare(src_decimal, dec);
3072+ return true;
3073 }
3074
3075
3076@@ -6645,17 +6700,50 @@
3077 }
3078 #endif
3079
3080-int Field_string::compatible_field_size(uint field_metadata,
3081- const Relay_log_info *rli_arg,
3082- uint16 mflags __attribute__((unused)))
3083+/**
3084+ This method is used in row-based replication to verify that the
3085+ slave's field size is less than or equal to the master's field
3086+ size. The encoded field metadata (from the master or source) is
3087+ decoded and compared to the size of this field (the slave or
3088+ destination).
3089+
3090+ @note
3091+
3092+ The comparison is made so that if the source data (from the master)
3093+ is less than the target data (on the slave), -1 is returned in @c
3094+ <code>*order_var</code>. This implies that a conversion is
3095+ necessary, but that it is lossy and can result in truncation of the
3096+ value.
3097+
3098+ If the source data is strictly greater than the target data, 1 is
3099+ returned in <code>*order_var</code>. This implies that the source
3100+ type can is contained in the target type and that a conversion is
3101+ necessary but is non-lossy.
3102+
3103+ If no conversion is required to fit the source type in the target
3104+ type, 0 is returned in <code>*order_var</code>.
3105+ @param field_metadata Encoded size in field metadata
3106+ @param rli_arg Relay log information
3107+ @param order_var Pointer to variable where the order
3108+ between the source field and this field
3109+ will be returned.
3110+
3111+ @return @c true if this field's size is compatible with the
3112+ master's field size, @c false otherwise.
3113+*/
3114+bool
3115+Field_string::compatible_field_size(uint field_metadata,
3116+ Relay_log_info *rli_arg,
3117+ uint16 mflags __attribute__((unused)),
3118+ int *order_var)
3119 {
3120 #ifdef HAVE_REPLICATION
3121 const Check_field_param check_param = { this };
3122 if (rpl_master_has_bug(rli_arg, 37426, TRUE,
3123 check_field_for_37426, &check_param))
3124- return FALSE; // Not compatible field sizes
3125+ return FALSE; // Not compatible field sizes
3126 #endif
3127- return Field::compatible_field_size(field_metadata, rli_arg, mflags);
3128+ return Field::compatible_field_size(field_metadata, rli_arg, mflags, order_var);
3129 }
3130
3131
3132@@ -6717,6 +6805,8 @@
3133 {
3134 uint length= min(field_length,max_length);
3135 uint local_char_length= max_length/field_charset->mbmaxlen;
3136+ DBUG_PRINT("debug", ("Packing field '%s' - length: %u ", field_name, length));
3137+
3138 if (length > local_char_length)
3139 local_char_length= my_charpos(field_charset, from, from+length,
3140 local_char_length);
3141@@ -7563,6 +7653,7 @@
3142 cs),
3143 packlength(blob_pack_length)
3144 {
3145+ DBUG_ASSERT(blob_pack_length <= 4); // Only pack lengths 1-4 supported currently
3146 flags|= BLOB_FLAG;
3147 share->blob_fields++;
3148 /* TODO: why do not fill table->s->blob_field array here? */
3149@@ -7973,8 +8064,10 @@
3150 */
3151 int Field_blob::do_save_field_metadata(uchar *metadata_ptr)
3152 {
3153+ DBUG_ENTER("Field_blob::do_save_field_metadata");
3154 *metadata_ptr= pack_length_no_ptr();
3155- return 1;
3156+ DBUG_PRINT("debug", ("metadata: %u (pack_length_no_ptr)", *metadata_ptr));
3157+ DBUG_RETURN(1);
3158 }
3159
3160
3161@@ -8926,6 +9019,9 @@
3162 bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7),
3163 bytes_in_rec(len_arg / 8)
3164 {
3165+ DBUG_ENTER("Field_bit::Field_bit");
3166+ DBUG_PRINT("enter", ("ptr_arg: %p, null_ptr_arg: %p, len_arg: %u, bit_len: %u, bytes_in_rec: %u",
3167+ ptr_arg, null_ptr_arg, len_arg, bit_len, bytes_in_rec));
3168 flags|= UNSIGNED_FLAG;
3169 /*
3170 Ensure that Field::eq() can distinguish between two different bit fields.
3171@@ -8933,6 +9029,7 @@
3172 */
3173 if (!null_ptr_arg)
3174 null_bit= bit_ofs_arg;
3175+ DBUG_VOID_RETURN;
3176 }
3177
3178
3179@@ -9217,6 +9314,9 @@
3180 */
3181 int Field_bit::do_save_field_metadata(uchar *metadata_ptr)
3182 {
3183+ DBUG_ENTER("Field_bit::do_save_field_metadata");
3184+ DBUG_PRINT("debug", ("bit_len: %d, bytes_in_rec: %d",
3185+ bit_len, bytes_in_rec));
3186 /*
3187 Since this class and Field_bit_as_char have different ideas of
3188 what should be stored here, we compute the values of the metadata
3189@@ -9224,7 +9324,7 @@
3190 */
3191 metadata_ptr[0]= field_length % 8;
3192 metadata_ptr[1]= field_length / 8;
3193- return 2;
3194+ DBUG_RETURN(2);
3195 }
3196
3197
3198@@ -9250,25 +9350,48 @@
3199
3200
3201 /**
3202- Check to see if field size is compatible with destination.
3203-
3204- This method is used in row-based replication to verify that the slave's
3205- field size is less than or equal to the master's field size. The
3206- encoded field metadata (from the master or source) is decoded and compared
3207- to the size of this field (the slave or destination).
3208-
3209+ This method is used in row-based replication to verify that the
3210+ slave's field size is less than or equal to the master's field
3211+ size. The encoded field metadata (from the master or source) is
3212+ decoded and compared to the size of this field (the slave or
3213+ destination).
3214+
3215+ @note
3216+
3217+ The comparison is made so that if the source data (from the master)
3218+ is less than the target data (on the slave), -1 is returned in @c
3219+ <code>*order_var</code>. This implies that a conversion is
3220+ necessary, but that it is lossy and can result in truncation of the
3221+ value.
3222+
3223+ If the source data is strictly greater than the target data, 1 is
3224+ returned in <code>*order_var</code>. This implies that the source
3225+ type can is contained in the target type and that a conversion is
3226+ necessary but is non-lossy.
3227+
3228+ If no conversion is required to fit the source type in the target
3229+ type, 0 is returned in <code>*order_var</code>.
3230 @param field_metadata Encoded size in field metadata
3231+ @param mflags Flags from the table map event for the table.
3232+ @param order_var Pointer to variable where the order
3233+ between the source field and this field
3234+ will be returned.
3235
3236- @retval 0 if this field's size is < the source field's size
3237- @retval 1 if this field's size is >= the source field's size
3238+ @return @c true if this field's size is compatible with the
3239+ master's field size, @c false otherwise.
3240 */
3241-int Field_bit::compatible_field_size(uint field_metadata,
3242- const Relay_log_info * __attribute__((unused)),
3243- uint16 mflags)
3244+bool
3245+Field_bit::compatible_field_size(uint field_metadata,
3246+ Relay_log_info *__attribute__((unused)),
3247+ uint16 mflags, int *order_var)
3248 {
3249- uint from_bit_len= 8 * (field_metadata >> 8) + (field_metadata & 0xff);
3250+ DBUG_ENTER("Field_bit::compatible_field_size");
3251+ DBUG_ASSERT((field_metadata >> 16) == 0);
3252+ uint from_bit_len=
3253+ 8 * (field_metadata >> 8) + (field_metadata & 0xff);
3254 uint to_bit_len= max_display_length();
3255-
3256+ DBUG_PRINT("debug", ("from_bit_len: %u, to_bit_len: %u",
3257+ from_bit_len, to_bit_len));
3258 /*
3259 If the bit length exact flag is clear, we are dealing with an old
3260 master, so we allow some less strict behaviour if replicating by
3261@@ -9276,13 +9399,15 @@
3262
3263 We do this by computing the number of bytes to store the field
3264 instead, and then compare the result.
3265- */
3266- if (!(mflags & Table_map_log_event::TM_BIT_LEN_EXACT_F)) {
3267+ */
3268+ if (!(mflags & Table_map_log_event::TM_BIT_LEN_EXACT_F))
3269+ {
3270 from_bit_len= (from_bit_len + 7) / 8;
3271 to_bit_len= (to_bit_len + 7) / 8;
3272 }
3273
3274- return from_bit_len <= to_bit_len;
3275+ *order_var= compare(from_bit_len, to_bit_len);
3276+ DBUG_RETURN(TRUE);
3277 }
3278
3279
3280@@ -9348,8 +9473,15 @@
3281 Field_bit::unpack(uchar *to, const uchar *from, uint param_data,
3282 bool low_byte_first __attribute__((unused)))
3283 {
3284+ DBUG_ENTER("Field_bit::unpack");
3285+ DBUG_PRINT("enter", ("to: %p, from: %p, param_data: 0x%x",
3286+ to, from, param_data));
3287+ DBUG_PRINT("debug", ("bit_ptr: %p, bit_len: %u, bit_ofs: %u",
3288+ bit_ptr, bit_len, bit_ofs));
3289 uint const from_len= (param_data >> 8U) & 0x00ff;
3290 uint const from_bit_len= param_data & 0x00ff;
3291+ DBUG_PRINT("debug", ("from_len: %u, from_bit_len: %u",
3292+ from_len, from_bit_len));
3293 /*
3294 If the parameter data is zero (i.e., undefined), or if the master
3295 and slave have the same sizes, then use the old unpack() method.
3296@@ -9370,7 +9502,7 @@
3297 from++;
3298 }
3299 memcpy(to, from, bytes_in_rec);
3300- return from + bytes_in_rec;
3301+ DBUG_RETURN(from + bytes_in_rec);
3302 }
3303
3304 /*
3305@@ -9396,7 +9528,7 @@
3306 bitmap_set_bit(table->write_set,field_index);
3307 store(value, new_len, system_charset_info);
3308 my_afree(value);
3309- return from + len;
3310+ DBUG_RETURN(from + len);
3311 }
3312
3313
3314@@ -9525,8 +9657,11 @@
3315 */
3316 void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
3317 uint32 length_arg, uint32 decimals_arg,
3318- bool maybe_null, bool is_unsigned)
3319+ bool maybe_null, bool is_unsigned,
3320+ uint pack_length)
3321 {
3322+ DBUG_ENTER("Create_field::init_for_tmp_table");
3323+
3324 field_name= "";
3325 sql_type= sql_type_arg;
3326 char_length= length= length_arg;;
3327@@ -9534,10 +9669,92 @@
3328 interval= 0;
3329 charset= &my_charset_bin;
3330 geom_type= Field::GEOM_GEOMETRY;
3331- pack_flag= (FIELDFLAG_NUMBER |
3332- ((decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT) |
3333- (maybe_null ? FIELDFLAG_MAYBE_NULL : 0) |
3334- (is_unsigned ? 0 : FIELDFLAG_DECIMAL));
3335+
3336+ DBUG_PRINT("enter", ("sql_type: %d, length: %u, pack_length: %u",
3337+ sql_type_arg, length_arg, pack_length));
3338+
3339+ /*
3340+ These pack flags are crafted to get it correctly through the
3341+ branches of make_field().
3342+ */
3343+ switch (sql_type_arg)
3344+ {
3345+ case MYSQL_TYPE_VARCHAR:
3346+ case MYSQL_TYPE_VAR_STRING:
3347+ case MYSQL_TYPE_STRING:
3348+ case MYSQL_TYPE_SET:
3349+ pack_flag= 0;
3350+ break;
3351+
3352+ case MYSQL_TYPE_GEOMETRY:
3353+ pack_flag= FIELDFLAG_GEOM;
3354+ break;
3355+
3356+ case MYSQL_TYPE_ENUM:
3357+ pack_flag= FIELDFLAG_INTERVAL;
3358+ break;
3359+
3360+ case MYSQL_TYPE_DECIMAL:
3361+ case MYSQL_TYPE_NEWDECIMAL:
3362+ case MYSQL_TYPE_FLOAT:
3363+ case MYSQL_TYPE_DOUBLE:
3364+ pack_flag= FIELDFLAG_DECIMAL | FIELDFLAG_NUMBER |
3365+ (decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT;
3366+ break;
3367+
3368+ case MYSQL_TYPE_TINY_BLOB:
3369+ case MYSQL_TYPE_MEDIUM_BLOB:
3370+ case MYSQL_TYPE_LONG_BLOB:
3371+ case MYSQL_TYPE_BLOB:
3372+ pack_flag= FIELDFLAG_BLOB;
3373+ break;
3374+
3375+ case MYSQL_TYPE_BIT:
3376+ pack_flag= FIELDFLAG_NUMBER | FIELDFLAG_TREAT_BIT_AS_CHAR;
3377+ break;
3378+
3379+ default:
3380+ pack_flag= FIELDFLAG_NUMBER;
3381+ break;
3382+ }
3383+
3384+ /*
3385+ Set the pack flag correctly for the blob-like types. This sets the
3386+ packtype to something that make_field can use. If the pack type is
3387+ not set correctly, the packlength will be reeeeally wierd (like
3388+ 129 or so).
3389+ */
3390+ switch (sql_type_arg)
3391+ {
3392+ case MYSQL_TYPE_ENUM:
3393+ case MYSQL_TYPE_SET:
3394+ case MYSQL_TYPE_TINY_BLOB:
3395+ case MYSQL_TYPE_MEDIUM_BLOB:
3396+ case MYSQL_TYPE_LONG_BLOB:
3397+ case MYSQL_TYPE_BLOB:
3398+ case MYSQL_TYPE_GEOMETRY:
3399+ // If you are going to use the above types, you have to pass a
3400+ // pack_length as parameter. Assert that is really done.
3401+ DBUG_ASSERT(pack_length != ~0U);
3402+ pack_flag|= pack_length_to_packflag(pack_length);
3403+ break;
3404+ default:
3405+ /* Nothing */
3406+ break;
3407+ }
3408+
3409+ pack_flag|=
3410+ (maybe_null ? FIELDFLAG_MAYBE_NULL : 0) |
3411+ (is_unsigned ? 0 : FIELDFLAG_DECIMAL);
3412+
3413+ DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s, pack_type: %d",
3414+ FLAGSTR(pack_flag, FIELDFLAG_BINARY),
3415+ FLAGSTR(pack_flag, FIELDFLAG_NUMBER),
3416+ FLAGSTR(pack_flag, FIELDFLAG_INTERVAL),
3417+ FLAGSTR(pack_flag, FIELDFLAG_GEOM),
3418+ FLAGSTR(pack_flag, FIELDFLAG_BLOB),
3419+ f_packtype(pack_flag)));
3420+ DBUG_VOID_RETURN;
3421 }
3422
3423
3424@@ -10044,6 +10261,14 @@
3425 default: break;
3426 }
3427
3428+ DBUG_PRINT("debug", ("field_type: %d, field_length: %u, interval: %p, pack_flag: %s%s%s%s%s",
3429+ field_type, field_length, interval,
3430+ FLAGSTR(pack_flag, FIELDFLAG_BINARY),
3431+ FLAGSTR(pack_flag, FIELDFLAG_INTERVAL),
3432+ FLAGSTR(pack_flag, FIELDFLAG_NUMBER),
3433+ FLAGSTR(pack_flag, FIELDFLAG_PACK),
3434+ FLAGSTR(pack_flag, FIELDFLAG_BLOB)));
3435+
3436 if (f_is_alpha(pack_flag))
3437 {
3438 if (!f_is_packed(pack_flag))
3439
3440=== modified file 'Percona-Server/sql/field.h'
3441--- Percona-Server/sql/field.h 2011-11-18 13:47:11 +0000
3442+++ Percona-Server/sql/field.h 2012-02-22 07:32:24 +0000
3443@@ -171,22 +171,13 @@
3444 table, which is located on disk).
3445 */
3446 virtual uint32 pack_length_in_rec() const { return pack_length(); }
3447- virtual int compatible_field_size(uint field_metadata,
3448- const Relay_log_info *, uint16 mflags);
3449+ virtual bool compatible_field_size(uint metadata, Relay_log_info *rli,
3450+ uint16 mflags, int *order);
3451 virtual uint pack_length_from_metadata(uint field_metadata)
3452- { return field_metadata; }
3453- /*
3454- This method is used to return the size of the data in a row-based
3455- replication row record. The default implementation of returning 0 is
3456- designed to allow fields that do not use metadata to return TRUE (1)
3457- from compatible_field_size() which uses this function in the comparison.
3458- The default value for field metadata for fields that do not have
3459- metadata is 0. Thus, 0 == 0 means the fields are compatible in size.
3460-
3461- Note: While most classes that override this method return pack_length(),
3462- the classes Field_string, Field_varstring, and Field_blob return
3463- field_length + 1, field_length, and pack_length_no_ptr() respectfully.
3464- */
3465+ {
3466+ DBUG_ENTER("Field::pack_length_from_metadata");
3467+ DBUG_RETURN(field_metadata);
3468+ }
3469 virtual uint row_pack_length() { return 0; }
3470 virtual int save_field_metadata(uchar *first_byte)
3471 { return do_save_field_metadata(first_byte); }
3472@@ -646,6 +637,17 @@
3473 uint size_of() const { return sizeof(*this); }
3474 bool eq_def(Field *field);
3475 int store_decimal(const my_decimal *);
3476+ uint row_pack_length()
3477+ {
3478+ return pack_length();
3479+ }
3480+ uint32 pack_length_from_metadata(uint field_metadata)
3481+ {
3482+ uint32 length= pack_length();
3483+ DBUG_PRINT("result", ("pack_length_from_metadata(%d): %u",
3484+ field_metadata, length));
3485+ return length;
3486+ }
3487 my_decimal *val_decimal(my_decimal *);
3488 uint is_equal(Create_field *new_field);
3489 int check_int(CHARSET_INFO *cs, const char *str, int length,
3490@@ -812,8 +814,8 @@
3491 uint32 pack_length() const { return (uint32) bin_size; }
3492 uint pack_length_from_metadata(uint field_metadata);
3493 uint row_pack_length() { return pack_length(); }
3494- int compatible_field_size(uint field_metadata,
3495- const Relay_log_info *rli, uint16 mflags);
3496+ bool compatible_field_size(uint field_metadata, Relay_log_info *rli,
3497+ uint16 mflags, int *order_var);
3498 uint is_equal(Create_field *new_field);
3499 virtual const uchar *unpack(uchar* to, const uchar *from,
3500 uint param_data, bool low_byte_first);
3501@@ -1508,9 +1510,12 @@
3502 return row_pack_length();
3503 return (((field_metadata >> 4) & 0x300) ^ 0x300) + (field_metadata & 0x00ff);
3504 }
3505- int compatible_field_size(uint field_metadata,
3506- const Relay_log_info *rli, uint16 mflags);
3507- uint row_pack_length() { return (field_length + 1); }
3508+ bool compatible_field_size(uint field_metadata, Relay_log_info *rli,
3509+ uint16 mflags, int *order_var);
3510+ uint row_pack_length()
3511+ {
3512+ return field_length;
3513+ }
3514 int pack_cmp(const uchar *a,const uchar *b,uint key_length,
3515 my_bool insert_or_update);
3516 int pack_cmp(const uchar *b,uint key_length,my_bool insert_or_update);
3517@@ -1977,8 +1982,8 @@
3518 uint pack_length_from_metadata(uint field_metadata);
3519 uint row_pack_length()
3520 { return (bytes_in_rec + ((bit_len > 0) ? 1 : 0)); }
3521- int compatible_field_size(uint field_metadata,
3522- const Relay_log_info *rli, uint16 mflags);
3523+ bool compatible_field_size(uint metadata, Relay_log_info *rli, uint16 mflags,
3524+ int *order_var);
3525 void sql_type(String &str) const;
3526 virtual uchar *pack(uchar *to, const uchar *from,
3527 uint max_length, bool low_byte_first);
3528@@ -2081,7 +2086,8 @@
3529 /* Init for a tmp table field. To be extended if need be. */
3530 void init_for_tmp_table(enum_field_types sql_type_arg,
3531 uint32 max_length, uint32 decimals,
3532- bool maybe_null, bool is_unsigned);
3533+ bool maybe_null, bool is_unsigned,
3534+ uint pack_length= ~0U);
3535
3536 bool init(THD *thd, char *field_name, enum_field_types type, char *length,
3537 char *decimals, uint type_modifier, Item *default_value,
3538
3539=== modified file 'Percona-Server/sql/log_event.cc'
3540--- Percona-Server/sql/log_event.cc 2012-02-22 07:32:22 +0000
3541+++ Percona-Server/sql/log_event.cc 2012-02-22 07:32:24 +0000
3542@@ -1588,37 +1588,14 @@
3543 /* a long CHAR() field: see #37426 */
3544 length= byte1 | (((byte0 & 0x30) ^ 0x30) << 4);
3545 type= byte0 | 0x30;
3546- goto beg;
3547- }
3548-
3549- switch (byte0)
3550- {
3551- case MYSQL_TYPE_SET:
3552- case MYSQL_TYPE_ENUM:
3553- case MYSQL_TYPE_STRING:
3554- type= byte0;
3555- length= byte1;
3556- break;
3557-
3558- default:
3559-
3560- {
3561- char tmp[5];
3562- my_snprintf(tmp, sizeof(tmp), "%04X", meta);
3563- my_b_printf(file,
3564- "!! Don't know how to handle column type=%d meta=%d (%s)",
3565- type, meta, tmp);
3566- return 0;
3567- }
3568- }
3569+ }
3570+ else
3571+ length= meta & 0xFF;
3572 }
3573 else
3574 length= meta;
3575 }
3576
3577-
3578-beg:
3579-
3580 switch (type) {
3581 case MYSQL_TYPE_LONG:
3582 {
3583@@ -1755,6 +1732,33 @@
3584 return 3;
3585 }
3586
3587+ case MYSQL_TYPE_NEWDATE:
3588+ {
3589+ uint32 tmp= uint3korr(ptr);
3590+ int part;
3591+ char buf[11];
3592+ char *pos= &buf[10];
3593+
3594+ /* Copied from field.cc */
3595+ *pos--= 0; // End NULL
3596+ part= (int) (tmp & 31);
3597+ *pos--= (char) ('0'+part%10);
3598+ *pos--= (char) ('0'+part/10);
3599+ *pos--= ':';
3600+ part= (int) (tmp >> 5 & 15);
3601+ *pos--= (char) ('0'+part%10);
3602+ *pos--= (char) ('0'+part/10);
3603+ *pos--= ':';
3604+ part= (int) (tmp >> 9);
3605+ *pos--= (char) ('0'+part%10); part/=10;
3606+ *pos--= (char) ('0'+part%10); part/=10;
3607+ *pos--= (char) ('0'+part%10); part/=10;
3608+ *pos= (char) ('0'+part);
3609+ my_b_printf(file , "'%s'", buf);
3610+ my_snprintf(typestr, typestr_length, "DATE");
3611+ return 3;
3612+ }
3613+
3614 case MYSQL_TYPE_DATE:
3615 {
3616 uint i32= uint3korr(ptr);
3617@@ -1773,7 +1777,8 @@
3618 }
3619
3620 case MYSQL_TYPE_ENUM:
3621- switch (length) {
3622+ switch (meta & 0xFF)
3623+ {
3624 case 1:
3625 my_b_printf(file, "%d", (int) *ptr);
3626 my_snprintf(typestr, typestr_length, "ENUM(1 byte)");
3627@@ -1786,15 +1791,15 @@
3628 return 2;
3629 }
3630 default:
3631- my_b_printf(file, "!! Unknown ENUM packlen=%d", length);
3632+ my_b_printf(file, "!! Unknown ENUM packlen=%d", meta & 0xFF);
3633 return 0;
3634 }
3635 break;
3636
3637 case MYSQL_TYPE_SET:
3638- my_b_write_bit(file, ptr , length * 8);
3639- my_snprintf(typestr, typestr_length, "SET(%d bytes)", length);
3640- return length;
3641+ my_b_write_bit(file, ptr , (meta & 0xFF) * 8);
3642+ my_snprintf(typestr, typestr_length, "SET(%d bytes)", meta & 0xFF);
3643+ return meta & 0xFF;
3644
3645 case MYSQL_TYPE_BLOB:
3646 switch (meta) {
3647@@ -7546,11 +7551,19 @@
3648 */
3649
3650 {
3651+ DBUG_PRINT("debug", ("Checking compability of tables to lock - tables_to_lock: %p",
3652+ rli->tables_to_lock));
3653 RPL_TABLE_LIST *ptr= rli->tables_to_lock;
3654 for ( ; ptr ; ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global))
3655 {
3656- if (ptr->m_tabledef.compatible_with(rli, ptr->table))
3657+ TABLE *conv_table;
3658+ if (!ptr->m_tabledef.compatible_with(thd,
3659+ const_cast<Relay_log_info*>(rli),
3660+ ptr->table, &conv_table))
3661 {
3662+ DBUG_PRINT("debug", ("Table: %s.%s is not compatible with master",
3663+ ptr->table->s->db.str,
3664+ ptr->table->s->table_name.str));
3665 /*
3666 We should not honour --slave-skip-errors at this point as we are
3667 having severe errors which should not be skiped.
3668@@ -7561,12 +7574,17 @@
3669 const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
3670 DBUG_RETURN(ERR_BAD_TABLE_DEF);
3671 }
3672+ DBUG_PRINT("debug", ("Table: %s.%s is compatible with master"
3673+ " - conv_table: %p",
3674+ ptr->table->s->db.str,
3675+ ptr->table->s->table_name.str, conv_table));
3676+ ptr->m_conv_table= conv_table;
3677 }
3678 }
3679
3680 /*
3681- ... and then we add all the tables to the table map and remove
3682- them from tables to lock.
3683+ ... and then we add all the tables to the table map and but keep
3684+ them in the tables to lock list.
3685
3686 We also invalidate the query cache for all the tables, since
3687 they will now be changed.
3688@@ -8201,7 +8219,10 @@
3689 DBUG_ENTER("Table_map_log_event::save_field_metadata");
3690 int index= 0;
3691 for (unsigned int i= 0 ; i < m_table->s->fields ; i++)
3692+ {
3693+ DBUG_PRINT("debug", ("field_type: %d", m_coltype[i]));
3694 index+= m_table->s->field[i]->save_field_metadata(&m_field_metadata[index]);
3695+ }
3696 DBUG_RETURN(index);
3697 }
3698 #endif /* !defined(MYSQL_CLIENT) */
3699
3700=== modified file 'Percona-Server/sql/log_event_old.cc'
3701--- Percona-Server/sql/log_event_old.cc 2011-06-30 15:37:13 +0000
3702+++ Percona-Server/sql/log_event_old.cc 2012-02-22 07:32:24 +0000
3703@@ -121,14 +121,25 @@
3704 RPL_TABLE_LIST *ptr= rli->tables_to_lock;
3705 for ( ; ptr ; ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global))
3706 {
3707- if (ptr->m_tabledef.compatible_with(rli, ptr->table))
3708+ TABLE *conv_table;
3709+ if (!ptr->m_tabledef.compatible_with(thd,
3710+ const_cast<Relay_log_info*>(rli),
3711+ ptr->table, &conv_table))
3712 {
3713+ DBUG_PRINT("debug", ("Table: %s.%s is not compatible with master",
3714+ ptr->table->s->db.str,
3715+ ptr->table->s->table_name.str));
3716 mysql_unlock_tables(ev_thd, ev_thd->lock);
3717 ev_thd->lock= 0;
3718 ev_thd->is_slave_error= 1;
3719 const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
3720 DBUG_RETURN(Old_rows_log_event::ERR_BAD_TABLE_DEF);
3721 }
3722+ DBUG_PRINT("debug", ("Table: %s.%s is compatible with master"
3723+ " - conv_table: %p",
3724+ ptr->table->s->db.str,
3725+ ptr->table->s->table_name.str, conv_table));
3726+ ptr->m_conv_table= conv_table;
3727 }
3728 }
3729
3730@@ -1615,7 +1626,10 @@
3731 RPL_TABLE_LIST *ptr= rli->tables_to_lock;
3732 for ( ; ptr ; ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global))
3733 {
3734- if (ptr->m_tabledef.compatible_with(rli, ptr->table))
3735+ TABLE *conv_table;
3736+ if (ptr->m_tabledef.compatible_with(thd,
3737+ const_cast<Relay_log_info*>(rli),
3738+ ptr->table, &conv_table))
3739 {
3740 mysql_unlock_tables(thd, thd->lock);
3741 thd->lock= 0;
3742@@ -1623,12 +1637,14 @@
3743 const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
3744 DBUG_RETURN(ERR_BAD_TABLE_DEF);
3745 }
3746+ ptr->m_conv_table= conv_table;
3747 }
3748 }
3749
3750 /*
3751- ... and then we add all the tables to the table map and remove
3752- them from tables to lock.
3753+ ... and then we add all the tables to the table map but keep
3754+ them in the tables to lock list.
3755+
3756
3757 We also invalidate the query cache for all the tables, since
3758 they will now be changed.
3759
3760=== modified file 'Percona-Server/sql/mysql_priv.h'
3761--- Percona-Server/sql/mysql_priv.h 2012-02-22 07:32:22 +0000
3762+++ Percona-Server/sql/mysql_priv.h 2012-02-22 07:32:24 +0000
3763@@ -2117,6 +2117,7 @@
3764 extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
3765 extern my_bool opt_slave_compressed_protocol, use_temp_pool;
3766 extern ulong slave_exec_mode_options;
3767+extern ulong slave_type_conversions_options;
3768 extern my_bool opt_readonly, lower_case_file_system;
3769 extern my_bool opt_userstat_running, opt_thread_statistics;
3770 extern my_bool opt_optimizer_fix;
3771
3772=== modified file 'Percona-Server/sql/mysqld.cc'
3773--- Percona-Server/sql/mysqld.cc 2012-02-22 07:32:22 +0000
3774+++ Percona-Server/sql/mysqld.cc 2012-02-22 07:32:24 +0000
3775@@ -599,6 +599,8 @@
3776 ulong slave_net_timeout, slave_trans_retries;
3777 ulong slave_exec_mode_options;
3778 static const char *slave_exec_mode_str= "STRICT";
3779+ulong slave_type_conversions_options;
3780+const char *slave_type_conversions_default= "";
3781 ulong thread_cache_size=0, thread_pool_size= 0;
3782 ulong binlog_cache_size=0;
3783 ulonglong max_binlog_cache_size=0;
3784@@ -5910,6 +5912,7 @@
3785 #endif /* defined(ENABLED_DEBUG_SYNC) */
3786 OPT_OLD_MODE,
3787 OPT_SLAVE_EXEC_MODE,
3788+ OPT_SLAVE_TYPE_CONVERSIONS,
3789 OPT_GENERAL_LOG_FILE,
3790 OPT_SLOW_QUERY_LOG_FILE,
3791 OPT_USERSTAT_RUNNING,
3792@@ -6747,6 +6750,15 @@
3793 "not stop for operations that are idempotent. In STRICT mode, replication "
3794 "will stop on any unexpected difference between the master and the slave.",
3795 &slave_exec_mode_str, &slave_exec_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3796+ {"slave-type-conversions", OPT_SLAVE_TYPE_CONVERSIONS,
3797+ "Set of slave type conversions that are enabled. Legal values are:"
3798+ " ALL_LOSSY to enable lossy conversions and"
3799+ " ALL_NON_LOSSY to enable non-lossy conversions."
3800+ " If the variable is assigned the empty set, no conversions are"
3801+ " allowed and it is expected that the types match exactly.",
3802+ (uchar**) &slave_type_conversions_default,
3803+ (uchar**) &slave_type_conversions_default,
3804+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3805 #endif
3806 {"slow-query-log", OPT_SLOW_LOG,
3807 "Enable/disable slow query log.", &opt_slow_log,
3808@@ -8152,6 +8164,11 @@
3809 slave_exec_mode_options= find_bit_type_or_exit(slave_exec_mode_str,
3810 &slave_exec_mode_typelib,
3811 NULL, &error);
3812+ /* Slave type conversions */
3813+ slave_type_conversions_options= 0;
3814+ slave_type_conversions_options=
3815+ find_bit_type_or_exit(slave_type_conversions_default, &slave_type_conversions_typelib,
3816+ NULL, &error);
3817 /* Default mode string must not yield a error. */
3818 DBUG_ASSERT(!error);
3819 if (error)
3820@@ -8404,6 +8421,12 @@
3821 if (error)
3822 return 1;
3823 break;
3824+ case OPT_SLAVE_TYPE_CONVERSIONS:
3825+ slave_type_conversions_options= (uint)
3826+ find_bit_type_or_exit(argument, &slave_type_conversions_typelib, "", &error);
3827+ if (error)
3828+ return 1;
3829+ break;
3830 #endif
3831 case OPT_SAFEMALLOC_MEM_LIMIT:
3832 #if !defined(DBUG_OFF) && defined(SAFEMALLOC)
3833
3834=== modified file 'Percona-Server/sql/rpl_record.cc'
3835--- Percona-Server/sql/rpl_record.cc 2011-06-30 15:37:13 +0000
3836+++ Percona-Server/sql/rpl_record.cc 2012-02-22 07:32:24 +0000
3837@@ -106,10 +106,10 @@
3838 #endif
3839 pack_ptr= field->pack(pack_ptr, field->ptr + offset,
3840 field->max_data_length(), TRUE);
3841- DBUG_PRINT("debug", ("field: %s; pack_ptr: 0x%lx;"
3842+ DBUG_PRINT("debug", ("field: %s; real_type: %d, pack_ptr: 0x%lx;"
3843 " pack_ptr':0x%lx; bytes: %d",
3844- field->field_name, (ulong) old_pack_ptr,
3845- (ulong) pack_ptr,
3846+ field->field_name, field->real_type(),
3847+ (ulong) old_pack_ptr, (ulong) pack_ptr,
3848 (int) (pack_ptr - old_pack_ptr)));
3849 }
3850
3851@@ -152,13 +152,20 @@
3852 the various member functions of Field and subclasses expect to
3853 write.
3854
3855- The row is assumed to only consist of the fields for which the corresponding
3856- bit in bitset @c cols is set; the other parts of the record are left alone.
3857+ The row is assumed to only consist of the fields for which the
3858+ corresponding bit in bitset @c cols is set; the other parts of the
3859+ record are left alone.
3860
3861 At most @c colcnt columns are read: if the table is larger than
3862 that, the remaining fields are not filled in.
3863
3864- @param rli Relay log info
3865+ @note The relay log information can be NULL, which means that no
3866+ checking or comparison with the source table is done, simply
3867+ because it is not used. This feature is used by MySQL Backup to
3868+ unpack a row from from the backup image, but can be used for other
3869+ purposes as well.
3870+
3871+ @param rli Relay log info, which can be NULL
3872 @param table Table to unpack into
3873 @param colcnt Number of columns to read from record
3874 @param row_data
3875@@ -172,11 +179,9 @@
3876
3877 @retval 0 No error
3878
3879- @retval ER_NO_DEFAULT_FOR_FIELD
3880- Returned if one of the fields existing on the slave but not on the
3881- master does not have a default value (and isn't nullable)
3882-
3883- */
3884+ @retval HA_ERR_GENERIC
3885+ A generic, internal, error caused the unpacking to fail.
3886+*/
3887 #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
3888 int
3889 unpack_row(Relay_log_info const *rli,
3890@@ -186,6 +191,7 @@
3891 {
3892 DBUG_ENTER("unpack_row");
3893 DBUG_ASSERT(row_data);
3894+ DBUG_ASSERT(table);
3895 size_t const master_null_byte_count= (bitmap_bits_set(cols) + 7) / 8;
3896 int error= 0;
3897
3898@@ -203,10 +209,37 @@
3899 // The "current" null bits
3900 unsigned int null_bits= *null_ptr++;
3901 uint i= 0;
3902- table_def *tabledef= ((Relay_log_info*)rli)->get_tabledef(table);
3903+ table_def *tabledef= NULL;
3904+ TABLE *conv_table= NULL;
3905+ bool table_found= rli && rli->get_table_data(table, &tabledef, &conv_table);
3906+ DBUG_PRINT("debug", ("Table data: table_found: %d, tabldef: %p, conv_table: %p",
3907+ table_found, tabledef, conv_table));
3908+ DBUG_ASSERT(table_found);
3909+
3910+ /*
3911+ If rli is NULL it means that there is no source table and that the
3912+ row shall just be unpacked without doing any checks. This feature
3913+ is used by MySQL Backup, but can be used for other purposes as
3914+ well.
3915+ */
3916+ if (rli && !table_found)
3917+ DBUG_RETURN(HA_ERR_GENERIC);
3918+
3919 for (field_ptr= begin_ptr ; field_ptr < end_ptr && *field_ptr ; ++field_ptr)
3920 {
3921- Field *const f= *field_ptr;
3922+ /*
3923+ If there is a conversion table, we pick up the field pointer to
3924+ the conversion table. If the conversion table or the field
3925+ pointer is NULL, no conversions are necessary.
3926+ */
3927+ Field *conv_field=
3928+ conv_table ? conv_table->field[field_ptr - begin_ptr] : NULL;
3929+ Field *const f=
3930+ conv_field ? conv_field : *field_ptr;
3931+ DBUG_PRINT("debug", ("Conversion %srequired for field '%s' (#%ld)",
3932+ conv_field ? "" : "not ",
3933+ (*field_ptr)->field_name, field_ptr - begin_ptr));
3934+ DBUG_ASSERT(f != NULL);
3935
3936 /*
3937 No need to bother about columns that does not exist: they have
3938@@ -279,6 +312,39 @@
3939 (int) (pack_ptr - old_pack_ptr)));
3940 }
3941
3942+ /*
3943+ If conv_field is set, then we are doing a conversion. In this
3944+ case, we have unpacked the master data to the conversion
3945+ table, so we need to copy the value stored in the conversion
3946+ table into the final table and do the conversion at the same time.
3947+ */
3948+ if (conv_field)
3949+ {
3950+ Copy_field copy;
3951+#ifndef DBUG_OFF
3952+ char source_buf[MAX_FIELD_WIDTH];
3953+ char value_buf[MAX_FIELD_WIDTH];
3954+ String source_type(source_buf, sizeof(source_buf), system_charset_info);
3955+ String value_string(value_buf, sizeof(value_buf), system_charset_info);
3956+ conv_field->sql_type(source_type);
3957+ conv_field->val_str(&value_string);
3958+ DBUG_PRINT("debug", ("Copying field '%s' of type '%s' with value '%s'",
3959+ (*field_ptr)->field_name,
3960+ source_type.c_ptr_safe(), value_string.c_ptr_safe()));
3961+#endif
3962+ copy.set(*field_ptr, f, TRUE);
3963+ (*copy.do_copy)(&copy);
3964+#ifndef DBUG_OFF
3965+ char target_buf[MAX_FIELD_WIDTH];
3966+ String target_type(target_buf, sizeof(target_buf), system_charset_info);
3967+ (*field_ptr)->sql_type(target_type);
3968+ (*field_ptr)->val_str(&value_string);
3969+ DBUG_PRINT("debug", ("Value of field '%s' of type '%s' is now '%s'",
3970+ (*field_ptr)->field_name,
3971+ target_type.c_ptr_safe(), value_string.c_ptr_safe()));
3972+#endif
3973+ }
3974+
3975 null_mask <<= 1;
3976 }
3977 i++;
3978
3979=== modified file 'Percona-Server/sql/rpl_rli.h'
3980--- Percona-Server/sql/rpl_rli.h 2012-02-22 07:32:22 +0000
3981+++ Percona-Server/sql/rpl_rli.h 2012-02-22 07:32:24 +0000
3982@@ -332,13 +332,21 @@
3983 uint tables_to_lock_count; /* RBR: Count of tables to lock */
3984 table_mapping m_table_map; /* RBR: Mapping table-id to table */
3985
3986- inline table_def *get_tabledef(TABLE *tbl)
3987+ bool get_table_data(TABLE *table_arg, table_def **tabledef_var, TABLE **conv_table_var) const
3988 {
3989- table_def *td= 0;
3990- for (TABLE_LIST *ptr= tables_to_lock; ptr && !td; ptr= ptr->next_global)
3991- if (ptr->table == tbl)
3992- td= &((RPL_TABLE_LIST *)ptr)->m_tabledef;
3993- return (td);
3994+ DBUG_ASSERT(tabledef_var && conv_table_var);
3995+ for (TABLE_LIST *ptr= tables_to_lock ; ptr != NULL ; ptr= ptr->next_global)
3996+ if (ptr->table == table_arg)
3997+ {
3998+ *tabledef_var= &static_cast<RPL_TABLE_LIST*>(ptr)->m_tabledef;
3999+ *conv_table_var= static_cast<RPL_TABLE_LIST*>(ptr)->m_conv_table;
4000+ DBUG_PRINT("debug", ("Fetching table data for table %s.%s:"
4001+ " tabledef: %p, conv_table: %p",
4002+ table_arg->s->db.str, table_arg->s->table_name.str,
4003+ *tabledef_var, *conv_table_var));
4004+ return true;
4005+ }
4006+ return false;
4007 }
4008
4009 /*
4010
4011=== modified file 'Percona-Server/sql/rpl_utility.cc'
4012--- Percona-Server/sql/rpl_utility.cc 2011-06-30 15:37:13 +0000
4013+++ Percona-Server/sql/rpl_utility.cc 2012-02-22 07:32:24 +0000
4014@@ -16,8 +16,177 @@
4015 */
4016
4017 #include "rpl_utility.h"
4018+
4019+#ifndef MYSQL_CLIENT
4020 #include "rpl_rli.h"
4021
4022+/**
4023+ Function to compare two size_t integers for their relative
4024+ order. Used below.
4025+ */
4026+int compare(size_t a, size_t b)
4027+{
4028+ if (a < b)
4029+ return -1;
4030+ if (b < a)
4031+ return 1;
4032+ return 0;
4033+}
4034+
4035+
4036+/**
4037+ Max value for an unsigned integer of 'bits' bits.
4038+
4039+ The somewhat contorted expression is to avoid overflow.
4040+ */
4041+uint32 uint_max(int bits)
4042+{
4043+ return (((1UL << (bits - 1)) - 1) << 1) | 1;
4044+}
4045+
4046+
4047+/**
4048+ Compute the maximum display length of a field.
4049+
4050+ @param sql_type Type of the field
4051+ @param metadata The metadata from the master for the field.
4052+ @return Maximum length of the field in bytes.
4053+ */
4054+static uint32
4055+max_display_length_for_field(enum_field_types sql_type, unsigned int metadata)
4056+{
4057+ DBUG_PRINT("debug", ("sql_type: %d, metadata: 0x%x", sql_type, metadata));
4058+ DBUG_ASSERT(metadata >> 16 == 0);
4059+
4060+ switch (sql_type) {
4061+ case MYSQL_TYPE_NEWDECIMAL:
4062+ return metadata >> 8;
4063+
4064+ case MYSQL_TYPE_FLOAT:
4065+ return 12;
4066+
4067+ case MYSQL_TYPE_DOUBLE:
4068+ return 22;
4069+
4070+ case MYSQL_TYPE_SET:
4071+ case MYSQL_TYPE_ENUM:
4072+ return metadata & 0x00ff;
4073+
4074+ case MYSQL_TYPE_STRING:
4075+ {
4076+ uchar type= metadata >> 8;
4077+ if (type == MYSQL_TYPE_SET || type == MYSQL_TYPE_ENUM)
4078+ return metadata & 0xff;
4079+ else
4080+ /* This is taken from Field_string::unpack. */
4081+ return (((metadata >> 4) & 0x300) ^ 0x300) + (metadata & 0x00ff);
4082+ }
4083+
4084+ case MYSQL_TYPE_YEAR:
4085+ case MYSQL_TYPE_TINY:
4086+ return 4;
4087+
4088+ case MYSQL_TYPE_SHORT:
4089+ return 6;
4090+
4091+ case MYSQL_TYPE_INT24:
4092+ return 9;
4093+
4094+ case MYSQL_TYPE_LONG:
4095+ return 11;
4096+
4097+#ifdef HAVE_LONG_LONG
4098+ case MYSQL_TYPE_LONGLONG:
4099+ return 20;
4100+
4101+#endif
4102+ case MYSQL_TYPE_NULL:
4103+ return 0;
4104+
4105+ case MYSQL_TYPE_NEWDATE:
4106+ return 3;
4107+
4108+ case MYSQL_TYPE_DATE:
4109+ case MYSQL_TYPE_TIME:
4110+ return 3;
4111+
4112+ case MYSQL_TYPE_TIMESTAMP:
4113+ return 4;
4114+
4115+ case MYSQL_TYPE_DATETIME:
4116+ return 8;
4117+
4118+ case MYSQL_TYPE_BIT:
4119+ /*
4120+ Decode the size of the bit field from the master.
4121+ */
4122+ DBUG_ASSERT((metadata & 0xff) <= 7);
4123+ return 8 * (metadata >> 8U) + (metadata & 0x00ff);
4124+
4125+ case MYSQL_TYPE_VAR_STRING:
4126+ case MYSQL_TYPE_VARCHAR:
4127+ return metadata;
4128+
4129+ /*
4130+ The actual length for these types does not really matter since
4131+ they are used to calc_pack_length, which ignores the given
4132+ length for these types.
4133+
4134+ Since we want this to be accurate for other uses, we return the
4135+ maximum size in bytes of these BLOBs.
4136+ */
4137+
4138+ case MYSQL_TYPE_TINY_BLOB:
4139+ return uint_max(1 * 8);
4140+
4141+ case MYSQL_TYPE_MEDIUM_BLOB:
4142+ return uint_max(3 * 8);
4143+
4144+ case MYSQL_TYPE_BLOB:
4145+ /*
4146+ For the blob type, Field::real_type() lies and say that all
4147+ blobs are of type MYSQL_TYPE_BLOB. In that case, we have to look
4148+ at the length instead to decide what the max display size is.
4149+ */
4150+ return uint_max(metadata * 8);
4151+
4152+ case MYSQL_TYPE_LONG_BLOB:
4153+ case MYSQL_TYPE_GEOMETRY:
4154+ return uint_max(4 * 8);
4155+
4156+ default:
4157+ return ~(uint32) 0;
4158+ }
4159+}
4160+
4161+
4162+/*
4163+ Compare the pack lengths of a source field (on the master) and a
4164+ target field (on the slave).
4165+
4166+ @param field Target field.
4167+ @param type Source field type.
4168+ @param metadata Source field metadata.
4169+
4170+ @retval -1 The length of the source field is smaller than the target field.
4171+ @retval 0 The length of the source and target fields are the same.
4172+ @retval 1 The length of the source field is greater than the target field.
4173+ */
4174+int compare_lengths(Field *field, enum_field_types source_type, uint16 metadata)
4175+{
4176+ DBUG_ENTER("compare_lengths");
4177+ size_t const source_length=
4178+ max_display_length_for_field(source_type, metadata);
4179+ size_t const target_length= field->max_display_length();
4180+ DBUG_PRINT("debug", ("source_length: %lu, source_type: %u,"
4181+ " target_length: %lu, target_type: %u",
4182+ (unsigned long) source_length, source_type,
4183+ (unsigned long) target_length, field->real_type()));
4184+ int result= compare(source_length, target_length);
4185+ DBUG_PRINT("result", ("%d", result));
4186+ DBUG_RETURN(result);
4187+}
4188+
4189 /*********************************************************************
4190 * table_def member definitions *
4191 *********************************************************************/
4192@@ -171,58 +340,714 @@
4193 return length;
4194 }
4195
4196-/*
4197- Is the definition compatible with a table?
4198-
4199-*/
4200-int
4201-table_def::compatible_with(Relay_log_info const *rli_arg, TABLE *table)
4202+/**
4203+ */
4204+void show_sql_type(enum_field_types type, uint16 metadata, String *str)
4205+{
4206+ DBUG_ENTER("show_sql_type");
4207+ DBUG_PRINT("enter", ("type: %d, metadata: 0x%x", type, metadata));
4208+
4209+ switch (type)
4210+ {
4211+ case MYSQL_TYPE_TINY:
4212+ str->set_ascii(STRING_WITH_LEN("tinyint"));
4213+ break;
4214+
4215+ case MYSQL_TYPE_SHORT:
4216+ str->set_ascii(STRING_WITH_LEN("smallint"));
4217+ break;
4218+
4219+ case MYSQL_TYPE_LONG:
4220+ str->set_ascii(STRING_WITH_LEN("int"));
4221+ break;
4222+
4223+ case MYSQL_TYPE_FLOAT:
4224+ str->set_ascii(STRING_WITH_LEN("float"));
4225+ break;
4226+
4227+ case MYSQL_TYPE_DOUBLE:
4228+ str->set_ascii(STRING_WITH_LEN("double"));
4229+ break;
4230+
4231+ case MYSQL_TYPE_NULL:
4232+ str->set_ascii(STRING_WITH_LEN("null"));
4233+ break;
4234+
4235+ case MYSQL_TYPE_TIMESTAMP:
4236+ str->set_ascii(STRING_WITH_LEN("timestamp"));
4237+ break;
4238+
4239+ case MYSQL_TYPE_LONGLONG:
4240+ str->set_ascii(STRING_WITH_LEN("bigint"));
4241+ break;
4242+
4243+ case MYSQL_TYPE_INT24:
4244+ str->set_ascii(STRING_WITH_LEN("mediumint"));
4245+ break;
4246+
4247+ case MYSQL_TYPE_NEWDATE:
4248+ case MYSQL_TYPE_DATE:
4249+ str->set_ascii(STRING_WITH_LEN("date"));
4250+ break;
4251+
4252+ case MYSQL_TYPE_TIME:
4253+ str->set_ascii(STRING_WITH_LEN("time"));
4254+ break;
4255+
4256+ case MYSQL_TYPE_DATETIME:
4257+ str->set_ascii(STRING_WITH_LEN("datetime"));
4258+ break;
4259+
4260+ case MYSQL_TYPE_YEAR:
4261+ str->set_ascii(STRING_WITH_LEN("year"));
4262+ break;
4263+
4264+ case MYSQL_TYPE_VAR_STRING:
4265+ case MYSQL_TYPE_VARCHAR:
4266+ {
4267+ CHARSET_INFO *cs= str->charset();
4268+ uint32 length=
4269+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
4270+ "varchar(%u)", metadata);
4271+ str->length(length);
4272+ }
4273+ break;
4274+
4275+ case MYSQL_TYPE_BIT:
4276+ {
4277+ CHARSET_INFO *cs= str->charset();
4278+ int bit_length= 8 * (metadata >> 8) + (metadata & 0xFF);
4279+ uint32 length=
4280+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
4281+ "bit(%d)", bit_length);
4282+ str->length(length);
4283+ }
4284+ break;
4285+
4286+ case MYSQL_TYPE_DECIMAL:
4287+ {
4288+ CHARSET_INFO *cs= str->charset();
4289+ uint32 length=
4290+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
4291+ "decimal(%d,?)", metadata);
4292+ str->length(length);
4293+ }
4294+ break;
4295+
4296+ case MYSQL_TYPE_NEWDECIMAL:
4297+ {
4298+ CHARSET_INFO *cs= str->charset();
4299+ uint32 length=
4300+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
4301+ "decimal(%d,%d)", metadata >> 8, metadata & 0xff);
4302+ str->length(length);
4303+ }
4304+ break;
4305+
4306+ case MYSQL_TYPE_ENUM:
4307+ str->set_ascii(STRING_WITH_LEN("enum"));
4308+ break;
4309+
4310+ case MYSQL_TYPE_SET:
4311+ str->set_ascii(STRING_WITH_LEN("set"));
4312+ break;
4313+
4314+ case MYSQL_TYPE_BLOB:
4315+ /*
4316+ Field::real_type() lies regarding the actual type of a BLOB, so
4317+ it is necessary to check the pack length to figure out what kind
4318+ of blob it really is.
4319+ */
4320+ switch (get_blob_type_from_length(metadata))
4321+ {
4322+ case MYSQL_TYPE_TINY_BLOB:
4323+ str->set_ascii(STRING_WITH_LEN("tinyblob"));
4324+ break;
4325+
4326+ case MYSQL_TYPE_MEDIUM_BLOB:
4327+ str->set_ascii(STRING_WITH_LEN("mediumblob"));
4328+ break;
4329+
4330+ case MYSQL_TYPE_LONG_BLOB:
4331+ str->set_ascii(STRING_WITH_LEN("longblob"));
4332+ break;
4333+
4334+ case MYSQL_TYPE_BLOB:
4335+ str->set_ascii(STRING_WITH_LEN("blob"));
4336+ break;
4337+
4338+ default:
4339+ DBUG_ASSERT(0);
4340+ break;
4341+ }
4342+ break;
4343+
4344+ case MYSQL_TYPE_STRING:
4345+ {
4346+ /*
4347+ This is taken from Field_string::unpack.
4348+ */
4349+ CHARSET_INFO *cs= str->charset();
4350+ uint bytes= (((metadata >> 4) & 0x300) ^ 0x300) + (metadata & 0x00ff);
4351+ uint32 length=
4352+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
4353+ "char(%d)", bytes / cs->mbmaxlen);
4354+ str->length(length);
4355+ }
4356+ break;
4357+
4358+ case MYSQL_TYPE_GEOMETRY:
4359+ str->set_ascii(STRING_WITH_LEN("geometry"));
4360+ break;
4361+
4362+ default:
4363+ str->set_ascii(STRING_WITH_LEN("<unknown type>"));
4364+ }
4365+ DBUG_VOID_RETURN;
4366+}
4367+
4368+
4369+/**
4370+ Check the order variable and print errors if the order is not
4371+ acceptable according to the current settings.
4372+
4373+ @param order The computed order of the conversion needed.
4374+ @param rli The relay log info data structure: for error reporting.
4375+*/
4376+bool is_conversion_ok(int order, Relay_log_info *rli)
4377+{
4378+ DBUG_ENTER("is_conversion_ok");
4379+ bool allow_non_lossy= (slave_type_conversions_options & SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY);
4380+ bool allow_lossy= (slave_type_conversions_options & SLAVE_TYPE_CONVERSIONS_ALL_LOSSY);
4381+
4382+ DBUG_PRINT("enter", ("order: %d, flags:%s%s", order,
4383+ allow_non_lossy ? " ALL_NON_LOSSY" : "",
4384+ allow_lossy ? " ALL_LOSSY" : ""));
4385+ if (order < 0 && !allow_non_lossy)
4386+ {
4387+ /* !!! Add error message saying that non-lossy conversions need to be allowed. */
4388+ DBUG_RETURN(false);
4389+ }
4390+
4391+ if (order > 0 && !allow_lossy)
4392+ {
4393+ /* !!! Add error message saying that lossy conversions need to be allowed. */
4394+ DBUG_RETURN(false);
4395+ }
4396+
4397+ DBUG_RETURN(true);
4398+}
4399+
4400+
4401+/**
4402+ Can a type potentially be converted to another type?
4403+
4404+ This function check if the types are convertible and what
4405+ conversion is required.
4406+
4407+ If conversion is not possible, and error is printed.
4408+
4409+ If conversion is possible:
4410+
4411+ - *order will be set to -1 if source type is smaller than target
4412+ type and a non-lossy conversion can be required. This includes
4413+ the case where the field types are different but types could
4414+ actually be converted in either direction.
4415+
4416+ - *order will be set to 0 if no conversion is required.
4417+
4418+ - *order will be set to 1 if the source type is strictly larger
4419+ than the target type and that conversion is potentially lossy.
4420+
4421+ @param[in] field Target field
4422+ @param[in] type Source field type
4423+ @param[in] metadata Source field metadata
4424+ @param[in] rli Relay log info (for error reporting)
4425+ @param[in] mflags Flags from the table map event
4426+ @param[out] order Order between source field and target field
4427+
4428+ @return @c true if conversion is possible according to the current
4429+ settings, @c false if conversion is not possible according to the
4430+ current setting.
4431+ */
4432+static bool
4433+can_convert_field_to(Field *field,
4434+ enum_field_types source_type, uint16 metadata,
4435+ Relay_log_info *rli, uint16 mflags,
4436+ int *order_var)
4437+{
4438+ DBUG_ENTER("can_convert_field_to");
4439+#ifndef DBUG_OFF
4440+ char field_type_buf[MAX_FIELD_WIDTH];
4441+ String field_type(field_type_buf, sizeof(field_type_buf), field->charset());
4442+ field->sql_type(field_type);
4443+ DBUG_PRINT("enter", ("field_type: %s, target_type: %d, source_type: %d, source_metadata: 0x%x",
4444+ field_type.c_ptr_safe(), field->real_type(), source_type, metadata));
4445+#endif
4446+ /*
4447+ If the real type is the same, we need to check the metadata to
4448+ decide if conversions are allowed.
4449+ */
4450+ if (field->real_type() == source_type)
4451+ {
4452+ if (metadata == 0) // Metadata can only be zero if no metadata was provided
4453+ {
4454+ /*
4455+ If there is no metadata, we either have an old event where no
4456+ metadata were supplied, or a type that does not require any
4457+ metadata. In either case, conversion can be done but no
4458+ conversion table is necessary.
4459+ */
4460+ DBUG_PRINT("debug", ("Base types are identical, but there is no metadata"));
4461+ *order_var= 0;
4462+ DBUG_RETURN(true);
4463+ }
4464+
4465+ DBUG_PRINT("debug", ("Base types are identical, doing field size comparison"));
4466+ if (field->compatible_field_size(metadata, rli, mflags, order_var))
4467+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
4468+ else
4469+ DBUG_RETURN(false);
4470+ }
4471+ else if (!slave_type_conversions_options)
4472+ DBUG_RETURN(false);
4473+
4474+ /*
4475+ Here, from and to will always be different. Since the types are
4476+ different, we cannot use the compatible_field_size() function, but
4477+ have to rely on hard-coded max-sizes for fields.
4478+ */
4479+
4480+ DBUG_PRINT("debug", ("Base types are different, checking conversion"));
4481+ switch (source_type) // Source type (on master)
4482+ {
4483+ case MYSQL_TYPE_DECIMAL:
4484+ case MYSQL_TYPE_NEWDECIMAL:
4485+ case MYSQL_TYPE_FLOAT:
4486+ case MYSQL_TYPE_DOUBLE:
4487+ switch (field->real_type())
4488+ {
4489+ case MYSQL_TYPE_NEWDECIMAL:
4490+ /*
4491+ Then the other type is either FLOAT, DOUBLE, or old style
4492+ DECIMAL, so we require lossy conversion.
4493+ */
4494+ *order_var= 1;
4495+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
4496+
4497+ case MYSQL_TYPE_DECIMAL:
4498+ case MYSQL_TYPE_FLOAT:
4499+ case MYSQL_TYPE_DOUBLE:
4500+ {
4501+ if (source_type == MYSQL_TYPE_NEWDECIMAL ||
4502+ source_type == MYSQL_TYPE_DECIMAL)
4503+ *order_var= 1; // Always require lossy conversions
4504+ else
4505+ *order_var= compare_lengths(field, source_type, metadata);
4506+ DBUG_ASSERT(*order_var != 0);
4507+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
4508+ }
4509+
4510+ default:
4511+ DBUG_RETURN(false);
4512+ }
4513+ break;
4514+
4515+ /*
4516+ The length comparison check will do the correct job of comparing
4517+ the field lengths (in bytes) of two integer types.
4518+ */
4519+ case MYSQL_TYPE_TINY:
4520+ case MYSQL_TYPE_SHORT:
4521+ case MYSQL_TYPE_INT24:
4522+ case MYSQL_TYPE_LONG:
4523+ case MYSQL_TYPE_LONGLONG:
4524+ switch (field->real_type())
4525+ {
4526+ case MYSQL_TYPE_TINY:
4527+ case MYSQL_TYPE_SHORT:
4528+ case MYSQL_TYPE_INT24:
4529+ case MYSQL_TYPE_LONG:
4530+ case MYSQL_TYPE_LONGLONG:
4531+ *order_var= compare_lengths(field, source_type, metadata);
4532+ DBUG_ASSERT(*order_var != 0);
4533+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
4534+
4535+ default:
4536+ DBUG_RETURN(false);
4537+ }
4538+ break;
4539+
4540+ /*
4541+ Since source and target type is different, and it is not possible
4542+ to convert bit types to anything else, this will return false.
4543+ */
4544+ case MYSQL_TYPE_BIT:
4545+ DBUG_RETURN(false);
4546+
4547+ /*
4548+ If all conversions are disabled, it is not allowed to convert
4549+ between these types. Since the TEXT vs. BINARY is distinguished by
4550+ the charset, and the charset is not replicated, we cannot
4551+ currently distinguish between , e.g., TEXT and BLOB.
4552+ */
4553+ case MYSQL_TYPE_TINY_BLOB:
4554+ case MYSQL_TYPE_MEDIUM_BLOB:
4555+ case MYSQL_TYPE_LONG_BLOB:
4556+ case MYSQL_TYPE_BLOB:
4557+ case MYSQL_TYPE_STRING:
4558+ case MYSQL_TYPE_VAR_STRING:
4559+ case MYSQL_TYPE_VARCHAR:
4560+ switch (field->real_type())
4561+ {
4562+ case MYSQL_TYPE_TINY_BLOB:
4563+ case MYSQL_TYPE_MEDIUM_BLOB:
4564+ case MYSQL_TYPE_LONG_BLOB:
4565+ case MYSQL_TYPE_BLOB:
4566+ case MYSQL_TYPE_STRING:
4567+ case MYSQL_TYPE_VAR_STRING:
4568+ case MYSQL_TYPE_VARCHAR:
4569+ *order_var= compare_lengths(field, source_type, metadata);
4570+ /*
4571+ Here we know that the types are different, so if the order
4572+ gives that they do not require any conversion, we still need
4573+ to have non-lossy conversion enabled to allow conversion
4574+ between different (string) types of the same length.
4575+ */
4576+ if (*order_var == 0)
4577+ *order_var= -1;
4578+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
4579+
4580+ default:
4581+ DBUG_RETURN(false);
4582+ }
4583+ break;
4584+
4585+ case MYSQL_TYPE_GEOMETRY:
4586+ case MYSQL_TYPE_TIMESTAMP:
4587+ case MYSQL_TYPE_DATE:
4588+ case MYSQL_TYPE_TIME:
4589+ case MYSQL_TYPE_DATETIME:
4590+ case MYSQL_TYPE_YEAR:
4591+ case MYSQL_TYPE_NEWDATE:
4592+ case MYSQL_TYPE_NULL:
4593+ case MYSQL_TYPE_ENUM:
4594+ case MYSQL_TYPE_SET:
4595+ DBUG_RETURN(false);
4596+ }
4597+ DBUG_RETURN(false); // To keep GCC happy
4598+}
4599+
4600+
4601+/**
4602+ Is the definition compatible with a table?
4603+
4604+ This function will compare the master table with an existing table
4605+ on the slave and see if they are compatible with respect to the
4606+ current settings of @c SLAVE_TYPE_CONVERSIONS.
4607+
4608+ If the tables are compatible and conversions are required, @c
4609+ *tmp_table_var will be set to a virtual temporary table with field
4610+ pointers for the fields that require conversions. This allow simple
4611+ checking of whether a conversion are to be applied or not.
4612+
4613+ If tables are compatible, but no conversions are necessary, @c
4614+ *tmp_table_var will be set to NULL.
4615+
4616+ @param rli_arg[in]
4617+ Relay log info, for error reporting.
4618+
4619+ @param table[in]
4620+ Table to compare with
4621+
4622+ @param tmp_table_var[out]
4623+ Virtual temporary table for performing conversions, if necessary.
4624+
4625+ @retval true Master table is compatible with slave table.
4626+ @retval false Master table is not compatible with slave table.
4627+ Is the definition compatible with a table?
4628+
4629+*/
4630+bool
4631+table_def::compatible_with(THD *thd, Relay_log_info *rli,
4632+ TABLE *table, TABLE **conv_table_var)
4633 const
4634 {
4635 /*
4636 We only check the initial columns for the tables.
4637 */
4638 uint const cols_to_check= min(table->s->fields, size());
4639- int error= 0;
4640- Relay_log_info const *rli= const_cast<Relay_log_info*>(rli_arg);
4641-
4642- TABLE_SHARE const *const tsh= table->s;
4643+ TABLE *tmp_table= NULL;
4644
4645 for (uint col= 0 ; col < cols_to_check ; ++col)
4646 {
4647 Field *const field= table->field[col];
4648- if (field->type() != type(col))
4649- {
4650- DBUG_ASSERT(col < size() && col < tsh->fields);
4651- DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
4652- error= 1;
4653- char buf[256];
4654- my_snprintf(buf, sizeof(buf), "Column %d type mismatch - "
4655- "received type %d, %s.%s has type %d",
4656- col, type(col), tsh->db.str, tsh->table_name.str,
4657- field->type());
4658- rli->report(ERROR_LEVEL, ER_BINLOG_ROW_WRONG_TABLE_DEF,
4659- ER(ER_BINLOG_ROW_WRONG_TABLE_DEF), buf);
4660- }
4661- /*
4662- Check the slave's field size against that of the master.
4663- */
4664- if (!error &&
4665- !field->compatible_field_size(field_metadata(col), rli_arg, m_flags))
4666- {
4667- error= 1;
4668- char buf[256];
4669- my_snprintf(buf, sizeof(buf), "Column %d size mismatch - "
4670- "master has size %d, %s.%s on slave has size %d."
4671- " Master's column size should be <= the slave's "
4672- "column size.", col,
4673- field->pack_length_from_metadata(m_field_metadata[col]),
4674- tsh->db.str, tsh->table_name.str,
4675- field->row_pack_length());
4676- rli->report(ERROR_LEVEL, ER_BINLOG_ROW_WRONG_TABLE_DEF,
4677- ER(ER_BINLOG_ROW_WRONG_TABLE_DEF), buf);
4678- }
4679- }
4680-
4681- return error;
4682+ int order;
4683+ if (can_convert_field_to(field, type(col), field_metadata(col), rli, m_flags, &order))
4684+ {
4685+ DBUG_PRINT("debug", ("Checking column %d -"
4686+ " field '%s' can be converted - order: %d",
4687+ col, field->field_name, order));
4688+ DBUG_ASSERT(order >= -1 && order <= 1);
4689+
4690+ /*
4691+ If order is not 0, a conversion is required, so we need to set
4692+ up the conversion table.
4693+ */
4694+ if (order != 0 && tmp_table == NULL)
4695+ {
4696+ /*
4697+ This will create the full table with all fields. This is
4698+ necessary to ge the correct field lengths for the record.
4699+ */
4700+ tmp_table= create_conversion_table(thd, rli, table);
4701+ if (tmp_table == NULL)
4702+ return false;
4703+ /*
4704+ Clear all fields up to, but not including, this column.
4705+ */
4706+ for (unsigned int i= 0; i < col; ++i)
4707+ tmp_table->field[i]= NULL;
4708+ }
4709+
4710+ if (order == 0 && tmp_table != NULL)
4711+ tmp_table->field[col]= NULL;
4712+ }
4713+ else
4714+ {
4715+ DBUG_PRINT("debug", ("Checking column %d -"
4716+ " field '%s' can not be converted",
4717+ col, field->field_name));
4718+ DBUG_ASSERT(col < size() && col < table->s->fields);
4719+ DBUG_ASSERT(table->s->db.str && table->s->table_name.str);
4720+ const char *db_name= table->s->db.str;
4721+ const char *tbl_name= table->s->table_name.str;
4722+ char source_buf[MAX_FIELD_WIDTH];
4723+ char target_buf[MAX_FIELD_WIDTH];
4724+ String source_type(source_buf, sizeof(source_buf), field->charset());
4725+ String target_type(target_buf, sizeof(target_buf), field->charset());
4726+ show_sql_type(type(col), field_metadata(col), &source_type);
4727+ field->sql_type(target_type);
4728+ rli->report(ERROR_LEVEL, ER_SLAVE_CONVERSION_FAILED,
4729+ ER(ER_SLAVE_CONVERSION_FAILED),
4730+ col, db_name, tbl_name,
4731+ source_type.c_ptr_safe(), target_type.c_ptr_safe());
4732+ return false;
4733+ }
4734+ }
4735+
4736+#ifndef DBUG_OFF
4737+ if (tmp_table)
4738+ {
4739+ for (unsigned int col= 0; col < tmp_table->s->fields; ++col)
4740+ if (tmp_table->field[col])
4741+ {
4742+ char source_buf[MAX_FIELD_WIDTH];
4743+ char target_buf[MAX_FIELD_WIDTH];
4744+ String source_type(source_buf, sizeof(source_buf), table->field[col]->charset());
4745+ String target_type(target_buf, sizeof(target_buf), table->field[col]->charset());
4746+ tmp_table->field[col]->sql_type(source_type);
4747+ table->field[col]->sql_type(target_type);
4748+ DBUG_PRINT("debug", ("Field %s - conversion required."
4749+ " Source type: '%s', Target type: '%s'",
4750+ tmp_table->field[col]->field_name,
4751+ source_type.c_ptr_safe(), target_type.c_ptr_safe()));
4752+ }
4753+ }
4754+#endif
4755+
4756+ *conv_table_var= tmp_table;
4757+ return true;
4758+}
4759+
4760+/**
4761+ Create a conversion table.
4762+
4763+ If the function is unable to create the conversion table, an error
4764+ will be printed and NULL will be returned.
4765+
4766+ @return Pointer to conversion table, or NULL if unable to create
4767+ conversion table.
4768+*/
4769+TABLE *table_def::create_conversion_table(THD *thd, Relay_log_info *rli,
4770+ TABLE *target_table) const
4771+{
4772+ DBUG_ENTER("table_def::create_conversion_table");
4773+
4774+ List<Create_field> field_list;
4775+
4776+ uint const cols_to_check= min(target_table->s->fields, size());
4777+ for (uint col= 0 ; col < cols_to_check; ++col)
4778+ {
4779+ Create_field *field_def=
4780+ (Create_field*) alloc_root(thd->mem_root, sizeof(Create_field));
4781+ if (field_list.push_back(field_def))
4782+ DBUG_RETURN(NULL);
4783+
4784+ uint decimals= 0;
4785+ TYPELIB* interval= NULL;
4786+ uint pack_length= 0;
4787+ uint32 max_length=
4788+ max_display_length_for_field(type(col), field_metadata(col));
4789+
4790+ switch(type(col))
4791+ {
4792+ int precision;
4793+ case MYSQL_TYPE_ENUM:
4794+ case MYSQL_TYPE_SET:
4795+ interval= static_cast<Field_enum*>(target_table->field[col])->typelib;
4796+ pack_length= field_metadata(col) & 0x00ff;
4797+ break;
4798+
4799+ case MYSQL_TYPE_NEWDECIMAL:
4800+ /*
4801+ The display length of a DECIMAL type is not the same as the
4802+ length that should be supplied to make_field, so we correct
4803+ the length here.
4804+ */
4805+ precision= field_metadata(col) >> 8;
4806+ decimals= field_metadata(col) & 0x00ff;
4807+ max_length=
4808+ my_decimal_precision_to_length(precision, decimals, FALSE);
4809+ break;
4810+
4811+ case MYSQL_TYPE_DECIMAL:
4812+ precision= field_metadata(col);
4813+ decimals= static_cast<Field_num*>(target_table->field[col])->dec;
4814+ max_length= field_metadata(col);
4815+ break;
4816+
4817+ case MYSQL_TYPE_TINY_BLOB:
4818+ case MYSQL_TYPE_MEDIUM_BLOB:
4819+ case MYSQL_TYPE_LONG_BLOB:
4820+ case MYSQL_TYPE_BLOB:
4821+ case MYSQL_TYPE_GEOMETRY:
4822+ pack_length= field_metadata(col) & 0x00ff;
4823+ break;
4824+
4825+ default:
4826+ break;
4827+ }
4828+
4829+ DBUG_PRINT("debug", ("sql_type: %d, target_field: '%s', max_length: %d, decimals: %d,"
4830+ " maybe_null: %d, unsigned_flag: %d, pack_length: %u",
4831+ type(col), target_table->field[col]->field_name,
4832+ max_length, decimals, TRUE, FALSE, pack_length));
4833+ field_def->init_for_tmp_table(type(col),
4834+ max_length,
4835+ decimals,
4836+ TRUE, // maybe_null
4837+ FALSE, // unsigned_flag
4838+ pack_length);
4839+ field_def->charset= target_table->field[col]->charset();
4840+ field_def->interval= interval;
4841+ }
4842+
4843+ TABLE *conv_table= create_virtual_tmp_table(thd, field_list);
4844+ if (conv_table == NULL)
4845+ rli->report(ERROR_LEVEL, ER_SLAVE_CANT_CREATE_CONVERSION,
4846+ ER(ER_SLAVE_CANT_CREATE_CONVERSION),
4847+ target_table->s->db.str,
4848+ target_table->s->table_name.str);
4849+ DBUG_RETURN(conv_table);
4850+}
4851+
4852+#endif /* MYSQL_CLIENT */
4853+
4854+table_def::table_def(unsigned char *types, ulong size,
4855+ uchar *field_metadata, int metadata_size,
4856+ uchar *null_bitmap, uint16 flags)
4857+ : m_size(size), m_type(0), m_field_metadata_size(metadata_size),
4858+ m_field_metadata(0), m_null_bits(0), m_flags(flags),
4859+ m_memory(NULL)
4860+{
4861+ m_memory= (uchar *)my_multi_malloc(MYF(MY_WME), &m_type, size,
4862+ &m_field_metadata, size * sizeof(uint16),
4863+ &m_null_bits, (size + 7) / 8, NULL);
4864+
4865+ bzero(m_field_metadata, size * sizeof(uint16));
4866+
4867+ if (m_type)
4868+ memcpy(m_type, types, size);
4869+ else
4870+ m_size= 0;
4871+ /*
4872+ Extract the data from the table map into the field metadata array
4873+ iff there is field metadata. The variable metadata_size will be
4874+ 0 if we are replicating from an older version server since no field
4875+ metadata was written to the table map. This can also happen if
4876+ there were no fields in the master that needed extra metadata.
4877+ */
4878+ if (m_size && metadata_size)
4879+ {
4880+ int index= 0;
4881+ for (unsigned int i= 0; i < m_size; i++)
4882+ {
4883+ switch (m_type[i]) {
4884+ case MYSQL_TYPE_TINY_BLOB:
4885+ case MYSQL_TYPE_BLOB:
4886+ case MYSQL_TYPE_MEDIUM_BLOB:
4887+ case MYSQL_TYPE_LONG_BLOB:
4888+ case MYSQL_TYPE_DOUBLE:
4889+ case MYSQL_TYPE_FLOAT:
4890+ case MYSQL_TYPE_GEOMETRY:
4891+ {
4892+ /*
4893+ These types store a single byte.
4894+ */
4895+ m_field_metadata[i]= field_metadata[index];
4896+ index++;
4897+ break;
4898+ }
4899+ case MYSQL_TYPE_SET:
4900+ case MYSQL_TYPE_ENUM:
4901+ case MYSQL_TYPE_STRING:
4902+ {
4903+ uint16 x= field_metadata[index++] << 8U; // real_type
4904+ x+= field_metadata[index++]; // pack or field length
4905+ m_field_metadata[i]= x;
4906+ break;
4907+ }
4908+ case MYSQL_TYPE_BIT:
4909+ {
4910+ uint16 x= field_metadata[index++];
4911+ x= x + (field_metadata[index++] << 8U);
4912+ m_field_metadata[i]= x;
4913+ break;
4914+ }
4915+ case MYSQL_TYPE_VARCHAR:
4916+ {
4917+ /*
4918+ These types store two bytes.
4919+ */
4920+ char *ptr= (char *)&field_metadata[index];
4921+ m_field_metadata[i]= uint2korr(ptr);
4922+ index= index + 2;
4923+ break;
4924+ }
4925+ case MYSQL_TYPE_NEWDECIMAL:
4926+ {
4927+ uint16 x= field_metadata[index++] << 8U; // precision
4928+ x+= field_metadata[index++]; // decimals
4929+ m_field_metadata[i]= x;
4930+ break;
4931+ }
4932+ default:
4933+ m_field_metadata[i]= 0;
4934+ break;
4935+ }
4936+ }
4937+ }
4938+ if (m_size && null_bitmap)
4939+ memcpy(m_null_bits, null_bitmap, (m_size + 7) / 8);
4940+}
4941+
4942+
4943+table_def::~table_def()
4944+{
4945+ my_free(m_memory, MYF(0));
4946+#ifndef DBUG_OFF
4947+ m_type= 0;
4948+ m_size= 0;
4949+#endif
4950 }
4951
4952=== modified file 'Percona-Server/sql/rpl_utility.h'
4953--- Percona-Server/sql/rpl_utility.h 2011-06-30 15:37:13 +0000
4954+++ Percona-Server/sql/rpl_utility.h 2012-02-22 07:32:24 +0000
4955@@ -23,6 +23,7 @@
4956 #endif
4957
4958 #include "mysql_priv.h"
4959+#include "mysql_com.h"
4960
4961 class Relay_log_info;
4962
4963@@ -40,116 +41,18 @@
4964 {
4965 public:
4966 /**
4967- Convenience declaration of the type of the field type data in a
4968- table map event.
4969- */
4970- typedef unsigned char field_type;
4971-
4972- /**
4973 Constructor.
4974
4975- @param types Array of types
4976+ @param types Array of types, each stored as a byte
4977 @param size Number of elements in array 'types'
4978 @param field_metadata Array of extra information about fields
4979 @param metadata_size Size of the field_metadata array
4980 @param null_bitmap The bitmap of fields that can be null
4981 */
4982- table_def(field_type *types, ulong size, uchar *field_metadata,
4983- int metadata_size, uchar *null_bitmap, uint16 flags)
4984- : m_size(size), m_type(0), m_field_metadata_size(metadata_size),
4985- m_field_metadata(0), m_null_bits(0), m_flags(flags), m_memory(NULL)
4986- {
4987- m_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
4988- &m_type, size,
4989- &m_field_metadata,
4990- size * sizeof(uint16),
4991- &m_null_bits, (size + 7) / 8,
4992- NULL);
4993-
4994- bzero(m_field_metadata, size * sizeof(uint16));
4995-
4996- if (m_type)
4997- memcpy(m_type, types, size);
4998- else
4999- m_size= 0;
5000- /*
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches