1
diff -Nur a/client/Makefile.am b/client/Makefile.am
2
--- a/client/Makefile.am 2010-08-04 19:22:42.998460900 +0400
3
+++ b/client/Makefile.am 2010-08-04 19:22:44.238461867 +0400
5
-DMYSQL_DATADIR="\"$(localstatedir)\""
7
sql_src=log_event.h mysql_priv.h rpl_constants.h \
8
- rpl_utility.h rpl_tblmap.h rpl_tblmap.cc \
9
+ rpl_tblmap.h rpl_tblmap.cc \
10
log_event.cc my_decimal.h my_decimal.cc \
11
log_event_old.h log_event_old.cc \
12
+ rpl_utility.h rpl_utility.cc \
13
rpl_record_old.h rpl_record_old.cc
16
diff -Nur a/client/Makefile.in b/client/Makefile.in
17
--- a/client/Makefile.in 2010-08-04 19:22:42.998460900 +0400
18
+++ b/client/Makefile.in 2010-08-04 19:22:44.248496106 +0400
20
$(top_srcdir)/mysys/my_getpagesize.c
22
sql_src = log_event.h mysql_priv.h rpl_constants.h \
23
- rpl_utility.h rpl_tblmap.h rpl_tblmap.cc \
24
+ rpl_tblmap.h rpl_tblmap.cc \
25
log_event.cc my_decimal.h my_decimal.cc \
26
log_event_old.h log_event_old.cc \
27
+ rpl_utility.h rpl_utility.cc \
28
rpl_record_old.h rpl_record_old.cc
30
strings_src = decimal.c
31
diff -Nur a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
32
--- a/client/mysqlbinlog.cc 2010-08-04 19:22:42.998460900 +0400
33
+++ b/client/mysqlbinlog.cc 2010-08-04 19:22:48.079204709 +0400
35
#include "my_decimal.cc"
36
#include "log_event.cc"
37
#include "log_event_old.cc"
39
+#include "rpl_utility.cc"
40
diff -Nur a/libmysqld/Makefile.am b/libmysqld/Makefile.am
41
--- a/libmysqld/Makefile.am 2010-08-04 19:22:43.118459988 +0400
42
+++ b/libmysqld/Makefile.am 2010-08-04 19:22:52.908458659 +0400
45
key.cc lock.cc log.cc sql_state.c \
46
log_event.cc rpl_record.cc \
47
- log_event_old.cc rpl_record_old.cc \
48
+ log_event_old.cc rpl_record_old.cc rpl_utility.cc \
49
protocol.cc net_serv.cc opt_range.cc \
50
opt_sum.cc procedure.cc records.cc sql_acl.cc \
51
sql_load.cc discover.cc sql_locale.cc \
52
diff -Nur a/mysql-test/extra/rpl_tests/check_type.inc b/mysql-test/extra/rpl_tests/check_type.inc
53
--- a/mysql-test/extra/rpl_tests/check_type.inc 1970-01-01 03:00:00.000000000 +0300
54
+++ b/mysql-test/extra/rpl_tests/check_type.inc 2010-08-04 19:22:53.508459662 +0400
56
+# Helper file to perform one insert of a value into a table with
57
+# different types on master and slave. The file will insert the
58
+# result into the type_conversions table *on the slave* to get a
59
+# summary of failing and succeeding tests.
62
+# $source_type Type on the master
63
+# $target_type Type on the slave
64
+# $source_value Value on the master (inserted into the table)
65
+# $target_value Value on the slave (expected value in the table
67
+# $can_convert True if conversion shall work, false if it
68
+# shall generate an error
73
+DROP TABLE IF EXISTS t1;
75
+eval CREATE TABLE t1 (a $source_type);
76
+sync_slave_with_master;
77
+eval ALTER TABLE t1 MODIFY a $target_type;
80
+eval INSERT INTO t1 VALUES($source_value);
82
+ sync_slave_with_master;
83
+ eval SELECT a = $target_value into @compare FROM t1;
84
+ eval INSERT INTO type_conversions SET
85
+ Source = "$source_type",
86
+ Target = "$target_type",
87
+ Flags = @@slave_type_conversions,
88
+ On_Master = $source_value,
89
+ Expected = $target_value,
91
+ UPDATE type_conversions
92
+ SET On_Slave = (SELECT a FROM t1)
93
+ WHERE TestNo = LAST_INSERT_ID();
97
+ wait_for_slave_to_stop;
98
+ let $error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
99
+ eval INSERT INTO type_conversions SET
100
+ Source = "$source_type",
101
+ Target = "$target_type",
102
+ Flags = @@slave_type_conversions,
103
+ On_Master = $source_value,
105
+ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
108
diff -Nur a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
109
--- a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test 2010-08-04 19:22:43.208460560 +0400
110
+++ b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test 2010-08-04 19:22:58.148461298 +0400
111
@@ -486,12 +486,12 @@
114
--echo ********************************************
115
---echo *** Expect slave to fail with Error 1535 ***
116
+--echo *** Expect slave to fail with Error 1677 ***
117
--echo ********************************************
120
-# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
121
---let $slave_sql_errno= 1535
122
+# 1677 = ER_BINLOG_ROW_WRONG_TABLE_DEF
123
+--let $slave_sql_errno= 1677
124
--let $slave_skip_counter= 2
125
--let $show_slave_sql_error= 1
126
--source include/wait_for_slave_sql_error_and_skip.inc
127
@@ -542,12 +542,12 @@
130
--echo ********************************************
131
---echo *** Expect slave to fail with Error 1535 ***
132
+--echo *** Expect slave to fail with Error 1677 ***
133
--echo ********************************************
136
-# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
137
---let $slave_sql_errno= 1535
138
+# 1677 = ER_BINLOG_ROW_WRONG_TABLE_DEF
139
+--let $slave_sql_errno= 1677
140
--let $slave_skip_counter= 2
141
--let $show_slave_sql_error= 1
142
--source include/wait_for_slave_sql_error_and_skip.inc
143
diff -Nur a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
144
--- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test 2010-08-04 19:22:43.208460560 +0400
145
+++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test 2010-08-04 19:22:59.638460024 +0400
150
+SET @saved_slave_type_conversions = @@slave_type_conversions;
151
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
153
eval CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
154
d FLOAT DEFAULT '2.00',
155
e CHAR(4) DEFAULT 'TEST')
157
sync_slave_with_master;
158
SELECT * FROM t1 ORDER BY a;
160
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
162
--echo *** Drop t1 ***
166
--echo *** Start Slave ***
169
---let $slave_sql_errno= 1535
170
+--let $slave_sql_errno= 1677
171
--let $show_slave_sql_error= 1
172
--source include/wait_for_slave_sql_error.inc
174
@@ -145,10 +150,10 @@
175
INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
177
--echo ********************************************
178
---echo *** Expect slave to fail with Error 1535 ***
179
+--echo *** Expect slave to fail with Error 1677 ***
180
--echo ********************************************
182
---let $slave_sql_errno= 1535
183
+--let $slave_sql_errno= 1677
184
--let $slave_skip_counter= 2
185
--let $show_slave_sql_error= 1
186
--source include/wait_for_slave_sql_error_and_skip.inc
187
@@ -188,10 +193,10 @@
188
(30000.22,4,'QA TESTING');
190
--echo ********************************************
191
---echo *** Expect slave to fail with Error 1535 ***
192
+--echo *** Expect slave to fail with Error 1677 ***
193
--echo ********************************************
195
---let $slave_sql_errno= 1535
196
+--let $slave_sql_errno= 1677
197
--let $slave_skip_counter= 2
198
--let $show_slave_sql_error= 1
199
--source include/wait_for_slave_sql_error_and_skip.inc
200
@@ -231,10 +236,10 @@
201
(2,'JOE',300.01,0,'b2b2',1.0000009);
203
--echo ********************************************
204
---echo *** Expect slave to fail with Error 1535 ***
205
+--echo *** Expect slave to fail with Error 1677 ***
206
--echo ********************************************
208
---let $slave_sql_errno= 1535
209
+--let $slave_sql_errno= 1677
210
--let $slave_skip_counter= 2
211
--let $show_slave_sql_error= 1
212
--source include/wait_for_slave_sql_error_and_skip.inc
213
@@ -275,10 +280,10 @@
216
--echo ********************************************
217
---echo *** Expect slave to fail with Error 1535 ***
218
+--echo *** Expect slave to fail with Error 1677 ***
219
--echo ********************************************
221
---let $slave_sql_errno= 1535
222
+--let $slave_sql_errno= 1677
223
--let $show_slave_sql_error= 1
224
--source include/wait_for_slave_sql_error.inc
225
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
226
@@ -479,10 +484,10 @@
227
INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
229
--echo ********************************************
230
---echo *** Expect slave to fail with Error 1535 ***
231
+--echo *** Expect slave to fail with Error 1677 ***
232
--echo ********************************************
234
---let $slave_sql_errno= 1535
235
+--let $slave_sql_errno= 1677
236
--let $slave_skip_counter= 2
237
--let $show_slave_sql_error= 1
238
--source include/wait_for_slave_sql_error_and_skip.inc
240
--echo *** Create t11 on slave ***
243
-eval CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
244
+eval CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
245
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
247
--echo *** Create t11 on Master ***
248
@@ -521,10 +526,10 @@
249
INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
251
--echo ********************************************
252
---echo *** Expect slave to fail with Error 1535 ***
253
+--echo *** Expect slave to fail with Error 1677 ***
254
--echo ********************************************
256
---let $slave_sql_errno= 1535
257
+--let $slave_sql_errno= 1677
258
--let $slave_skip_counter= 2
259
--let $show_slave_sql_error= 1
260
--source include/wait_for_slave_sql_error_and_skip.inc
261
@@ -900,10 +905,10 @@
262
INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
264
--echo ********************************************
265
---echo *** Expect slave to fail with Error 1535 ***
266
+--echo *** Expect slave to fail with Error 1677 ***
267
--echo ********************************************
269
---let $slave_sql_errno= 1535
270
+--let $slave_sql_errno= 1677
271
--let $slave_skip_counter= 2
272
--let $show_slave_sql_error= 1
273
--source include/wait_for_slave_sql_error_and_skip.inc
274
diff -Nur a/mysql-test/extra/rpl_tests/rpl_row_basic.test b/mysql-test/extra/rpl_tests/rpl_row_basic.test
275
--- a/mysql-test/extra/rpl_tests/rpl_row_basic.test 2010-08-04 19:22:43.208460560 +0400
276
+++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test 2010-08-04 19:23:00.670507682 +0400
278
# First we test tables with only an index.
282
eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ;
284
sync_slave_with_master;
286
# Testing special column types
289
+if (`select char_length('$bit_field_special') > 0`) {
290
+ SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
292
+ eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
296
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 ;
299
sync_slave_with_master;
300
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
302
+if (`select char_length('$bit_field_special') > 0`) {
303
+ SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
307
# Testing conflicting operations
310
c CHAR(255) CHARACTER SET utf8 NOT NULL,
311
j INT NOT NULL) ENGINE = $type ;
314
+SET @saved_slave_type_conversions = @@slave_type_conversions;
315
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
317
--echo [expecting slave to replicate correctly]
319
INSERT INTO t1 VALUES (1, "", 1);
321
let $diff_table_2=slave:test.t2;
322
source include/diff_tables.inc;
324
---echo [expecting slave to stop]
326
-INSERT INTO t3 VALUES (1, "", 1);
327
-INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
330
-# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
331
---let $slave_sql_errno= 1535
332
---let $show_slave_sql_error= 1
333
---source include/wait_for_slave_sql_error.inc
334
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
340
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
343
-# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
344
---let $slave_sql_errno= 1535
345
+# 1677 = ER_BINLOG_ROW_WRONG_TABLE_DEF
346
+--let $slave_sql_errno= 1677
347
--let $show_slave_sql_error= 1
348
--source include/wait_for_slave_sql_error.inc
351
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
354
-# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
355
---let $slave_sql_errno= 1535
356
+# 1677 = ER_BINLOG_ROW_WRONG_TABLE_DEF
357
+--let $slave_sql_errno= 1677
358
--let $show_slave_sql_error= 1
359
--source include/wait_for_slave_sql_error.inc
365
+# Since t1 contain a bit field, we have to do this trick to handle InnoDB
366
+if (`select char_length('$bit_field_special') > 0`) {
367
+ SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
369
+ eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
374
eval CREATE TABLE t1 (a bit) ENGINE=$type;
375
INSERT IGNORE INTO t1 VALUES (NULL);
376
INSERT INTO t1 ( a ) VALUES ( 0 );
379
sync_slave_with_master;
381
+if (`select char_length('$bit_field_special') > 0`) {
382
+ SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
385
let $diff_table_1=master:test.t1;
386
let $diff_table_2=slave:test.t1;
387
source include/diff_tables.inc;
388
diff -Nur a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
389
--- a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test 2010-08-04 19:22:43.208460560 +0400
390
+++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test 2010-08-04 19:23:00.670507682 +0400
392
INSERT INTO t4 VALUES (4);
394
--let $slave_skip_counter= 2
395
---let $slave_sql_errno= 1535
396
+--let $slave_sql_errno= 1677
397
--let $show_slave_sql_error= 1
398
--source include/wait_for_slave_sql_error_and_skip.inc
401
INSERT INTO t5 VALUES (5,10,25);
403
--let $slave_skip_counter= 2
404
---let $slave_sql_errno= 1535
405
+--let $slave_sql_errno= 1677
406
--let $show_slave_sql_error= 1
407
--source include/wait_for_slave_sql_error_and_skip.inc
410
INSERT INTO t6 VALUES (6,12,36);
412
--let $slave_skip_counter= 2
413
---let $slave_sql_errno= 1535
414
+--let $slave_sql_errno= 1677
415
--let $show_slave_sql_error= 1
416
--source include/wait_for_slave_sql_error_and_skip.inc
418
diff -Nur a/mysql-test/extra/rpl_tests/type_conversions.test b/mysql-test/extra/rpl_tests/type_conversions.test
419
--- a/mysql-test/extra/rpl_tests/type_conversions.test 1970-01-01 03:00:00.000000000 +0300
420
+++ b/mysql-test/extra/rpl_tests/type_conversions.test 2010-08-04 19:23:00.738459634 +0400
422
+# File containing different lossy and non-lossy type conversions.
424
+# Integral conversion testing, we do not reduce the test using
425
+# transitivity of conversions since the implementation is not using a
426
+# transitivity strategy. Instead we do an exhaustive testing.
430
+--let $conv = `select @@slave_type_conversions`
431
+--echo **** Running tests with @@SLAVE_TYPE_CONVERSIONS = '$conv' ****
433
+let $if_is_lossy = `SELECT FIND_IN_SET('ALL_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
434
+let $if_is_non_lossy = `SELECT FIND_IN_SET('ALL_NON_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
438
+let $source_type = TINYBLOB;
439
+let $target_type = TINYBLOB;
440
+let $source_value = 'aaa';
441
+let $target_value = 'aaa';
442
+let $can_convert = 1;
443
+source extra/rpl_tests/check_type.inc;
445
+let $source_type= TINYBLOB;
446
+let $target_type= BLOB;
447
+let $source_value= 'aaa';
448
+let $target_value= 'aaa';
449
+let $can_convert= $if_is_non_lossy;
450
+source extra/rpl_tests/check_type.inc;
452
+let $source_type= TINYBLOB;
453
+let $target_type= MEDIUMBLOB;
454
+let $source_value= 'aaa';
455
+let $target_value= 'aaa';
456
+let $can_convert= $if_is_non_lossy;
457
+source extra/rpl_tests/check_type.inc;
459
+let $source_type= TINYBLOB;
460
+let $target_type= LONGBLOB;
461
+let $source_value= 'aaa';
462
+let $target_value= 'aaa';
463
+let $can_convert= $if_is_non_lossy;
464
+source extra/rpl_tests/check_type.inc;
468
+let $source_type = BLOB;
469
+let $target_type = TINYBLOB;
470
+let $source_value = 'aaa';
471
+let $target_value = 'aaa';
472
+let $can_convert = $if_is_lossy;
473
+source extra/rpl_tests/check_type.inc;
475
+let $source_type= BLOB;
476
+let $target_type= BLOB;
477
+let $source_value= 'aaa';
478
+let $target_value= 'aaa';
479
+let $can_convert= 1;
480
+source extra/rpl_tests/check_type.inc;
482
+let $source_type= BLOB;
483
+let $target_type= MEDIUMBLOB;
484
+let $source_value= 'aaa';
485
+let $target_value= 'aaa';
486
+let $can_convert= $if_is_non_lossy;
487
+source extra/rpl_tests/check_type.inc;
489
+let $source_type= BLOB;
490
+let $target_type= LONGBLOB;
491
+let $source_value= 'aaa';
492
+let $target_value= 'aaa';
493
+let $can_convert= $if_is_non_lossy;
494
+source extra/rpl_tests/check_type.inc;
498
+let $source_type = MEDIUMBLOB;
499
+let $target_type = TINYBLOB;
500
+let $source_value = 'aaa';
501
+let $target_value = 'aaa';
502
+let $can_convert = $if_is_lossy;
503
+source extra/rpl_tests/check_type.inc;
505
+let $source_type= MEDIUMBLOB;
506
+let $target_type= BLOB;
507
+let $source_value= 'aaa';
508
+let $target_value= 'aaa';
509
+let $can_convert= $if_is_lossy;
510
+source extra/rpl_tests/check_type.inc;
512
+let $source_type= MEDIUMBLOB;
513
+let $target_type= MEDIUMBLOB;
514
+let $source_value= 'aaa';
515
+let $target_value= 'aaa';
516
+let $can_convert= 1;
517
+source extra/rpl_tests/check_type.inc;
519
+let $source_type= MEDIUMBLOB;
520
+let $target_type= LONGBLOB;
521
+let $source_value= 'aaa';
522
+let $target_value= 'aaa';
523
+let $can_convert= $if_is_non_lossy;
524
+source extra/rpl_tests/check_type.inc;
528
+let $source_type = LONGBLOB;
529
+let $target_type = TINYBLOB;
530
+let $source_value = 'aaa';
531
+let $target_value = 'aaa';
532
+let $can_convert = $if_is_lossy;
533
+source extra/rpl_tests/check_type.inc;
535
+let $source_type= LONGBLOB;
536
+let $target_type= BLOB;
537
+let $source_value= 'aaa';
538
+let $target_value= 'aaa';
539
+let $can_convert= $if_is_lossy;
540
+source extra/rpl_tests/check_type.inc;
542
+let $source_type= LONGBLOB;
543
+let $target_type= MEDIUMBLOB;
544
+let $source_value= 'aaa';
545
+let $target_value= 'aaa';
546
+let $can_convert= $if_is_lossy;
547
+source extra/rpl_tests/check_type.inc;
549
+let $source_type= LONGBLOB;
550
+let $target_type= LONGBLOB;
551
+let $source_value= 'aaa';
552
+let $target_value= 'aaa';
553
+let $can_convert= 1;
554
+source extra/rpl_tests/check_type.inc;
556
+# BUG#49836 (additional tests - GEOMETRY TYPE)
558
+let $source_type = GEOMETRY;
559
+let $target_type = BLOB;
560
+let $source_value = PointFromText('POINT(10 10)');
561
+let $target_value = PointFromText('POINT(10 10)');
562
+let $can_convert = 0;
563
+source extra/rpl_tests/check_type.inc;
565
+let $source_type = BLOB;
566
+let $target_type = GEOMETRY;
567
+let $source_value = 'aaa';
568
+let $target_value = 'aaa';
569
+let $can_convert = 0;
570
+source extra/rpl_tests/check_type.inc;
572
+let $source_type = GEOMETRY;
573
+let $target_type = GEOMETRY;
574
+let $source_value = PointFromText('POINT(10 10)');
575
+let $target_value = PointFromText('POINT(10 10)');
576
+let $can_convert = 1;
577
+source extra/rpl_tests/check_type.inc;
579
+let $source_type = BIT(1);
580
+let $target_type = BIT(1);
581
+let $source_value = b'1';
582
+let $target_value = b'1';
583
+let $can_convert = 1;
584
+source extra/rpl_tests/check_type.inc;
586
+let $source_type = DATE;
587
+let $target_type = DATE;
588
+let $source_value = '2009-11-21';
589
+let $target_value = '2009-11-21';
590
+let $can_convert = 1;
591
+source extra/rpl_tests/check_type.inc;
593
+let $source_type = ENUM('master','slave');
594
+let $target_type = ENUM('master','slave');
595
+let $source_value = 'master';
596
+let $target_value = 'master';
597
+let $can_convert = 1;
598
+source extra/rpl_tests/check_type.inc;
600
+let $source_type = CHAR(10);
601
+let $target_type = ENUM('master','slave');
602
+let $source_value = 'master';
603
+let $target_value = 'master';
604
+let $can_convert = 0;
605
+source extra/rpl_tests/check_type.inc;
607
+let $source_type = CHAR(10);
608
+let $target_type = SET('master','slave');
609
+let $source_value = 'master';
610
+let $target_value = 'master';
611
+let $can_convert = 0;
612
+source extra/rpl_tests/check_type.inc;
614
+let $source_type = ENUM('master','slave');
615
+let $target_type = CHAR(10);
616
+let $source_value = 'master';
617
+let $target_value = 'master';
618
+let $can_convert = 0;
619
+source extra/rpl_tests/check_type.inc;
621
+let $source_type = SET('master','slave');
622
+let $target_type = CHAR(10);
623
+let $source_value = 'master';
624
+let $target_value = 'master';
625
+let $can_convert = 0;
626
+source extra/rpl_tests/check_type.inc;
628
+let $source_type = SET('master','slave');
629
+let $target_type = SET('master','slave');
630
+let $source_value = '';
631
+let $target_value = '';
632
+let $can_convert = 1;
633
+source extra/rpl_tests/check_type.inc;
635
+let $source_type = SET('master','slave');
636
+let $target_type = SET('master','slave');
637
+let $source_value = 'master,slave';
638
+let $target_value = 'master,slave';
639
+let $can_convert = 1;
640
+source extra/rpl_tests/check_type.inc;
642
+let $source_type = SET('0','1','2','3','4','5','6');
643
+let $target_type = SET('0','1','2','3','4','5','6');
644
+let $source_value = '5';
645
+let $target_value = '5';
646
+let $can_convert = 1;
647
+source extra/rpl_tests/check_type.inc;
649
+let $source_type = SET('0','1','2','3','4','5','6');
650
+let $target_type = SET('0','1','2','3','4','5','6','7','8','9','10');
651
+let $source_value = '5';
652
+let $target_value = '5';
653
+let $can_convert = $if_is_non_lossy;
654
+source extra/rpl_tests/check_type.inc;
656
+let $source_type = SET('0','1','2','3','4','5','6','7','8','9','10');
657
+let $target_type = SET('0','1','2','3','4','5','6');
658
+let $source_value = '5';
659
+let $target_value = '5';
660
+let $can_convert = $if_is_lossy;
661
+source extra/rpl_tests/check_type.inc;
663
+let $source_type = SET('0','1','2','3','4','5','6','7','8','9','10');
664
+let $target_type = SET('0','1','2','3','4','5','6');
665
+let $source_value = '7';
666
+let $target_value = '';
667
+let $can_convert = $if_is_lossy;
668
+source extra/rpl_tests/check_type.inc;
670
+let $source_type = TINYINT;
671
+let $target_type = TINYINT;
672
+let $source_value = 1;
673
+let $target_value = 1;
674
+let $can_convert = 1;
675
+source extra/rpl_tests/check_type.inc;
677
+let $source_type = TINYINT;
678
+let $target_type = SMALLINT;
679
+let $source_value = 1;
680
+let $target_value = 1;
681
+let $can_convert = $if_is_non_lossy;
682
+source extra/rpl_tests/check_type.inc;
684
+let $source_type= TINYINT;
685
+let $target_type= MEDIUMINT;
686
+let $source_value= 1;
687
+let $target_value= 1;
688
+let $can_convert = $if_is_non_lossy;
689
+source extra/rpl_tests/check_type.inc;
691
+let $source_type= TINYINT;
692
+let $target_type= INT;
693
+let $source_value= 1;
694
+let $target_value= 1;
695
+let $can_convert = $if_is_non_lossy;
696
+source extra/rpl_tests/check_type.inc;
698
+let $source_type= TINYINT;
699
+let $target_type= BIGINT;
700
+let $source_value= 1;
701
+let $target_value= 1;
702
+let $can_convert = $if_is_non_lossy;
703
+source extra/rpl_tests/check_type.inc;
705
+let $source_type= SMALLINT;
706
+let $target_type= TINYINT;
707
+let $source_value= 1;
708
+let $target_value= 1;
709
+let $can_convert = $if_is_lossy;
710
+source extra/rpl_tests/check_type.inc;
712
+let $source_type= SMALLINT;
713
+let $target_type= TINYINT;
714
+let $source_value= 1 << 9;
715
+let $target_value= (1 << 7) - 1;
716
+let $can_convert = $if_is_lossy;
717
+source extra/rpl_tests/check_type.inc;
719
+let $source_type= SMALLINT;
720
+let $target_type= TINYINT UNSIGNED;
721
+let $source_value= 1 << 9;
722
+let $target_value= (1 << 8) - 1;
723
+let $can_convert = $if_is_lossy;
724
+source extra/rpl_tests/check_type.inc;
726
+let $source_type= SMALLINT;
727
+let $target_type= SMALLINT;
728
+let $source_value= 1;
729
+let $target_value= 1;
730
+let $can_convert = 1;
731
+source extra/rpl_tests/check_type.inc;
733
+let $source_type= SMALLINT;
734
+let $target_type= MEDIUMINT;
735
+let $source_value= 1;
736
+let $target_value= 1;
737
+let $can_convert = $if_is_non_lossy;
738
+source extra/rpl_tests/check_type.inc;
740
+let $source_type= SMALLINT;
741
+let $target_type= INT;
742
+let $source_value= 1;
743
+let $target_value= 1;
744
+let $can_convert = $if_is_non_lossy;
745
+source extra/rpl_tests/check_type.inc;
747
+let $source_type= SMALLINT;
748
+let $target_type= BIGINT;
749
+let $source_value= 1;
750
+let $target_value= 1;
751
+let $can_convert = $if_is_non_lossy;
752
+source extra/rpl_tests/check_type.inc;
754
+let $source_type= MEDIUMINT;
755
+let $target_type= TINYINT;
756
+let $source_value= 1;
757
+let $target_value= 1;
758
+let $can_convert = $if_is_lossy;
759
+source extra/rpl_tests/check_type.inc;
761
+let $source_type= MEDIUMINT;
762
+let $target_type= TINYINT;
763
+let $source_value= 1 << 20;
764
+let $target_value= (1 << 7) - 1;
765
+let $can_convert = $if_is_lossy;
766
+source extra/rpl_tests/check_type.inc;
768
+let $source_type= MEDIUMINT;
769
+let $target_type= TINYINT UNSIGNED;
770
+let $source_value= 1 << 20;
771
+let $target_value= (1 << 8) - 1;
772
+let $can_convert = $if_is_lossy;
773
+source extra/rpl_tests/check_type.inc;
775
+let $source_type= MEDIUMINT;
776
+let $target_type= SMALLINT;
777
+let $source_value= 1;
778
+let $target_value= 1;
779
+let $can_convert = $if_is_lossy;
780
+source extra/rpl_tests/check_type.inc;
782
+let $source_type= MEDIUMINT;
783
+let $target_type= MEDIUMINT;
784
+let $source_value= 1;
785
+let $target_value= 1;
786
+let $can_convert = 1;
787
+source extra/rpl_tests/check_type.inc;
789
+let $source_type= MEDIUMINT;
790
+let $target_type= INT;
791
+let $source_value= 1;
792
+let $target_value= 1;
793
+let $can_convert = $if_is_non_lossy;
794
+source extra/rpl_tests/check_type.inc;
796
+let $source_type= MEDIUMINT;
797
+let $target_type= BIGINT;
798
+let $source_value= 1;
799
+let $target_value= 1;
800
+let $can_convert = $if_is_non_lossy;
801
+source extra/rpl_tests/check_type.inc;
803
+let $source_type= INT;
804
+let $target_type= TINYINT;
805
+let $source_value= 1;
806
+let $target_value= 1;
807
+let $can_convert = $if_is_lossy;
808
+source extra/rpl_tests/check_type.inc;
810
+let $source_type= INT;
811
+let $target_type= TINYINT;
812
+let $source_value= (1 << 30);
813
+let $target_value= (1 << 7) - 1;
814
+let $can_convert = $if_is_lossy;
815
+source extra/rpl_tests/check_type.inc;
817
+let $source_type= INT;
818
+let $target_type= TINYINT UNSIGNED;
819
+let $source_value= (1 << 30);
820
+let $target_value= (1 << 8) - 1;
821
+let $can_convert = $if_is_lossy;
822
+source extra/rpl_tests/check_type.inc;
824
+let $source_type= INT;
825
+let $target_type= SMALLINT;
826
+let $source_value= 1;
827
+let $target_value= 1;
828
+let $can_convert = $if_is_lossy;
829
+source extra/rpl_tests/check_type.inc;
831
+let $source_type= INT;
832
+let $target_type= MEDIUMINT;
833
+let $source_value= 1;
834
+let $target_value= 1;
835
+let $can_convert = $if_is_lossy;
836
+source extra/rpl_tests/check_type.inc;
838
+let $source_type= INT;
839
+let $target_type= INT;
840
+let $source_value= 1;
841
+let $target_value= 1;
842
+let $can_convert = 1;
843
+source extra/rpl_tests/check_type.inc;
845
+let $source_type= INT;
846
+let $target_type= BIGINT;
847
+let $source_value= 1;
848
+let $target_value= 1;
849
+let $can_convert = $if_is_non_lossy;
850
+source extra/rpl_tests/check_type.inc;
852
+let $source_type= BIGINT;
853
+let $target_type= TINYINT;
854
+let $source_value= 1;
855
+let $target_value= 1;
856
+let $can_convert = $if_is_lossy;
857
+source extra/rpl_tests/check_type.inc;
859
+let $source_type= BIGINT;
860
+let $target_type= SMALLINT;
861
+let $source_value= 1;
862
+let $target_value= 1;
863
+let $can_convert = $if_is_lossy;
864
+source extra/rpl_tests/check_type.inc;
866
+let $source_type= BIGINT;
867
+let $target_type= MEDIUMINT;
868
+let $source_value= 1;
869
+let $target_value= 1;
870
+let $can_convert = $if_is_lossy;
871
+source extra/rpl_tests/check_type.inc;
873
+let $source_type= BIGINT;
874
+let $target_type= INT;
875
+let $source_value= 1;
876
+let $target_value= 1;
877
+let $can_convert = $if_is_lossy;
878
+source extra/rpl_tests/check_type.inc;
880
+let $source_type= BIGINT;
881
+let $target_type= BIGINT;
882
+let $source_value= 1;
883
+let $target_value= 1;
884
+let $can_convert = 1;
885
+source extra/rpl_tests/check_type.inc;
887
+let $source_type= CHAR(20);
888
+let $target_type= CHAR(20);
889
+let $source_value= 'Smoothnoodlemaps';
890
+let $target_value= 'Smoothnoodlemaps';
891
+let $can_convert = 1;
892
+source extra/rpl_tests/check_type.inc;
894
+let $source_type= CHAR(20);
895
+let $target_type= CHAR(30);
896
+let $source_value= 'Smoothnoodlemaps';
897
+let $target_value= 'Smoothnoodlemaps';
898
+let $can_convert = $if_is_non_lossy;
899
+source extra/rpl_tests/check_type.inc;
901
+let $source_type= CHAR(20);
902
+let $target_type= CHAR(10);
903
+let $source_value= 'Smoothnoodlemaps';
904
+let $target_value= 'Smoothnood';
905
+let $can_convert = $if_is_lossy;
906
+source extra/rpl_tests/check_type.inc;
908
+let $source_type= CHAR(20);
909
+let $target_type= VARCHAR(20);
910
+let $source_value= 'Smoothnoodlemaps';
911
+let $target_value= 'Smoothnoodlemaps';
912
+let $can_convert = $if_is_non_lossy;
913
+source extra/rpl_tests/check_type.inc;
915
+let $source_type= CHAR(20);
916
+let $target_type= VARCHAR(30);
917
+let $source_value= 'Smoothnoodlemaps';
918
+let $target_value= 'Smoothnoodlemaps';
919
+let $can_convert = $if_is_non_lossy;
920
+source extra/rpl_tests/check_type.inc;
922
+let $source_type= CHAR(20);
923
+let $target_type= VARCHAR(10);
924
+let $source_value= 'Smoothnoodlemaps';
925
+let $target_value= 'Smoothnood';
926
+let $can_convert = $if_is_lossy;
927
+source extra/rpl_tests/check_type.inc;
929
+let $source_type= CHAR(20);
930
+let $target_type= TINYTEXT;
931
+let $source_value= 'Smoothnoodlemaps';
932
+let $target_value= 'Smoothnoodlemaps';
933
+let $can_convert = $if_is_non_lossy;
934
+source extra/rpl_tests/check_type.inc;
936
+let $source_type= CHAR(20);
937
+let $target_type= TEXT;
938
+let $source_value= 'Smoothnoodlemaps';
939
+let $target_value= 'Smoothnoodlemaps';
940
+let $can_convert = $if_is_non_lossy;
941
+source extra/rpl_tests/check_type.inc;
943
+let $source_type= CHAR(20);
944
+let $target_type= MEDIUMTEXT;
945
+let $source_value= 'Smoothnoodlemaps';
946
+let $target_value= 'Smoothnoodlemaps';
947
+let $can_convert = $if_is_non_lossy;
948
+source extra/rpl_tests/check_type.inc;
950
+let $source_type= CHAR(20);
951
+let $target_type= LONGTEXT;
952
+let $source_value= 'Smoothnoodlemaps';
953
+let $target_value= 'Smoothnoodlemaps';
954
+let $can_convert = $if_is_non_lossy;
955
+source extra/rpl_tests/check_type.inc;
957
+let $source_type= VARCHAR(20);
958
+let $target_type= VARCHAR(20);
959
+let $source_value= 'Smoothnoodlemaps';
960
+let $target_value= 'Smoothnoodlemaps';
961
+let $can_convert = 1;
962
+source extra/rpl_tests/check_type.inc;
964
+let $source_type= VARCHAR(20);
965
+let $target_type= VARCHAR(30);
966
+let $source_value= 'Smoothnoodlemaps';
967
+let $target_value= 'Smoothnoodlemaps';
968
+let $can_convert = $if_is_non_lossy;
969
+source extra/rpl_tests/check_type.inc;
971
+let $source_type= VARCHAR(20);
972
+let $target_type= VARCHAR(10);
973
+let $source_value= 'Smoothnoodlemaps';
974
+let $target_value= 'Smoothnood';
975
+let $can_convert = $if_is_lossy;
976
+source extra/rpl_tests/check_type.inc;
978
+let $source_type= VARCHAR(20);
979
+let $target_type= CHAR(30);
980
+let $source_value= 'Smoothnoodlemaps';
981
+let $target_value= 'Smoothnoodlemaps';
982
+let $can_convert = $if_is_non_lossy;
983
+source extra/rpl_tests/check_type.inc;
985
+let $source_type= VARCHAR(20);
986
+let $target_type= CHAR(10);
987
+let $source_value= 'Smoothnoodlemaps';
988
+let $target_value= 'Smoothnood';
989
+let $can_convert = $if_is_lossy;
990
+source extra/rpl_tests/check_type.inc;
992
+let $source_type= VARCHAR(20);
993
+let $target_type= TINYTEXT;
994
+let $source_value= 'Smoothnoodlemaps';
995
+let $target_value= 'Smoothnoodlemaps';
996
+let $can_convert = $if_is_non_lossy;
997
+source extra/rpl_tests/check_type.inc;
999
+let $source_type= VARCHAR(20);
1000
+let $target_type= TEXT;
1001
+let $source_value= 'Smoothnoodlemaps';
1002
+let $target_value= 'Smoothnoodlemaps';
1003
+let $can_convert = $if_is_non_lossy;
1004
+source extra/rpl_tests/check_type.inc;
1006
+let $source_type= VARCHAR(20);
1007
+let $target_type= MEDIUMTEXT;
1008
+let $source_value= 'Smoothnoodlemaps';
1009
+let $target_value= 'Smoothnoodlemaps';
1010
+let $can_convert = $if_is_non_lossy;
1011
+source extra/rpl_tests/check_type.inc;
1013
+let $source_type= VARCHAR(20);
1014
+let $target_type= LONGTEXT;
1015
+let $source_value= 'Smoothnoodlemaps';
1016
+let $target_value= 'Smoothnoodlemaps';
1017
+let $can_convert = $if_is_non_lossy;
1018
+source extra/rpl_tests/check_type.inc;
1020
+let $blob = `select repeat('abcd', 125)`;
1021
+let $truncated_blob = `select left('$blob', 255)`;
1023
+let $source_type= VARCHAR(500);
1024
+let $target_type= VARCHAR(500);
1025
+let $source_value= '$blob';
1026
+let $target_value= '$blob';
1027
+let $can_convert = 1;
1028
+source extra/rpl_tests/check_type.inc;
1030
+let $source_type= VARCHAR(500);
1031
+let $target_type= VARCHAR(510);
1032
+let $source_value= '$blob';
1033
+let $target_value= '$blob';
1034
+let $can_convert = $if_is_non_lossy;
1035
+source extra/rpl_tests/check_type.inc;
1037
+let $source_type= VARCHAR(500);
1038
+let $target_type= VARCHAR(255);
1039
+let $source_value= '$blob';
1040
+let $target_value= '$truncated_blob';
1041
+let $can_convert = $if_is_lossy;
1042
+source extra/rpl_tests/check_type.inc;
1044
+let $source_type= VARCHAR(500);
1045
+let $target_type= TINYTEXT;
1046
+let $source_value= '$blob';
1047
+let $target_value= '$truncated_blob';
1048
+let $can_convert = $if_is_lossy;
1049
+source extra/rpl_tests/check_type.inc;
1051
+let $source_type= VARCHAR(500);
1052
+let $target_type= TEXT;
1053
+let $source_value= '$blob';
1054
+let $target_value= '$blob';
1055
+let $can_convert = $if_is_non_lossy;
1056
+source extra/rpl_tests/check_type.inc;
1058
+let $source_type= VARCHAR(500);
1059
+let $target_type= MEDIUMTEXT;
1060
+let $source_value= '$blob';
1061
+let $target_value= '$blob';
1062
+let $can_convert = $if_is_non_lossy;
1063
+source extra/rpl_tests/check_type.inc;
1065
+let $source_type= VARCHAR(500);
1066
+let $target_type= LONGTEXT;
1067
+let $source_value= '$blob';
1068
+let $target_value= '$blob';
1069
+let $can_convert = $if_is_non_lossy;
1070
+source extra/rpl_tests/check_type.inc;
1072
+let $tiny_blob = `select repeat('tiny blob ', 25)`;
1073
+let $truncated_tiny_blob = `select left('$tiny_blob', 254)`;
1075
+let $source_type= TINYTEXT;
1076
+let $target_type= VARCHAR(500);
1077
+let $source_value= '$tiny_blob';
1078
+let $target_value= '$tiny_blob';
1079
+let $can_convert = $if_is_non_lossy;
1080
+source extra/rpl_tests/check_type.inc;
1082
+let $source_type= TEXT;
1083
+let $target_type= VARCHAR(500);
1084
+let $source_value= '$blob';
1085
+let $target_value= '$blob';
1086
+let $can_convert = $if_is_lossy;
1087
+source extra/rpl_tests/check_type.inc;
1089
+let $source_type= MEDIUMTEXT;
1090
+let $target_type= VARCHAR(500);
1091
+let $source_value= '$blob';
1092
+let $target_value= '$blob';
1093
+let $can_convert = $if_is_lossy;
1094
+source extra/rpl_tests/check_type.inc;
1096
+let $source_type= LONGTEXT;
1097
+let $target_type= VARCHAR(500);
1098
+let $source_value= '$blob';
1099
+let $target_value= '$blob';
1100
+let $can_convert = $if_is_lossy;
1101
+source extra/rpl_tests/check_type.inc;
1103
+let $source_type= TINYTEXT;
1104
+let $target_type= CHAR(255);
1105
+let $source_value= '$tiny_blob';
1106
+let $target_value= '$tiny_blob';
1107
+let $can_convert = $if_is_non_lossy;
1108
+source extra/rpl_tests/check_type.inc;
1110
+let $source_type= TINYTEXT;
1111
+let $target_type= CHAR(250);
1112
+let $source_value= '$tiny_blob';
1113
+let $target_value= left('$tiny_blob', 250);
1114
+let $can_convert = $if_is_lossy;
1115
+source extra/rpl_tests/check_type.inc;
1117
+let $source_type= TEXT;
1118
+let $target_type= CHAR(255);
1119
+let $source_value= '$blob';
1120
+let $target_value= left('$blob', 255);
1121
+let $can_convert = $if_is_lossy;
1122
+source extra/rpl_tests/check_type.inc;
1124
+let $source_type= MEDIUMTEXT;
1125
+let $target_type= CHAR(255);
1126
+let $source_value= '$blob';
1127
+let $target_value= left('$blob', 255);
1128
+let $can_convert = $if_is_lossy;
1129
+source extra/rpl_tests/check_type.inc;
1131
+let $source_type= LONGTEXT;
1132
+let $target_type= CHAR(255);
1133
+let $source_value= '$blob';
1134
+let $target_value= left('$blob', 255);
1135
+let $can_convert = $if_is_lossy;
1136
+source extra/rpl_tests/check_type.inc;
1138
+let $source_type= TINYTEXT;
1139
+let $target_type= TINYTEXT;
1140
+let $source_value= '$tiny_blob';
1141
+let $target_value= '$tiny_blob';
1142
+let $can_convert = 1;
1143
+source extra/rpl_tests/check_type.inc;
1145
+let $source_type= TINYTEXT;
1146
+let $target_type= TEXT;
1147
+let $source_value= '$tiny_blob';
1148
+let $target_value= '$tiny_blob';
1149
+let $can_convert = $if_is_non_lossy;
1150
+source extra/rpl_tests/check_type.inc;
1152
+let $source_type= TEXT;
1153
+let $target_type= TINYTEXT;
1154
+let $source_value= '$blob';
1155
+let $target_value= left('$blob',255);
1156
+let $can_convert = $if_is_lossy;
1157
+source extra/rpl_tests/check_type.inc;
1159
+let $source_type= DECIMAL(10,5);
1160
+let $target_type= DECIMAL(10,5);
1161
+let $source_value= 3.14159;
1162
+let $target_value= 3.14159;
1163
+let $can_convert = 1;
1164
+source extra/rpl_tests/check_type.inc;
1166
+let $source_type= DECIMAL(10,5);
1167
+let $target_type= DECIMAL(10,6);
1168
+let $source_value= 3.14159;
1169
+let $target_value= 3.141590;
1170
+let $can_convert = $if_is_non_lossy;
1171
+source extra/rpl_tests/check_type.inc;
1173
+let $source_type= DECIMAL(10,5);
1174
+let $target_type= DECIMAL(11,5);
1175
+let $source_value= 3.14159;
1176
+let $target_value= 3.14159;
1177
+let $can_convert = $if_is_non_lossy;
1178
+source extra/rpl_tests/check_type.inc;
1180
+let $source_type= DECIMAL(10,5);
1181
+let $target_type= DECIMAL(11,6);
1182
+let $source_value= 3.14159;
1183
+let $target_value= 3.141590;
1184
+let $can_convert = $if_is_non_lossy;
1185
+source extra/rpl_tests/check_type.inc;
1187
+let $source_type= DECIMAL(10,5);
1188
+let $target_type= DECIMAL(10,4);
1189
+let $source_value= 3.14159;
1190
+let $target_value= 3.1416;
1191
+let $can_convert = $if_is_lossy;
1192
+source extra/rpl_tests/check_type.inc;
1194
+let $source_type= DECIMAL(10,5);
1195
+let $target_type= DECIMAL(9,5);
1196
+let $source_value= 3.14159;
1197
+let $target_value= 3.14159;
1198
+let $can_convert = $if_is_lossy;
1199
+source extra/rpl_tests/check_type.inc;
1201
+let $source_type= DECIMAL(10,5);
1202
+let $target_type= DECIMAL(9,4);
1203
+let $source_value= 3.14159;
1204
+let $target_value= 3.1416;
1205
+let $can_convert = $if_is_lossy;
1206
+source extra/rpl_tests/check_type.inc;
1208
+let $source_type= FLOAT;
1209
+let $target_type= DECIMAL(10,5);
1210
+let $source_value= 3.15625;
1211
+let $target_value= 3.15625;
1212
+let $can_convert = $if_is_lossy;
1213
+source extra/rpl_tests/check_type.inc;
1215
+let $source_type= DOUBLE;
1216
+let $target_type= DECIMAL(10,5);
1217
+let $source_value= 3.15625;
1218
+let $target_value= 3.15625;
1219
+let $can_convert = $if_is_lossy;
1220
+source extra/rpl_tests/check_type.inc;
1222
+let $source_type= DECIMAL(10,5);
1223
+let $target_type= FLOAT;
1224
+let $source_value= 3.15625;
1225
+let $target_value= 3.15625;
1226
+let $can_convert = $if_is_lossy;
1227
+source extra/rpl_tests/check_type.inc;
1229
+let $source_type= DECIMAL(10,5);
1230
+let $target_type= DOUBLE;
1231
+let $source_value= 3.15625;
1232
+let $target_value= 3.15625;
1233
+let $can_convert = $if_is_lossy;
1234
+source extra/rpl_tests/check_type.inc;
1236
+let $source_type= FLOAT;
1237
+let $target_type= FLOAT;
1238
+let $source_value= 3.15625;
1239
+let $target_value= 3.15625;
1240
+let $can_convert = 1;
1241
+source extra/rpl_tests/check_type.inc;
1243
+let $source_type= DOUBLE;
1244
+let $target_type= DOUBLE;
1245
+let $source_value= 3.15625;
1246
+let $target_value= 3.15625;
1247
+let $can_convert = 1;
1248
+source extra/rpl_tests/check_type.inc;
1250
+let $source_type= FLOAT;
1251
+let $target_type= DOUBLE;
1252
+let $source_value= 3.15625;
1253
+let $target_value= 3.15625;
1254
+let $can_convert = $if_is_non_lossy;
1255
+source extra/rpl_tests/check_type.inc;
1257
+let $source_type= DOUBLE;
1258
+let $target_type= FLOAT;
1259
+let $source_value= 3.15625;
1260
+let $target_value= 3.15625;
1261
+let $can_convert = $if_is_lossy;
1262
+source extra/rpl_tests/check_type.inc;
1264
+let $source_type= BIT(5);
1265
+let $target_type= BIT(5);
1266
+let $source_value= b'11001';
1267
+let $target_value= b'11001';
1268
+let $can_convert = 1;
1269
+source extra/rpl_tests/check_type.inc;
1271
+let $source_type= BIT(5);
1272
+let $target_type= BIT(6);
1273
+let $source_value= b'11001';
1274
+let $target_value= b'11001';
1275
+let $can_convert = $if_is_non_lossy;
1276
+source extra/rpl_tests/check_type.inc;
1278
+let $source_type= BIT(6);
1279
+let $target_type= BIT(5);
1280
+let $source_value= b'111001';
1281
+let $target_value= b'11111';
1282
+let $can_convert = $if_is_lossy;
1283
+source extra/rpl_tests/check_type.inc;
1285
+let $source_type= BIT(5);
1286
+let $target_type= BIT(12);
1287
+let $source_value= b'11001';
1288
+let $target_value= b'11001';
1289
+let $can_convert = $if_is_non_lossy;
1290
+source extra/rpl_tests/check_type.inc;
1292
+let $source_type= BIT(12);
1293
+let $target_type= BIT(5);
1294
+let $source_value= b'101100111000';
1295
+let $target_value= b'11111';
1296
+let $can_convert = $if_is_lossy;
1297
+source extra/rpl_tests/check_type.inc;
1301
+source include/reset_master_and_slave.inc;
1304
diff -Nur a/mysql-test/include/test_fieldsize.inc b/mysql-test/include/test_fieldsize.inc
1305
--- a/mysql-test/include/test_fieldsize.inc 2010-08-04 19:22:43.208460560 +0400
1306
+++ b/mysql-test/include/test_fieldsize.inc 2010-08-04 19:23:00.738459634 +0400
1311
---let $slave_sql_errno= 1535
1312
+--let $slave_sql_errno= 1677
1313
--let $show_slave_sql_error= 1
1314
--source include/wait_for_slave_sql_error.inc
1316
diff -Nur a/mysql-test/suite/rpl/r/rpl_bug31076.result b/mysql-test/suite/rpl/r/rpl_bug31076.result
1317
--- a/mysql-test/suite/rpl/r/rpl_bug31076.result 2010-08-04 19:22:43.228460035 +0400
1318
+++ b/mysql-test/suite/rpl/r/rpl_bug31076.result 2010-08-04 19:23:00.738459634 +0400
1321
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
1323
+SET @saved_slave_type_conversions = @@slave_type_conversions;
1324
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
1325
CREATE DATABASE track;
1327
CREATE TABLE `visits` (
1329
SELECT * FROM visits_events;
1330
event_id visit_id timestamp src data visits_events_id
1331
20000 21231038 2007-09-18 03:59:02 Downloads/MySQL-4.1/mysql-4.1.12a-win32.zip 33712207
1332
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1333
DROP DATABASE track;
1335
diff -Nur a/mysql-test/suite/rpl/r/rpl_colSize.result b/mysql-test/suite/rpl/r/rpl_colSize.result
1336
--- a/mysql-test/suite/rpl/r/rpl_colSize.result 2010-08-04 19:22:43.238459353 +0400
1337
+++ b/mysql-test/suite/rpl/r/rpl_colSize.result 2010-08-04 19:23:00.738459634 +0400
1339
*** Create "wider" table on slave ***
1342
+SET @saved_slave_type_conversions = @@slave_type_conversions;
1343
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
1348
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1351
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1352
diff -Nur a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
1353
--- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result 2010-08-04 19:22:43.238459353 +0400
1354
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result 2010-08-04 19:23:00.738459634 +0400
1359
+SET @saved_slave_type_conversions = @@slave_type_conversions;
1360
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
1361
CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
1362
d FLOAT DEFAULT '2.00',
1363
e CHAR(4) DEFAULT 'TEST')
1368
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1371
*** Create t2 on slave ***
1376
-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.
1377
+Last_SQL_Error = Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)'
1380
SELECT * FROM t2 ORDER BY a;
1382
set @b1 = concat(@b1,@b1);
1383
INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
1384
********************************************
1385
-*** Expect slave to fail with Error 1535 ***
1386
+*** Expect slave to fail with Error 1677 ***
1387
********************************************
1388
--source include/wait_for_slave_sql_error_and_skip.inc
1389
-Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
1390
+Last_SQL_Error = Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)'
1391
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1392
include/start_slave.inc
1394
@@ -106,10 +109,10 @@
1395
INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
1396
(30000.22,4,'QA TESTING');
1397
********************************************
1398
-*** Expect slave to fail with Error 1535 ***
1399
+*** Expect slave to fail with Error 1677 ***
1400
********************************************
1401
--source include/wait_for_slave_sql_error_and_skip.inc
1402
-Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
1403
+Last_SQL_Error = Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)'
1404
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1405
include/start_slave.inc
1407
@@ -131,10 +134,10 @@
1408
INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
1409
(2,'JOE',300.01,0,'b2b2',1.0000009);
1410
********************************************
1411
-*** Expect slave to fail with Error 1535 ***
1412
+*** Expect slave to fail with Error 1677 ***
1413
********************************************
1414
--source include/wait_for_slave_sql_error_and_skip.inc
1415
-Last_SQL_Error = Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
1416
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)'
1417
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1418
include/start_slave.inc
1421
INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
1423
********************************************
1424
-*** Expect slave to fail with Error 1535 ***
1425
+*** Expect slave to fail with Error 1677 ***
1426
********************************************
1427
-Last_SQL_Error = Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
1428
+Last_SQL_Error = Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)'
1429
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
1432
@@ -253,10 +256,10 @@
1433
set @b1 = concat(@b1,@b1);
1434
INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
1435
********************************************
1436
-*** Expect slave to fail with Error 1535 ***
1437
+*** Expect slave to fail with Error 1677 ***
1438
********************************************
1439
--source include/wait_for_slave_sql_error_and_skip.inc
1440
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
1441
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double'
1442
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1443
include/start_slave.inc
1446
*** Create t11 on slave ***
1449
-CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
1450
+CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
1451
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='InnoDB';
1452
*** Create t11 on Master ***
1453
CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
1454
@@ -277,10 +280,10 @@
1455
set @b1 = concat(@b1,@b1);
1456
INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
1457
********************************************
1458
-*** Expect slave to fail with Error 1535 ***
1459
+*** Expect slave to fail with Error 1677 ***
1460
********************************************
1461
--source include/wait_for_slave_sql_error_and_skip.inc
1462
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
1463
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)'
1464
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1465
include/start_slave.inc
1467
@@ -593,10 +596,10 @@
1468
*** Master Data Insert ***
1469
INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
1470
********************************************
1471
-*** Expect slave to fail with Error 1535 ***
1472
+*** Expect slave to fail with Error 1677 ***
1473
********************************************
1474
--source include/wait_for_slave_sql_error_and_skip.inc
1475
-Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
1476
+Last_SQL_Error = Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)'
1477
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1478
include/start_slave.inc
1479
** DROP table t17 ***
1480
diff -Nur a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
1481
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result 2010-08-04 19:22:43.228460035 +0400
1482
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result 2010-08-04 19:23:00.738459634 +0400
1483
@@ -461,11 +461,11 @@
1484
(3,@b1,DEFAULT,'QA',DEFAULT);
1486
********************************************
1487
-*** Expect slave to fail with Error 1535 ***
1488
+*** Expect slave to fail with Error 1677 ***
1489
********************************************
1491
--source include/wait_for_slave_sql_error_and_skip.inc
1492
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
1493
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
1494
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1495
include/start_slave.inc
1497
@@ -499,11 +499,11 @@
1498
(3,@b1,DEFAULT,'QA',DEFAULT);
1500
********************************************
1501
-*** Expect slave to fail with Error 1535 ***
1502
+*** Expect slave to fail with Error 1677 ***
1503
********************************************
1505
--source include/wait_for_slave_sql_error_and_skip.inc
1506
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
1507
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
1508
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1509
include/start_slave.inc
1511
@@ -1334,11 +1334,11 @@
1512
(3,@b1,DEFAULT,'QA',DEFAULT);
1514
********************************************
1515
-*** Expect slave to fail with Error 1535 ***
1516
+*** Expect slave to fail with Error 1677 ***
1517
********************************************
1519
--source include/wait_for_slave_sql_error_and_skip.inc
1520
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
1521
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
1522
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1523
include/start_slave.inc
1525
@@ -1372,11 +1372,11 @@
1526
(3,@b1,DEFAULT,'QA',DEFAULT);
1528
********************************************
1529
-*** Expect slave to fail with Error 1535 ***
1530
+*** Expect slave to fail with Error 1677 ***
1531
********************************************
1533
--source include/wait_for_slave_sql_error_and_skip.inc
1534
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
1535
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
1536
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1537
include/start_slave.inc
1539
@@ -2207,11 +2207,11 @@
1540
(3,@b1,DEFAULT,'QA',DEFAULT);
1542
********************************************
1543
-*** Expect slave to fail with Error 1535 ***
1544
+*** Expect slave to fail with Error 1677 ***
1545
********************************************
1547
--source include/wait_for_slave_sql_error_and_skip.inc
1548
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
1549
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
1550
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1551
include/start_slave.inc
1553
@@ -2245,11 +2245,11 @@
1554
(3,@b1,DEFAULT,'QA',DEFAULT);
1556
********************************************
1557
-*** Expect slave to fail with Error 1535 ***
1558
+*** Expect slave to fail with Error 1677 ***
1559
********************************************
1561
--source include/wait_for_slave_sql_error_and_skip.inc
1562
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
1563
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
1564
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1565
include/start_slave.inc
1567
diff -Nur a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
1568
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result 2010-08-04 19:22:43.228460035 +0400
1569
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result 2010-08-04 19:23:00.738459634 +0400
1570
@@ -461,11 +461,11 @@
1571
(3,@b1,DEFAULT,'QA',DEFAULT);
1573
********************************************
1574
-*** Expect slave to fail with Error 1535 ***
1575
+*** Expect slave to fail with Error 1677 ***
1576
********************************************
1578
--source include/wait_for_slave_sql_error_and_skip.inc
1579
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
1580
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
1581
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1582
include/start_slave.inc
1584
@@ -499,11 +499,11 @@
1585
(3,@b1,DEFAULT,'QA',DEFAULT);
1587
********************************************
1588
-*** Expect slave to fail with Error 1535 ***
1589
+*** Expect slave to fail with Error 1677 ***
1590
********************************************
1592
--source include/wait_for_slave_sql_error_and_skip.inc
1593
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
1594
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
1595
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1596
include/start_slave.inc
1598
@@ -1334,11 +1334,11 @@
1599
(3,@b1,DEFAULT,'QA',DEFAULT);
1601
********************************************
1602
-*** Expect slave to fail with Error 1535 ***
1603
+*** Expect slave to fail with Error 1677 ***
1604
********************************************
1606
--source include/wait_for_slave_sql_error_and_skip.inc
1607
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
1608
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
1609
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1610
include/start_slave.inc
1612
@@ -1372,11 +1372,11 @@
1613
(3,@b1,DEFAULT,'QA',DEFAULT);
1615
********************************************
1616
-*** Expect slave to fail with Error 1535 ***
1617
+*** Expect slave to fail with Error 1677 ***
1618
********************************************
1620
--source include/wait_for_slave_sql_error_and_skip.inc
1621
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
1622
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
1623
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1624
include/start_slave.inc
1626
@@ -2207,11 +2207,11 @@
1627
(3,@b1,DEFAULT,'QA',DEFAULT);
1629
********************************************
1630
-*** Expect slave to fail with Error 1535 ***
1631
+*** Expect slave to fail with Error 1677 ***
1632
********************************************
1634
--source include/wait_for_slave_sql_error_and_skip.inc
1635
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
1636
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
1637
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1638
include/start_slave.inc
1640
@@ -2245,11 +2245,11 @@
1641
(3,@b1,DEFAULT,'QA',DEFAULT);
1643
********************************************
1644
-*** Expect slave to fail with Error 1535 ***
1645
+*** Expect slave to fail with Error 1677 ***
1646
********************************************
1648
--source include/wait_for_slave_sql_error_and_skip.inc
1649
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
1650
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
1651
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1652
include/start_slave.inc
1654
diff -Nur a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
1655
--- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result 2010-08-04 19:22:43.238459353 +0400
1656
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result 2010-08-04 19:23:00.748458952 +0400
1661
+SET @saved_slave_type_conversions = @@slave_type_conversions;
1662
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
1663
CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
1664
d FLOAT DEFAULT '2.00',
1665
e CHAR(4) DEFAULT 'TEST')
1670
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1673
*** Create t2 on slave ***
1678
-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.
1679
+Last_SQL_Error = Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)'
1682
SELECT * FROM t2 ORDER BY a;
1684
set @b1 = concat(@b1,@b1);
1685
INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
1686
********************************************
1687
-*** Expect slave to fail with Error 1535 ***
1688
+*** Expect slave to fail with Error 1677 ***
1689
********************************************
1690
--source include/wait_for_slave_sql_error_and_skip.inc
1691
-Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
1692
+Last_SQL_Error = Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)'
1693
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1694
include/start_slave.inc
1696
@@ -106,10 +109,10 @@
1697
INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
1698
(30000.22,4,'QA TESTING');
1699
********************************************
1700
-*** Expect slave to fail with Error 1535 ***
1701
+*** Expect slave to fail with Error 1677 ***
1702
********************************************
1703
--source include/wait_for_slave_sql_error_and_skip.inc
1704
-Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
1705
+Last_SQL_Error = Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)'
1706
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1707
include/start_slave.inc
1709
@@ -131,10 +134,10 @@
1710
INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
1711
(2,'JOE',300.01,0,'b2b2',1.0000009);
1712
********************************************
1713
-*** Expect slave to fail with Error 1535 ***
1714
+*** Expect slave to fail with Error 1677 ***
1715
********************************************
1716
--source include/wait_for_slave_sql_error_and_skip.inc
1717
-Last_SQL_Error = Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
1718
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)'
1719
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1720
include/start_slave.inc
1723
INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
1725
********************************************
1726
-*** Expect slave to fail with Error 1535 ***
1727
+*** Expect slave to fail with Error 1677 ***
1728
********************************************
1729
-Last_SQL_Error = Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
1730
+Last_SQL_Error = Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)'
1731
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
1734
@@ -253,10 +256,10 @@
1735
set @b1 = concat(@b1,@b1);
1736
INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
1737
********************************************
1738
-*** Expect slave to fail with Error 1535 ***
1739
+*** Expect slave to fail with Error 1677 ***
1740
********************************************
1741
--source include/wait_for_slave_sql_error_and_skip.inc
1742
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
1743
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double'
1744
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1745
include/start_slave.inc
1748
*** Create t11 on slave ***
1751
-CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
1752
+CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
1753
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
1754
*** Create t11 on Master ***
1755
CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
1756
@@ -277,10 +280,10 @@
1757
set @b1 = concat(@b1,@b1);
1758
INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
1759
********************************************
1760
-*** Expect slave to fail with Error 1535 ***
1761
+*** Expect slave to fail with Error 1677 ***
1762
********************************************
1763
--source include/wait_for_slave_sql_error_and_skip.inc
1764
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
1765
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)'
1766
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1767
include/start_slave.inc
1769
@@ -593,10 +596,10 @@
1770
*** Master Data Insert ***
1771
INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
1772
********************************************
1773
-*** Expect slave to fail with Error 1535 ***
1774
+*** Expect slave to fail with Error 1677 ***
1775
********************************************
1776
--source include/wait_for_slave_sql_error_and_skip.inc
1777
-Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
1778
+Last_SQL_Error = Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)'
1779
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
1780
include/start_slave.inc
1781
** DROP table t17 ***
1782
diff -Nur a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
1783
--- a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result 2010-08-04 19:22:43.228460035 +0400
1784
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result 2010-08-04 19:23:00.748458952 +0400
1786
CREATE TABLE t7 (i INT NOT NULL,
1787
c CHAR(255) CHARACTER SET utf8 NOT NULL,
1788
j INT NOT NULL) ENGINE = 'MYISAM' ;
1789
+SET @saved_slave_type_conversions = @@slave_type_conversions;
1790
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
1791
[expecting slave to replicate correctly]
1792
INSERT INTO t1 VALUES (1, "", 1);
1793
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
1794
@@ -483,10 +485,7 @@
1795
INSERT INTO t2 VALUES (1, "", 1);
1796
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
1797
Comparing tables master:test.t2 and slave:test.t2
1798
-[expecting slave to stop]
1799
-INSERT INTO t3 VALUES (1, "", 1);
1800
-INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
1801
-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.
1802
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1807
[expecting slave to stop]
1808
INSERT INTO t5 VALUES (1, "", 1);
1809
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
1810
-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.
1811
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)'
1816
[expecting slave to stop]
1817
INSERT INTO t6 VALUES (1, "", 1);
1818
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
1819
-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.
1820
+Last_SQL_Error = Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)'
1824
diff -Nur a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
1825
--- a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result 2010-08-04 19:22:43.228460035 +0400
1826
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result 2010-08-04 19:23:00.748458952 +0400
1828
X Q 5 7 R 49 X Z 2 S 2
1829
X Q 5 9 R 81 X Y 2 S 1
1830
X Q 5 9 R 81 X Z 2 S 2
1831
+SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
1832
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY';
1833
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' ;
1834
INSERT INTO t4 SET C1 = 1;
1835
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
1837
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
1840
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1841
CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'INNODB' ;
1842
--- on slave: original values ---
1843
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
1845
CREATE TABLE t7 (i INT NOT NULL,
1846
c CHAR(255) CHARACTER SET utf8 NOT NULL,
1847
j INT NOT NULL) ENGINE = 'INNODB' ;
1848
+SET @saved_slave_type_conversions = @@slave_type_conversions;
1849
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
1850
[expecting slave to replicate correctly]
1851
INSERT INTO t1 VALUES (1, "", 1);
1852
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
1853
@@ -483,10 +488,7 @@
1854
INSERT INTO t2 VALUES (1, "", 1);
1855
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
1856
Comparing tables master:test.t2 and slave:test.t2
1857
-[expecting slave to stop]
1858
-INSERT INTO t3 VALUES (1, "", 1);
1859
-INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
1860
-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.
1861
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1866
[expecting slave to stop]
1867
INSERT INTO t5 VALUES (1, "", 1);
1868
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
1869
-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.
1870
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)'
1875
[expecting slave to stop]
1876
INSERT INTO t6 VALUES (1, "", 1);
1877
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
1878
-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.
1879
+Last_SQL_Error = Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)'
1884
UPDATE t1 SET a = 8 WHERE a < 5;
1885
Comparing tables master:test.t1 and slave:test.t1
1887
+SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
1888
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY';
1889
CREATE TABLE t1 (a bit) ENGINE='INNODB' ;
1890
INSERT IGNORE INTO t1 VALUES (NULL);
1891
INSERT INTO t1 ( a ) VALUES ( 0 );
1893
UPDATE t1 SET a = 8 WHERE a = 5 LIMIT 2;
1894
INSERT INTO t1 ( a ) VALUES ( 1 );
1895
UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3;
1896
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
1897
Comparing tables master:test.t1 and slave:test.t1
1899
diff -Nur a/mysql-test/suite/rpl/r/rpl_row_colSize.result b/mysql-test/suite/rpl/r/rpl_row_colSize.result
1900
--- a/mysql-test/suite/rpl/r/rpl_row_colSize.result 2010-08-04 19:22:43.228460035 +0400
1901
+++ b/mysql-test/suite/rpl/r/rpl_row_colSize.result 2010-08-04 19:23:00.748458952 +0400
1904
INSERT INTO t1 VALUES (901251.90125);
1906
-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.
1907
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
1908
SELECT COUNT(*) FROM t1;
1913
INSERT INTO t1 VALUES (901251.90125);
1915
-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.
1916
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'decimal(27,18)' to type 'decimal(27,9)'
1917
SELECT COUNT(*) FROM t1;
1922
INSERT INTO t1 VALUES (901251.90125);
1924
-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.
1925
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
1926
SELECT COUNT(*) FROM t1;
1931
INSERT INTO t1 VALUES (901251.90125);
1933
-Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 5, test.t1 has type 4
1934
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'double' to type 'float'
1935
SELECT COUNT(*) FROM t1;
1940
INSERT INTO t1 VALUES (B'10101');
1942
-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.
1943
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'bit(64)' to type 'bit(5)'
1944
SELECT COUNT(*) FROM t1;
1949
INSERT INTO t1 VALUES (B'10101');
1951
-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.
1952
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'bit(12)' to type 'bit(11)'
1953
SELECT COUNT(*) FROM t1;
1958
INSERT INTO t1 VALUES ('4');
1960
-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.
1961
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'set' to type 'set('4')'
1962
SELECT COUNT(*) FROM t1;
1967
INSERT INTO t1 VALUES ('This is a test.');
1969
-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.
1970
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'char(20)' to type 'char(10)'
1971
SELECT COUNT(*) FROM t1;
1976
INSERT INTO t1 VALUES ('44');
1978
-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.
1979
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'enum' to type 'enum('44','54')'
1980
SELECT COUNT(*) FROM t1;
1985
INSERT INTO t1 VALUES ('This is a test.');
1987
-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.
1988
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(100)'
1989
SELECT COUNT(*) FROM t1;
1994
INSERT INTO t1 VALUES ('This is a test.');
1996
-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.
1997
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'varchar(200)' to type 'varchar(10)'
1998
SELECT COUNT(*) FROM t1;
2003
INSERT INTO t1 VALUES ('This is a test.');
2005
-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.
2006
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(1000)'
2007
SELECT COUNT(*) FROM t1;
2012
INSERT INTO t1 VALUES ('This is a test.');
2014
-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.
2015
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'tinyblob' to type 'tinyblob'
2016
SELECT COUNT(*) FROM t1;
2019
diff -Nur a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
2020
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result 2010-08-04 19:22:43.228460035 +0400
2021
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result 2010-08-04 19:23:00.748458952 +0400
2022
@@ -122,19 +122,19 @@
2023
INSERT INTO t9 VALUES (4);
2024
INSERT INTO t4 VALUES (4);
2025
--source include/wait_for_slave_sql_error_and_skip.inc
2026
-Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4
2027
+Last_SQL_Error = Column 0 of table 'test.t4' cannot be converted from type 'int' to type 'float'
2028
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
2029
include/start_slave.inc
2030
INSERT INTO t9 VALUES (5);
2031
INSERT INTO t5 VALUES (5,10,25);
2032
--source include/wait_for_slave_sql_error_and_skip.inc
2033
-Last_SQL_Error = Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4
2034
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'int' to type 'float'
2035
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
2036
include/start_slave.inc
2037
INSERT INTO t9 VALUES (6);
2038
INSERT INTO t6 VALUES (6,12,36);
2039
--source include/wait_for_slave_sql_error_and_skip.inc
2040
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4
2041
+Last_SQL_Error = Column 2 of table 'test.t6' cannot be converted from type 'int' to type 'float'
2042
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
2043
include/start_slave.inc
2044
INSERT INTO t9 VALUES (6);
2045
diff -Nur a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
2046
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result 2010-08-04 19:22:43.228460035 +0400
2047
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result 2010-08-04 19:23:00.748458952 +0400
2048
@@ -122,19 +122,19 @@
2049
INSERT INTO t9 VALUES (4);
2050
INSERT INTO t4 VALUES (4);
2051
--source include/wait_for_slave_sql_error_and_skip.inc
2052
-Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4
2053
+Last_SQL_Error = Column 0 of table 'test.t4' cannot be converted from type 'int' to type 'float'
2054
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
2055
include/start_slave.inc
2056
INSERT INTO t9 VALUES (5);
2057
INSERT INTO t5 VALUES (5,10,25);
2058
--source include/wait_for_slave_sql_error_and_skip.inc
2059
-Last_SQL_Error = Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4
2060
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'int' to type 'float'
2061
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
2062
include/start_slave.inc
2063
INSERT INTO t9 VALUES (6);
2064
INSERT INTO t6 VALUES (6,12,36);
2065
--source include/wait_for_slave_sql_error_and_skip.inc
2066
-Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4
2067
+Last_SQL_Error = Column 2 of table 'test.t6' cannot be converted from type 'int' to type 'float'
2068
SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
2069
include/start_slave.inc
2070
INSERT INTO t9 VALUES (6);
2071
diff -Nur a/mysql-test/suite/rpl/r/rpl_typeconv.result b/mysql-test/suite/rpl/r/rpl_typeconv.result
2072
--- a/mysql-test/suite/rpl/r/rpl_typeconv.result 1970-01-01 03:00:00.000000000 +0300
2073
+++ b/mysql-test/suite/rpl/r/rpl_typeconv.result 2010-08-04 19:23:00.748458952 +0400
2076
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
2079
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
2081
+set @saved_slave_type_conversions = @@global.slave_type_conversions;
2082
+CREATE TABLE type_conversions (
2083
+TestNo INT AUTO_INCREMENT PRIMARY KEY,
2092
+SELECT @@global.slave_type_conversions;
2093
+@@global.slave_type_conversions
2095
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
2096
+SELECT @@global.slave_type_conversions;
2097
+@@global.slave_type_conversions
2099
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
2100
+SELECT @@global.slave_type_conversions;
2101
+@@global.slave_type_conversions
2103
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
2104
+SELECT @@global.slave_type_conversions;
2105
+@@global.slave_type_conversions
2107
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
2108
+SELECT @@global.slave_type_conversions;
2109
+@@global.slave_type_conversions
2110
+ALL_LOSSY,ALL_NON_LOSSY
2111
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT';
2112
+ERROR 42000: Variable 'slave_type_conversions' can't be set to the value of 'NONEXISTING_BIT'
2113
+SELECT @@global.slave_type_conversions;
2114
+@@global.slave_type_conversions
2115
+ALL_LOSSY,ALL_NON_LOSSY
2116
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
2117
+**** Running tests with @@SLAVE_TYPE_CONVERSIONS = '' ****
2118
+**** Resetting master and slave ****
2119
+include/stop_slave.inc
2122
+include/start_slave.inc
2123
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
2124
+**** Running tests with @@SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY' ****
2125
+**** Resetting master and slave ****
2126
+include/stop_slave.inc
2129
+include/start_slave.inc
2130
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
2131
+**** Running tests with @@SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY' ****
2132
+**** Resetting master and slave ****
2133
+include/stop_slave.inc
2136
+include/start_slave.inc
2137
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
2138
+**** Running tests with @@SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY,ALL_NON_LOSSY' ****
2139
+**** Resetting master and slave ****
2140
+include/stop_slave.inc
2143
+include/start_slave.inc
2144
+**** Result of conversions ****
2145
+Source_Type Target_Type All_Type_Conversion_Flags Value_On_Slave
2146
+TINYBLOB TINYBLOB <Correct value>
2147
+TINYBLOB BLOB <Correct error>
2148
+TINYBLOB MEDIUMBLOB <Correct error>
2149
+TINYBLOB LONGBLOB <Correct error>
2150
+BLOB TINYBLOB <Correct error>
2151
+BLOB BLOB <Correct value>
2152
+BLOB MEDIUMBLOB <Correct error>
2153
+BLOB LONGBLOB <Correct error>
2154
+MEDIUMBLOB TINYBLOB <Correct error>
2155
+MEDIUMBLOB BLOB <Correct error>
2156
+MEDIUMBLOB MEDIUMBLOB <Correct value>
2157
+MEDIUMBLOB LONGBLOB <Correct error>
2158
+LONGBLOB TINYBLOB <Correct error>
2159
+LONGBLOB BLOB <Correct error>
2160
+LONGBLOB MEDIUMBLOB <Correct error>
2161
+LONGBLOB LONGBLOB <Correct value>
2162
+GEOMETRY BLOB <Correct error>
2163
+BLOB GEOMETRY <Correct error>
2164
+GEOMETRY GEOMETRY <Correct value>
2165
+BIT(1) BIT(1) <Correct value>
2166
+DATE DATE <Correct value>
2167
+ENUM('master',' ENUM('master',' <Correct value>
2168
+CHAR(10) ENUM('master',' <Correct error>
2169
+CHAR(10) SET('master','s <Correct error>
2170
+ENUM('master',' CHAR(10) <Correct error>
2171
+SET('master','s CHAR(10) <Correct error>
2172
+SET('master','s SET('master','s <Correct value>
2173
+SET('master','s SET('master','s <Correct value>
2174
+SET('0','1','2' SET('0','1','2' <Correct value>
2175
+SET('0','1','2' SET('0','1','2' <Correct error>
2176
+SET('0','1','2' SET('0','1','2' <Correct error>
2177
+SET('0','1','2' SET('0','1','2' <Correct error>
2178
+TINYINT TINYINT <Correct value>
2179
+TINYINT SMALLINT <Correct error>
2180
+TINYINT MEDIUMINT <Correct error>
2181
+TINYINT INT <Correct error>
2182
+TINYINT BIGINT <Correct error>
2183
+SMALLINT TINYINT <Correct error>
2184
+SMALLINT TINYINT <Correct error>
2185
+SMALLINT TINYINT UNSIGNE <Correct error>
2186
+SMALLINT SMALLINT <Correct value>
2187
+SMALLINT MEDIUMINT <Correct error>
2188
+SMALLINT INT <Correct error>
2189
+SMALLINT BIGINT <Correct error>
2190
+MEDIUMINT TINYINT <Correct error>
2191
+MEDIUMINT TINYINT <Correct error>
2192
+MEDIUMINT TINYINT UNSIGNE <Correct error>
2193
+MEDIUMINT SMALLINT <Correct error>
2194
+MEDIUMINT MEDIUMINT <Correct value>
2195
+MEDIUMINT INT <Correct error>
2196
+MEDIUMINT BIGINT <Correct error>
2197
+INT TINYINT <Correct error>
2198
+INT TINYINT <Correct error>
2199
+INT TINYINT UNSIGNE <Correct error>
2200
+INT SMALLINT <Correct error>
2201
+INT MEDIUMINT <Correct error>
2202
+INT INT <Correct value>
2203
+INT BIGINT <Correct error>
2204
+BIGINT TINYINT <Correct error>
2205
+BIGINT SMALLINT <Correct error>
2206
+BIGINT MEDIUMINT <Correct error>
2207
+BIGINT INT <Correct error>
2208
+BIGINT BIGINT <Correct value>
2209
+CHAR(20) CHAR(20) <Correct value>
2210
+CHAR(20) CHAR(30) <Correct error>
2211
+CHAR(20) CHAR(10) <Correct error>
2212
+CHAR(20) VARCHAR(20) <Correct error>
2213
+CHAR(20) VARCHAR(30) <Correct error>
2214
+CHAR(20) VARCHAR(10) <Correct error>
2215
+CHAR(20) TINYTEXT <Correct error>
2216
+CHAR(20) TEXT <Correct error>
2217
+CHAR(20) MEDIUMTEXT <Correct error>
2218
+CHAR(20) LONGTEXT <Correct error>
2219
+VARCHAR(20) VARCHAR(20) <Correct value>
2220
+VARCHAR(20) VARCHAR(30) <Correct error>
2221
+VARCHAR(20) VARCHAR(10) <Correct error>
2222
+VARCHAR(20) CHAR(30) <Correct error>
2223
+VARCHAR(20) CHAR(10) <Correct error>
2224
+VARCHAR(20) TINYTEXT <Correct error>
2225
+VARCHAR(20) TEXT <Correct error>
2226
+VARCHAR(20) MEDIUMTEXT <Correct error>
2227
+VARCHAR(20) LONGTEXT <Correct error>
2228
+VARCHAR(500) VARCHAR(500) <Correct value>
2229
+VARCHAR(500) VARCHAR(510) <Correct error>
2230
+VARCHAR(500) VARCHAR(255) <Correct error>
2231
+VARCHAR(500) TINYTEXT <Correct error>
2232
+VARCHAR(500) TEXT <Correct error>
2233
+VARCHAR(500) MEDIUMTEXT <Correct error>
2234
+VARCHAR(500) LONGTEXT <Correct error>
2235
+TINYTEXT VARCHAR(500) <Correct error>
2236
+TEXT VARCHAR(500) <Correct error>
2237
+MEDIUMTEXT VARCHAR(500) <Correct error>
2238
+LONGTEXT VARCHAR(500) <Correct error>
2239
+TINYTEXT CHAR(255) <Correct error>
2240
+TINYTEXT CHAR(250) <Correct error>
2241
+TEXT CHAR(255) <Correct error>
2242
+MEDIUMTEXT CHAR(255) <Correct error>
2243
+LONGTEXT CHAR(255) <Correct error>
2244
+TINYTEXT TINYTEXT <Correct value>
2245
+TINYTEXT TEXT <Correct error>
2246
+TEXT TINYTEXT <Correct error>
2247
+DECIMAL(10,5) DECIMAL(10,5) <Correct value>
2248
+DECIMAL(10,5) DECIMAL(10,6) <Correct error>
2249
+DECIMAL(10,5) DECIMAL(11,5) <Correct error>
2250
+DECIMAL(10,5) DECIMAL(11,6) <Correct error>
2251
+DECIMAL(10,5) DECIMAL(10,4) <Correct error>
2252
+DECIMAL(10,5) DECIMAL(9,5) <Correct error>
2253
+DECIMAL(10,5) DECIMAL(9,4) <Correct error>
2254
+FLOAT DECIMAL(10,5) <Correct error>
2255
+DOUBLE DECIMAL(10,5) <Correct error>
2256
+DECIMAL(10,5) FLOAT <Correct error>
2257
+DECIMAL(10,5) DOUBLE <Correct error>
2258
+FLOAT FLOAT <Correct value>
2259
+DOUBLE DOUBLE <Correct value>
2260
+FLOAT DOUBLE <Correct error>
2261
+DOUBLE FLOAT <Correct error>
2262
+BIT(5) BIT(5) <Correct value>
2263
+BIT(5) BIT(6) <Correct error>
2264
+BIT(6) BIT(5) <Correct error>
2265
+BIT(5) BIT(12) <Correct error>
2266
+BIT(12) BIT(5) <Correct error>
2267
+TINYBLOB TINYBLOB ALL_NON_LOSSY <Correct value>
2268
+TINYBLOB BLOB ALL_NON_LOSSY <Correct value>
2269
+TINYBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
2270
+TINYBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
2271
+BLOB TINYBLOB ALL_NON_LOSSY <Correct error>
2272
+BLOB BLOB ALL_NON_LOSSY <Correct value>
2273
+BLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
2274
+BLOB LONGBLOB ALL_NON_LOSSY <Correct value>
2275
+MEDIUMBLOB TINYBLOB ALL_NON_LOSSY <Correct error>
2276
+MEDIUMBLOB BLOB ALL_NON_LOSSY <Correct error>
2277
+MEDIUMBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
2278
+MEDIUMBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
2279
+LONGBLOB TINYBLOB ALL_NON_LOSSY <Correct error>
2280
+LONGBLOB BLOB ALL_NON_LOSSY <Correct error>
2281
+LONGBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct error>
2282
+LONGBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
2283
+GEOMETRY BLOB ALL_NON_LOSSY <Correct error>
2284
+BLOB GEOMETRY ALL_NON_LOSSY <Correct error>
2285
+GEOMETRY GEOMETRY ALL_NON_LOSSY <Correct value>
2286
+BIT(1) BIT(1) ALL_NON_LOSSY <Correct value>
2287
+DATE DATE ALL_NON_LOSSY <Correct value>
2288
+ENUM('master',' ENUM('master',' ALL_NON_LOSSY <Correct value>
2289
+CHAR(10) ENUM('master',' ALL_NON_LOSSY <Correct error>
2290
+CHAR(10) SET('master','s ALL_NON_LOSSY <Correct error>
2291
+ENUM('master',' CHAR(10) ALL_NON_LOSSY <Correct error>
2292
+SET('master','s CHAR(10) ALL_NON_LOSSY <Correct error>
2293
+SET('master','s SET('master','s ALL_NON_LOSSY <Correct value>
2294
+SET('master','s SET('master','s ALL_NON_LOSSY <Correct value>
2295
+SET('0','1','2' SET('0','1','2' ALL_NON_LOSSY <Correct value>
2296
+SET('0','1','2' SET('0','1','2' ALL_NON_LOSSY <Correct value>
2297
+SET('0','1','2' SET('0','1','2' ALL_NON_LOSSY <Correct error>
2298
+SET('0','1','2' SET('0','1','2' ALL_NON_LOSSY <Correct error>
2299
+TINYINT TINYINT ALL_NON_LOSSY <Correct value>
2300
+TINYINT SMALLINT ALL_NON_LOSSY <Correct value>
2301
+TINYINT MEDIUMINT ALL_NON_LOSSY <Correct value>
2302
+TINYINT INT ALL_NON_LOSSY <Correct value>
2303
+TINYINT BIGINT ALL_NON_LOSSY <Correct value>
2304
+SMALLINT TINYINT ALL_NON_LOSSY <Correct error>
2305
+SMALLINT TINYINT ALL_NON_LOSSY <Correct error>
2306
+SMALLINT TINYINT UNSIGNE ALL_NON_LOSSY <Correct error>
2307
+SMALLINT SMALLINT ALL_NON_LOSSY <Correct value>
2308
+SMALLINT MEDIUMINT ALL_NON_LOSSY <Correct value>
2309
+SMALLINT INT ALL_NON_LOSSY <Correct value>
2310
+SMALLINT BIGINT ALL_NON_LOSSY <Correct value>
2311
+MEDIUMINT TINYINT ALL_NON_LOSSY <Correct error>
2312
+MEDIUMINT TINYINT ALL_NON_LOSSY <Correct error>
2313
+MEDIUMINT TINYINT UNSIGNE ALL_NON_LOSSY <Correct error>
2314
+MEDIUMINT SMALLINT ALL_NON_LOSSY <Correct error>
2315
+MEDIUMINT MEDIUMINT ALL_NON_LOSSY <Correct value>
2316
+MEDIUMINT INT ALL_NON_LOSSY <Correct value>
2317
+MEDIUMINT BIGINT ALL_NON_LOSSY <Correct value>
2318
+INT TINYINT ALL_NON_LOSSY <Correct error>
2319
+INT TINYINT ALL_NON_LOSSY <Correct error>
2320
+INT TINYINT UNSIGNE ALL_NON_LOSSY <Correct error>
2321
+INT SMALLINT ALL_NON_LOSSY <Correct error>
2322
+INT MEDIUMINT ALL_NON_LOSSY <Correct error>
2323
+INT INT ALL_NON_LOSSY <Correct value>
2324
+INT BIGINT ALL_NON_LOSSY <Correct value>
2325
+BIGINT TINYINT ALL_NON_LOSSY <Correct error>
2326
+BIGINT SMALLINT ALL_NON_LOSSY <Correct error>
2327
+BIGINT MEDIUMINT ALL_NON_LOSSY <Correct error>
2328
+BIGINT INT ALL_NON_LOSSY <Correct error>
2329
+BIGINT BIGINT ALL_NON_LOSSY <Correct value>
2330
+CHAR(20) CHAR(20) ALL_NON_LOSSY <Correct value>
2331
+CHAR(20) CHAR(30) ALL_NON_LOSSY <Correct value>
2332
+CHAR(20) CHAR(10) ALL_NON_LOSSY <Correct error>
2333
+CHAR(20) VARCHAR(20) ALL_NON_LOSSY <Correct value>
2334
+CHAR(20) VARCHAR(30) ALL_NON_LOSSY <Correct value>
2335
+CHAR(20) VARCHAR(10) ALL_NON_LOSSY <Correct error>
2336
+CHAR(20) TINYTEXT ALL_NON_LOSSY <Correct value>
2337
+CHAR(20) TEXT ALL_NON_LOSSY <Correct value>
2338
+CHAR(20) MEDIUMTEXT ALL_NON_LOSSY <Correct value>
2339
+CHAR(20) LONGTEXT ALL_NON_LOSSY <Correct value>
2340
+VARCHAR(20) VARCHAR(20) ALL_NON_LOSSY <Correct value>
2341
+VARCHAR(20) VARCHAR(30) ALL_NON_LOSSY <Correct value>
2342
+VARCHAR(20) VARCHAR(10) ALL_NON_LOSSY <Correct error>
2343
+VARCHAR(20) CHAR(30) ALL_NON_LOSSY <Correct value>
2344
+VARCHAR(20) CHAR(10) ALL_NON_LOSSY <Correct error>
2345
+VARCHAR(20) TINYTEXT ALL_NON_LOSSY <Correct value>
2346
+VARCHAR(20) TEXT ALL_NON_LOSSY <Correct value>
2347
+VARCHAR(20) MEDIUMTEXT ALL_NON_LOSSY <Correct value>
2348
+VARCHAR(20) LONGTEXT ALL_NON_LOSSY <Correct value>
2349
+VARCHAR(500) VARCHAR(500) ALL_NON_LOSSY <Correct value>
2350
+VARCHAR(500) VARCHAR(510) ALL_NON_LOSSY <Correct value>
2351
+VARCHAR(500) VARCHAR(255) ALL_NON_LOSSY <Correct error>
2352
+VARCHAR(500) TINYTEXT ALL_NON_LOSSY <Correct error>
2353
+VARCHAR(500) TEXT ALL_NON_LOSSY <Correct value>
2354
+VARCHAR(500) MEDIUMTEXT ALL_NON_LOSSY <Correct value>
2355
+VARCHAR(500) LONGTEXT ALL_NON_LOSSY <Correct value>
2356
+TINYTEXT VARCHAR(500) ALL_NON_LOSSY <Correct value>
2357
+TEXT VARCHAR(500) ALL_NON_LOSSY <Correct error>
2358
+MEDIUMTEXT VARCHAR(500) ALL_NON_LOSSY <Correct error>
2359
+LONGTEXT VARCHAR(500) ALL_NON_LOSSY <Correct error>
2360
+TINYTEXT CHAR(255) ALL_NON_LOSSY <Correct value>
2361
+TINYTEXT CHAR(250) ALL_NON_LOSSY <Correct error>
2362
+TEXT CHAR(255) ALL_NON_LOSSY <Correct error>
2363
+MEDIUMTEXT CHAR(255) ALL_NON_LOSSY <Correct error>
2364
+LONGTEXT CHAR(255) ALL_NON_LOSSY <Correct error>
2365
+TINYTEXT TINYTEXT ALL_NON_LOSSY <Correct value>
2366
+TINYTEXT TEXT ALL_NON_LOSSY <Correct value>
2367
+TEXT TINYTEXT ALL_NON_LOSSY <Correct error>
2368
+DECIMAL(10,5) DECIMAL(10,5) ALL_NON_LOSSY <Correct value>
2369
+DECIMAL(10,5) DECIMAL(10,6) ALL_NON_LOSSY <Correct value>
2370
+DECIMAL(10,5) DECIMAL(11,5) ALL_NON_LOSSY <Correct value>
2371
+DECIMAL(10,5) DECIMAL(11,6) ALL_NON_LOSSY <Correct value>
2372
+DECIMAL(10,5) DECIMAL(10,4) ALL_NON_LOSSY <Correct error>
2373
+DECIMAL(10,5) DECIMAL(9,5) ALL_NON_LOSSY <Correct error>
2374
+DECIMAL(10,5) DECIMAL(9,4) ALL_NON_LOSSY <Correct error>
2375
+FLOAT DECIMAL(10,5) ALL_NON_LOSSY <Correct error>
2376
+DOUBLE DECIMAL(10,5) ALL_NON_LOSSY <Correct error>
2377
+DECIMAL(10,5) FLOAT ALL_NON_LOSSY <Correct error>
2378
+DECIMAL(10,5) DOUBLE ALL_NON_LOSSY <Correct error>
2379
+FLOAT FLOAT ALL_NON_LOSSY <Correct value>
2380
+DOUBLE DOUBLE ALL_NON_LOSSY <Correct value>
2381
+FLOAT DOUBLE ALL_NON_LOSSY <Correct value>
2382
+DOUBLE FLOAT ALL_NON_LOSSY <Correct error>
2383
+BIT(5) BIT(5) ALL_NON_LOSSY <Correct value>
2384
+BIT(5) BIT(6) ALL_NON_LOSSY <Correct value>
2385
+BIT(6) BIT(5) ALL_NON_LOSSY <Correct error>
2386
+BIT(5) BIT(12) ALL_NON_LOSSY <Correct value>
2387
+BIT(12) BIT(5) ALL_NON_LOSSY <Correct error>
2388
+TINYBLOB TINYBLOB ALL_LOSSY <Correct value>
2389
+TINYBLOB BLOB ALL_LOSSY <Correct error>
2390
+TINYBLOB MEDIUMBLOB ALL_LOSSY <Correct error>
2391
+TINYBLOB LONGBLOB ALL_LOSSY <Correct error>
2392
+BLOB TINYBLOB ALL_LOSSY <Correct value>
2393
+BLOB BLOB ALL_LOSSY <Correct value>
2394
+BLOB MEDIUMBLOB ALL_LOSSY <Correct error>
2395
+BLOB LONGBLOB ALL_LOSSY <Correct error>
2396
+MEDIUMBLOB TINYBLOB ALL_LOSSY <Correct value>
2397
+MEDIUMBLOB BLOB ALL_LOSSY <Correct value>
2398
+MEDIUMBLOB MEDIUMBLOB ALL_LOSSY <Correct value>
2399
+MEDIUMBLOB LONGBLOB ALL_LOSSY <Correct error>
2400
+LONGBLOB TINYBLOB ALL_LOSSY <Correct value>
2401
+LONGBLOB BLOB ALL_LOSSY <Correct value>
2402
+LONGBLOB MEDIUMBLOB ALL_LOSSY <Correct value>
2403
+LONGBLOB LONGBLOB ALL_LOSSY <Correct value>
2404
+GEOMETRY BLOB ALL_LOSSY <Correct error>
2405
+BLOB GEOMETRY ALL_LOSSY <Correct error>
2406
+GEOMETRY GEOMETRY ALL_LOSSY <Correct value>
2407
+BIT(1) BIT(1) ALL_LOSSY <Correct value>
2408
+DATE DATE ALL_LOSSY <Correct value>
2409
+ENUM('master',' ENUM('master',' ALL_LOSSY <Correct value>
2410
+CHAR(10) ENUM('master',' ALL_LOSSY <Correct error>
2411
+CHAR(10) SET('master','s ALL_LOSSY <Correct error>
2412
+ENUM('master',' CHAR(10) ALL_LOSSY <Correct error>
2413
+SET('master','s CHAR(10) ALL_LOSSY <Correct error>
2414
+SET('master','s SET('master','s ALL_LOSSY <Correct value>
2415
+SET('master','s SET('master','s ALL_LOSSY <Correct value>
2416
+SET('0','1','2' SET('0','1','2' ALL_LOSSY <Correct value>
2417
+SET('0','1','2' SET('0','1','2' ALL_LOSSY <Correct error>
2418
+SET('0','1','2' SET('0','1','2' ALL_LOSSY <Correct value>
2419
+SET('0','1','2' SET('0','1','2' ALL_LOSSY <Correct value>
2420
+TINYINT TINYINT ALL_LOSSY <Correct value>
2421
+TINYINT SMALLINT ALL_LOSSY <Correct error>
2422
+TINYINT MEDIUMINT ALL_LOSSY <Correct error>
2423
+TINYINT INT ALL_LOSSY <Correct error>
2424
+TINYINT BIGINT ALL_LOSSY <Correct error>
2425
+SMALLINT TINYINT ALL_LOSSY <Correct value>
2426
+SMALLINT TINYINT ALL_LOSSY <Correct value>
2427
+SMALLINT TINYINT UNSIGNE ALL_LOSSY <Correct value>
2428
+SMALLINT SMALLINT ALL_LOSSY <Correct value>
2429
+SMALLINT MEDIUMINT ALL_LOSSY <Correct error>
2430
+SMALLINT INT ALL_LOSSY <Correct error>
2431
+SMALLINT BIGINT ALL_LOSSY <Correct error>
2432
+MEDIUMINT TINYINT ALL_LOSSY <Correct value>
2433
+MEDIUMINT TINYINT ALL_LOSSY <Correct value>
2434
+MEDIUMINT TINYINT UNSIGNE ALL_LOSSY <Correct value>
2435
+MEDIUMINT SMALLINT ALL_LOSSY <Correct value>
2436
+MEDIUMINT MEDIUMINT ALL_LOSSY <Correct value>
2437
+MEDIUMINT INT ALL_LOSSY <Correct error>
2438
+MEDIUMINT BIGINT ALL_LOSSY <Correct error>
2439
+INT TINYINT ALL_LOSSY <Correct value>
2440
+INT TINYINT ALL_LOSSY <Correct value>
2441
+INT TINYINT UNSIGNE ALL_LOSSY <Correct value>
2442
+INT SMALLINT ALL_LOSSY <Correct value>
2443
+INT MEDIUMINT ALL_LOSSY <Correct value>
2444
+INT INT ALL_LOSSY <Correct value>
2445
+INT BIGINT ALL_LOSSY <Correct error>
2446
+BIGINT TINYINT ALL_LOSSY <Correct value>
2447
+BIGINT SMALLINT ALL_LOSSY <Correct value>
2448
+BIGINT MEDIUMINT ALL_LOSSY <Correct value>
2449
+BIGINT INT ALL_LOSSY <Correct value>
2450
+BIGINT BIGINT ALL_LOSSY <Correct value>
2451
+CHAR(20) CHAR(20) ALL_LOSSY <Correct value>
2452
+CHAR(20) CHAR(30) ALL_LOSSY <Correct error>
2453
+CHAR(20) CHAR(10) ALL_LOSSY <Correct value>
2454
+CHAR(20) VARCHAR(20) ALL_LOSSY <Correct error>
2455
+CHAR(20) VARCHAR(30) ALL_LOSSY <Correct error>
2456
+CHAR(20) VARCHAR(10) ALL_LOSSY <Correct value>
2457
+CHAR(20) TINYTEXT ALL_LOSSY <Correct error>
2458
+CHAR(20) TEXT ALL_LOSSY <Correct error>
2459
+CHAR(20) MEDIUMTEXT ALL_LOSSY <Correct error>
2460
+CHAR(20) LONGTEXT ALL_LOSSY <Correct error>
2461
+VARCHAR(20) VARCHAR(20) ALL_LOSSY <Correct value>
2462
+VARCHAR(20) VARCHAR(30) ALL_LOSSY <Correct error>
2463
+VARCHAR(20) VARCHAR(10) ALL_LOSSY <Correct value>
2464
+VARCHAR(20) CHAR(30) ALL_LOSSY <Correct error>
2465
+VARCHAR(20) CHAR(10) ALL_LOSSY <Correct value>
2466
+VARCHAR(20) TINYTEXT ALL_LOSSY <Correct error>
2467
+VARCHAR(20) TEXT ALL_LOSSY <Correct error>
2468
+VARCHAR(20) MEDIUMTEXT ALL_LOSSY <Correct error>
2469
+VARCHAR(20) LONGTEXT ALL_LOSSY <Correct error>
2470
+VARCHAR(500) VARCHAR(500) ALL_LOSSY <Correct value>
2471
+VARCHAR(500) VARCHAR(510) ALL_LOSSY <Correct error>
2472
+VARCHAR(500) VARCHAR(255) ALL_LOSSY <Correct value>
2473
+VARCHAR(500) TINYTEXT ALL_LOSSY <Correct value>
2474
+VARCHAR(500) TEXT ALL_LOSSY <Correct error>
2475
+VARCHAR(500) MEDIUMTEXT ALL_LOSSY <Correct error>
2476
+VARCHAR(500) LONGTEXT ALL_LOSSY <Correct error>
2477
+TINYTEXT VARCHAR(500) ALL_LOSSY <Correct error>
2478
+TEXT VARCHAR(500) ALL_LOSSY <Correct value>
2479
+MEDIUMTEXT VARCHAR(500) ALL_LOSSY <Correct value>
2480
+LONGTEXT VARCHAR(500) ALL_LOSSY <Correct value>
2481
+TINYTEXT CHAR(255) ALL_LOSSY <Correct error>
2482
+TINYTEXT CHAR(250) ALL_LOSSY <Correct value>
2483
+TEXT CHAR(255) ALL_LOSSY <Correct value>
2484
+MEDIUMTEXT CHAR(255) ALL_LOSSY <Correct value>
2485
+LONGTEXT CHAR(255) ALL_LOSSY <Correct value>
2486
+TINYTEXT TINYTEXT ALL_LOSSY <Correct value>
2487
+TINYTEXT TEXT ALL_LOSSY <Correct error>
2488
+TEXT TINYTEXT ALL_LOSSY <Correct value>
2489
+DECIMAL(10,5) DECIMAL(10,5) ALL_LOSSY <Correct value>
2490
+DECIMAL(10,5) DECIMAL(10,6) ALL_LOSSY <Correct error>
2491
+DECIMAL(10,5) DECIMAL(11,5) ALL_LOSSY <Correct error>
2492
+DECIMAL(10,5) DECIMAL(11,6) ALL_LOSSY <Correct error>
2493
+DECIMAL(10,5) DECIMAL(10,4) ALL_LOSSY <Correct value>
2494
+DECIMAL(10,5) DECIMAL(9,5) ALL_LOSSY <Correct value>
2495
+DECIMAL(10,5) DECIMAL(9,4) ALL_LOSSY <Correct value>
2496
+FLOAT DECIMAL(10,5) ALL_LOSSY <Correct value>
2497
+DOUBLE DECIMAL(10,5) ALL_LOSSY <Correct value>
2498
+DECIMAL(10,5) FLOAT ALL_LOSSY <Correct value>
2499
+DECIMAL(10,5) DOUBLE ALL_LOSSY <Correct value>
2500
+FLOAT FLOAT ALL_LOSSY <Correct value>
2501
+DOUBLE DOUBLE ALL_LOSSY <Correct value>
2502
+FLOAT DOUBLE ALL_LOSSY <Correct error>
2503
+DOUBLE FLOAT ALL_LOSSY <Correct value>
2504
+BIT(5) BIT(5) ALL_LOSSY <Correct value>
2505
+BIT(5) BIT(6) ALL_LOSSY <Correct error>
2506
+BIT(6) BIT(5) ALL_LOSSY <Correct value>
2507
+BIT(5) BIT(12) ALL_LOSSY <Correct error>
2508
+BIT(12) BIT(5) ALL_LOSSY <Correct value>
2509
+TINYBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2510
+TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2511
+TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2512
+TINYBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2513
+BLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2514
+BLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2515
+BLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2516
+BLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2517
+MEDIUMBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2518
+MEDIUMBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2519
+MEDIUMBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2520
+MEDIUMBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2521
+LONGBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2522
+LONGBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2523
+LONGBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2524
+LONGBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2525
+GEOMETRY BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct error>
2526
+BLOB GEOMETRY ALL_LOSSY,ALL_NON_LOSSY <Correct error>
2527
+GEOMETRY GEOMETRY ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2528
+BIT(1) BIT(1) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2529
+DATE DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2530
+ENUM('master',' ENUM('master',' ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2531
+CHAR(10) ENUM('master',' ALL_LOSSY,ALL_NON_LOSSY <Correct error>
2532
+CHAR(10) SET('master','s ALL_LOSSY,ALL_NON_LOSSY <Correct error>
2533
+ENUM('master',' CHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct error>
2534
+SET('master','s CHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct error>
2535
+SET('master','s SET('master','s ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2536
+SET('master','s SET('master','s ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2537
+SET('0','1','2' SET('0','1','2' ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2538
+SET('0','1','2' SET('0','1','2' ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2539
+SET('0','1','2' SET('0','1','2' ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2540
+SET('0','1','2' SET('0','1','2' ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2541
+TINYINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2542
+TINYINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2543
+TINYINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2544
+TINYINT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2545
+TINYINT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2546
+SMALLINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2547
+SMALLINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2548
+SMALLINT TINYINT UNSIGNE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2549
+SMALLINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2550
+SMALLINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2551
+SMALLINT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2552
+SMALLINT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2553
+MEDIUMINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2554
+MEDIUMINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2555
+MEDIUMINT TINYINT UNSIGNE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2556
+MEDIUMINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2557
+MEDIUMINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2558
+MEDIUMINT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2559
+MEDIUMINT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2560
+INT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2561
+INT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2562
+INT TINYINT UNSIGNE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2563
+INT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2564
+INT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2565
+INT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2566
+INT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2567
+BIGINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2568
+BIGINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2569
+BIGINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2570
+BIGINT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2571
+BIGINT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2572
+CHAR(20) CHAR(20) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2573
+CHAR(20) CHAR(30) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2574
+CHAR(20) CHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2575
+CHAR(20) VARCHAR(20) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2576
+CHAR(20) VARCHAR(30) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2577
+CHAR(20) VARCHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2578
+CHAR(20) TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2579
+CHAR(20) TEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2580
+CHAR(20) MEDIUMTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2581
+CHAR(20) LONGTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2582
+VARCHAR(20) VARCHAR(20) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2583
+VARCHAR(20) VARCHAR(30) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2584
+VARCHAR(20) VARCHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2585
+VARCHAR(20) CHAR(30) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2586
+VARCHAR(20) CHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2587
+VARCHAR(20) TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2588
+VARCHAR(20) TEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2589
+VARCHAR(20) MEDIUMTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2590
+VARCHAR(20) LONGTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2591
+VARCHAR(500) VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2592
+VARCHAR(500) VARCHAR(510) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2593
+VARCHAR(500) VARCHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2594
+VARCHAR(500) TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2595
+VARCHAR(500) TEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2596
+VARCHAR(500) MEDIUMTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2597
+VARCHAR(500) LONGTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2598
+TINYTEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2599
+TEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2600
+MEDIUMTEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2601
+LONGTEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2602
+TINYTEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2603
+TINYTEXT CHAR(250) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2604
+TEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2605
+MEDIUMTEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2606
+LONGTEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2607
+TINYTEXT TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2608
+TINYTEXT TEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2609
+TEXT TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2610
+DECIMAL(10,5) DECIMAL(10,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2611
+DECIMAL(10,5) DECIMAL(10,6) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2612
+DECIMAL(10,5) DECIMAL(11,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2613
+DECIMAL(10,5) DECIMAL(11,6) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2614
+DECIMAL(10,5) DECIMAL(10,4) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2615
+DECIMAL(10,5) DECIMAL(9,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2616
+DECIMAL(10,5) DECIMAL(9,4) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2617
+FLOAT DECIMAL(10,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2618
+DOUBLE DECIMAL(10,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2619
+DECIMAL(10,5) FLOAT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2620
+DECIMAL(10,5) DOUBLE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2621
+FLOAT FLOAT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2622
+DOUBLE DOUBLE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2623
+FLOAT DOUBLE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2624
+DOUBLE FLOAT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2625
+BIT(5) BIT(5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2626
+BIT(5) BIT(6) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2627
+BIT(6) BIT(5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2628
+BIT(5) BIT(12) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2629
+BIT(12) BIT(5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
2630
+DROP TABLE type_conversions;
2632
+set global slave_type_conversions = @saved_slave_type_conversions;
2633
diff -Nur a/mysql-test/suite/rpl/t/rpl_bug31076.test b/mysql-test/suite/rpl/t/rpl_bug31076.test
2634
--- a/mysql-test/suite/rpl/t/rpl_bug31076.test 2010-08-04 19:22:43.228460035 +0400
2635
+++ b/mysql-test/suite/rpl/t/rpl_bug31076.test 2010-08-04 19:23:00.748458952 +0400
2637
source include/master-slave.inc;
2639
+SET @saved_slave_type_conversions = @@slave_type_conversions;
2640
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
2642
CREATE DATABASE track;
2645
@@ -130,7 +133,10 @@
2646
SELECT * FROM visits;
2647
SELECT * FROM visits_events;
2649
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
2652
DROP DATABASE track;
2653
sync_slave_with_master;
2655
--echo End of 5.1 tests
2656
diff -Nur a/mysql-test/suite/rpl/t/rpl_colSize.test b/mysql-test/suite/rpl/t/rpl_colSize.test
2657
--- a/mysql-test/suite/rpl/t/rpl_colSize.test 2010-08-04 19:22:43.218460716 +0400
2658
+++ b/mysql-test/suite/rpl/t/rpl_colSize.test 2010-08-04 19:23:00.748458952 +0400
2663
+SET @saved_slave_type_conversions = @@slave_type_conversions;
2664
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
2666
eval CREATE TABLE t1 (
2671
sync_slave_with_master;
2673
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
2676
diff -Nur a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
2677
--- a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test 2010-08-04 19:22:43.218460716 +0400
2678
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test 2010-08-04 19:23:00.748458952 +0400
2680
-- source include/have_binlog_format_row.inc
2681
-- source include/master-slave.inc
2684
+let $bit_field_special = ALL_LOSSY;
2685
let $type= 'INNODB' ;
2687
-- source extra/rpl_tests/rpl_row_basic.test
2688
diff -Nur a/mysql-test/suite/rpl/t/rpl_typeconv.test b/mysql-test/suite/rpl/t/rpl_typeconv.test
2689
--- a/mysql-test/suite/rpl/t/rpl_typeconv.test 1970-01-01 03:00:00.000000000 +0300
2690
+++ b/mysql-test/suite/rpl/t/rpl_typeconv.test 2010-08-04 19:23:00.748458952 +0400
2692
+--source include/have_binlog_format_row.inc
2693
+--source include/master-slave.inc
2696
+set @saved_slave_type_conversions = @@global.slave_type_conversions;
2697
+CREATE TABLE type_conversions (
2698
+ TestNo INT AUTO_INCREMENT PRIMARY KEY,
2708
+SELECT @@global.slave_type_conversions;
2709
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
2710
+SELECT @@global.slave_type_conversions;
2711
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
2712
+SELECT @@global.slave_type_conversions;
2713
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
2714
+SELECT @@global.slave_type_conversions;
2715
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
2716
+SELECT @@global.slave_type_conversions;
2717
+--error ER_WRONG_VALUE_FOR_VAR
2718
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT';
2719
+SELECT @@global.slave_type_conversions;
2721
+# Checking strict interpretation of type conversions
2723
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
2724
+source extra/rpl_tests/type_conversions.test;
2726
+# Checking lossy integer type conversions
2728
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
2729
+source extra/rpl_tests/type_conversions.test;
2731
+# Checking non-lossy integer type conversions
2733
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
2734
+source extra/rpl_tests/type_conversions.test;
2736
+# Checking all type conversions
2738
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
2739
+source extra/rpl_tests/type_conversions.test;
2742
+--echo **** Result of conversions ****
2744
+SELECT RPAD(Source, 15, ' ') AS Source_Type,
2745
+ RPAD(Target, 15, ' ') AS Target_Type,
2746
+ RPAD(Flags, 25, ' ') AS All_Type_Conversion_Flags,
2747
+ IF(Compare IS NULL AND Error IS NOT NULL, '<Correct error>',
2748
+ IF(Compare, '<Correct value>',
2749
+ CONCAT("'", On_Slave, "' != '", Expected, "'")))
2751
+ FROM type_conversions;
2753
+DROP TABLE type_conversions;
2757
+sync_slave_with_master;
2759
+set global slave_type_conversions = @saved_slave_type_conversions;
2761
diff -Nur a/patch_info/wl5151.info b/patch_info/wl5151.info
2762
--- a/patch_info/wl5151.info 1970-01-01 03:00:00.000000000 +0300
2763
+++ b/patch_info/wl5151.info 2010-08-04 19:23:00.748458952 +0400
2766
+Name=Backported wl5151 from mysql 5.5 (Row-based replication: attribute promotion and demotion.)
2768
+Author=Percona <info@percona.com>
2770
+Comment=http://dev.mysql.com/doc/refman/5.5/en/replication-features-differing-tables.html#replication-features-attribute-promotion
2771
diff -Nur a/sql/field.cc b/sql/field.cc
2772
--- a/sql/field.cc 2010-08-04 19:22:43.418464122 +0400
2773
+++ b/sql/field.cc 2010-08-04 19:23:00.768460103 +0400
2775
#define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(!table || (!table->read_set || bitmap_is_set(table->read_set, field_index)))
2776
#define ASSERT_COLUMN_MARKED_FOR_WRITE DBUG_ASSERT(!table || (!table->write_set || bitmap_is_set(table->write_set, field_index)))
2778
+#define FLAGSTR(S,F) ((S) & (F) ? #F " " : "")
2781
Rules for merging different types of fields in UNION
2783
@@ -997,6 +999,22 @@
2787
+ Function to compare two unsigned integers for their relative order.
2788
+ Used below. In an anonymous namespace to not clash with definitions
2792
+ int compare(unsigned int a, unsigned int b)
2803
Detect Item_result by given field type of UNION merge result.
2805
@param field_type given field type
2806
@@ -1367,24 +1385,48 @@
2808
Check to see if field size is compatible with destination.
2810
- This method is used in row-based replication to verify that the slave's
2811
- field size is less than or equal to the master's field size. The
2812
- encoded field metadata (from the master or source) is decoded and compared
2813
- to the size of this field (the slave or destination).
2814
+ This method is used in row-based replication to verify that the
2815
+ slave's field size is less than or equal to the master's field
2816
+ size. The encoded field metadata (from the master or source) is
2817
+ decoded and compared to the size of this field (the slave or
2822
+ The comparison is made so that if the source data (from the master)
2823
+ is less than the target data (on the slave), -1 is returned in @c
2824
+ <code>*order_var</code>. This implies that a conversion is
2825
+ necessary, but that it is lossy and can result in truncation of the
2828
+ If the source data is strictly greater than the target data, 1 is
2829
+ returned in <code>*order_var</code>. This implies that the source
2830
+ type can is contained in the target type and that a conversion is
2831
+ necessary but is non-lossy.
2833
+ If no conversion is required to fit the source type in the target
2834
+ type, 0 is returned in <code>*order_var</code>.
2836
@param field_metadata Encoded size in field metadata
2837
@param mflags Flags from the table map event for the table.
2839
- @retval 0 if this field's size is < the source field's size
2840
- @retval 1 if this field's size is >= the source field's size
2842
-int Field::compatible_field_size(uint field_metadata,
2843
- const Relay_log_info *rli_arg __attribute__((unused)),
2844
- uint16 mflags __attribute__((unused)))
2845
+ @param order_var Pointer to variable where the order
2846
+ between the source field and this field
2849
+ @return @c true if this field's size is compatible with the
2850
+ master's field size, @c false otherwise.
2852
+bool Field::compatible_field_size(uint field_metadata,
2853
+ Relay_log_info *rli_arg __attribute__((unused)),
2854
+ uint16 mflags __attribute__((unused)),
2857
uint const source_size= pack_length_from_metadata(field_metadata);
2858
uint const destination_size= row_pack_length();
2859
- return (source_size <= destination_size);
2860
+ DBUG_PRINT("debug", ("real_type: %d, source_size: %u, destination_size: %u",
2861
+ real_type(), source_size, destination_size));
2862
+ *order_var = compare(source_size, destination_size);
2867
@@ -2867,34 +2909,16 @@
2872
- Check to see if field size is compatible with destination.
2874
- This method is used in row-based replication to verify that the slave's
2875
- field size is less than or equal to the master's field size. The
2876
- encoded field metadata (from the master or source) is decoded and compared
2877
- to the size of this field (the slave or destination).
2879
- @param field_metadata Encoded size in field metadata
2881
- @retval 0 if this field's size is < the source field's size
2882
- @retval 1 if this field's size is >= the source field's size
2884
-int Field_new_decimal::compatible_field_size(uint field_metadata,
2885
- const Relay_log_info * __attribute__((unused)),
2886
- uint16 mflags __attribute__((unused)))
2887
+bool Field_new_decimal::compatible_field_size(uint field_metadata,
2888
+ Relay_log_info * __attribute__((unused)),
2889
+ uint16 mflags __attribute__((unused)),
2892
- int compatible= 0;
2893
uint const source_precision= (field_metadata >> 8U) & 0x00ff;
2894
uint const source_decimal= field_metadata & 0x00ff;
2895
- uint const source_size= my_decimal_get_binary_size(source_precision,
2897
- uint const destination_size= row_pack_length();
2898
- compatible= (source_size <= destination_size);
2900
- compatible= (source_precision <= precision) &&
2901
- (source_decimal <= decimals());
2902
- return (compatible);
2903
+ int order= compare(source_precision, precision);
2904
+ *order_var= order != 0 ? order : compare(source_decimal, dec);
2909
@@ -6644,9 +6668,11 @@
2913
-int Field_string::compatible_field_size(uint field_metadata,
2914
- const Relay_log_info *rli_arg,
2915
- uint16 mflags __attribute__((unused)))
2917
+Field_string::compatible_field_size(uint field_metadata,
2918
+ Relay_log_info *rli_arg,
2919
+ uint16 mflags __attribute__((unused)),
2922
#ifdef HAVE_REPLICATION
2923
const Check_field_param check_param = { this };
2924
@@ -6654,7 +6680,7 @@
2925
check_field_for_37426, &check_param))
2926
return FALSE; // Not compatible field sizes
2928
- return Field::compatible_field_size(field_metadata, rli_arg, mflags);
2929
+ return Field::compatible_field_size(field_metadata, rli_arg, mflags, order_var);
2933
@@ -6716,6 +6742,8 @@
2935
uint length= min(field_length,max_length);
2936
uint local_char_length= max_length/field_charset->mbmaxlen;
2937
+ DBUG_PRINT("debug", ("Packing field '%s' - length: %u ", field_name, length));
2939
if (length > local_char_length)
2940
local_char_length= my_charpos(field_charset, from, from+length,
2942
@@ -7562,6 +7590,7 @@
2944
packlength(blob_pack_length)
2946
+ DBUG_ASSERT(blob_pack_length <= 4); // Only pack lengths 1-4 supported currently
2948
share->blob_fields++;
2949
/* TODO: why do not fill table->s->blob_field array here? */
2950
@@ -7972,8 +8001,10 @@
2952
int Field_blob::do_save_field_metadata(uchar *metadata_ptr)
2954
+ DBUG_ENTER("Field_blob::do_save_field_metadata");
2955
*metadata_ptr= pack_length_no_ptr();
2957
+ DBUG_PRINT("debug", ("metadata: %u (pack_length_no_ptr)", *metadata_ptr));
2962
@@ -8919,6 +8950,9 @@
2963
bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7),
2964
bytes_in_rec(len_arg / 8)
2966
+ DBUG_ENTER("Field_bit::Field_bit");
2967
+ DBUG_PRINT("enter", ("ptr_arg: %p, null_ptr_arg: %p, len_arg: %u, bit_len: %u, bytes_in_rec: %u",
2968
+ ptr_arg, null_ptr_arg, len_arg, bit_len, bytes_in_rec));
2969
flags|= UNSIGNED_FLAG;
2971
Ensure that Field::eq() can distinguish between two different bit fields.
2972
@@ -8926,6 +8960,7 @@
2975
null_bit= bit_ofs_arg;
2980
@@ -9210,6 +9245,9 @@
2982
int Field_bit::do_save_field_metadata(uchar *metadata_ptr)
2984
+ DBUG_ENTER("Field_bit::do_save_field_metadata");
2985
+ DBUG_PRINT("debug", ("bit_len: %d, bytes_in_rec: %d",
2986
+ bit_len, bytes_in_rec));
2988
Since this class and Field_bit_as_char have different ideas of
2989
what should be stored here, we compute the values of the metadata
2990
@@ -9217,7 +9255,7 @@
2992
metadata_ptr[0]= field_length % 8;
2993
metadata_ptr[1]= field_length / 8;
2999
@@ -9242,26 +9280,19 @@
3004
- Check to see if field size is compatible with destination.
3006
- This method is used in row-based replication to verify that the slave's
3007
- field size is less than or equal to the master's field size. The
3008
- encoded field metadata (from the master or source) is decoded and compared
3009
- to the size of this field (the slave or destination).
3011
- @param field_metadata Encoded size in field metadata
3013
- @retval 0 if this field's size is < the source field's size
3014
- @retval 1 if this field's size is >= the source field's size
3016
-int Field_bit::compatible_field_size(uint field_metadata,
3017
- const Relay_log_info * __attribute__((unused)),
3020
- uint from_bit_len= 8 * (field_metadata >> 8) + (field_metadata & 0xff);
3022
+Field_bit::compatible_field_size(uint field_metadata,
3023
+ Relay_log_info * __attribute__((unused)),
3027
+ DBUG_ENTER("Field_bit::compatible_field_size");
3028
+ DBUG_ASSERT((field_metadata >> 16) == 0);
3029
+ uint from_bit_len=
3030
+ 8 * (field_metadata >> 8) + (field_metadata & 0xff);
3031
uint to_bit_len= max_display_length();
3033
+ DBUG_PRINT("debug", ("from_bit_len: %u, to_bit_len: %u",
3034
+ from_bit_len, to_bit_len));
3036
If the bit length exact flag is clear, we are dealing with an old
3037
master, so we allow some less strict behaviour if replicating by
3038
@@ -9275,7 +9306,8 @@
3039
to_bit_len= (to_bit_len + 7) / 8;
3042
- return from_bit_len <= to_bit_len;
3043
+ *order_var= compare(from_bit_len, to_bit_len);
3044
+ DBUG_RETURN(TRUE);
3048
@@ -9341,8 +9373,15 @@
3049
Field_bit::unpack(uchar *to, const uchar *from, uint param_data,
3050
bool low_byte_first __attribute__((unused)))
3052
+ DBUG_ENTER("Field_bit::unpack");
3053
+ DBUG_PRINT("enter", ("to: %p, from: %p, param_data: 0x%x",
3054
+ to, from, param_data));
3055
+ DBUG_PRINT("debug", ("bit_ptr: %p, bit_len: %u, bit_ofs: %u",
3056
+ bit_ptr, bit_len, bit_ofs));
3057
uint const from_len= (param_data >> 8U) & 0x00ff;
3058
uint const from_bit_len= param_data & 0x00ff;
3059
+ DBUG_PRINT("debug", ("from_len: %u, from_bit_len: %u",
3060
+ from_len, from_bit_len));
3062
If the parameter data is zero (i.e., undefined), or if the master
3063
and slave have the same sizes, then use the old unpack() method.
3064
@@ -9363,7 +9402,7 @@
3067
memcpy(to, from, bytes_in_rec);
3068
- return from + bytes_in_rec;
3069
+ DBUG_RETURN(from + bytes_in_rec);
3073
@@ -9389,7 +9428,7 @@
3074
bitmap_set_bit(table->write_set,field_index);
3075
store(value, new_len, system_charset_info);
3077
- return from + len;
3078
+ DBUG_RETURN(from + len);
3082
@@ -9517,8 +9556,11 @@
3084
void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
3085
uint32 length_arg, uint32 decimals_arg,
3086
- bool maybe_null, bool is_unsigned)
3087
+ bool maybe_null, bool is_unsigned,
3090
+ DBUG_ENTER("Create_field::init_for_tmp_table");
3093
sql_type= sql_type_arg;
3094
char_length= length= length_arg;;
3095
@@ -9526,10 +9568,92 @@
3097
charset= &my_charset_bin;
3098
geom_type= Field::GEOM_GEOMETRY;
3099
- pack_flag= (FIELDFLAG_NUMBER |
3100
- ((decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT) |
3101
- (maybe_null ? FIELDFLAG_MAYBE_NULL : 0) |
3102
- (is_unsigned ? 0 : FIELDFLAG_DECIMAL));
3104
+ DBUG_PRINT("enter", ("sql_type: %d, length: %u, pack_length: %u",
3105
+ sql_type_arg, length_arg, pack_length));
3108
+ These pack flags are crafted to get it correctly through the
3109
+ branches of make_field().
3111
+ switch (sql_type_arg)
3113
+ case MYSQL_TYPE_VARCHAR:
3114
+ case MYSQL_TYPE_VAR_STRING:
3115
+ case MYSQL_TYPE_STRING:
3116
+ case MYSQL_TYPE_SET:
3120
+ case MYSQL_TYPE_GEOMETRY:
3121
+ pack_flag= FIELDFLAG_GEOM;
3124
+ case MYSQL_TYPE_ENUM:
3125
+ pack_flag= FIELDFLAG_INTERVAL;
3128
+ case MYSQL_TYPE_DECIMAL:
3129
+ case MYSQL_TYPE_NEWDECIMAL:
3130
+ case MYSQL_TYPE_FLOAT:
3131
+ case MYSQL_TYPE_DOUBLE:
3132
+ pack_flag= FIELDFLAG_DECIMAL | FIELDFLAG_NUMBER |
3133
+ (decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT;
3136
+ case MYSQL_TYPE_TINY_BLOB:
3137
+ case MYSQL_TYPE_MEDIUM_BLOB:
3138
+ case MYSQL_TYPE_LONG_BLOB:
3139
+ case MYSQL_TYPE_BLOB:
3140
+ pack_flag= FIELDFLAG_BLOB;
3143
+ case MYSQL_TYPE_BIT:
3144
+ pack_flag= FIELDFLAG_NUMBER | FIELDFLAG_TREAT_BIT_AS_CHAR;
3148
+ pack_flag= FIELDFLAG_NUMBER;
3153
+ Set the pack flag correctly for the blob-like types. This sets the
3154
+ packtype to something that make_field can use. If the pack type is
3155
+ not set correctly, the packlength will be reeeeally wierd (like
3158
+ switch (sql_type_arg)
3160
+ case MYSQL_TYPE_ENUM:
3161
+ case MYSQL_TYPE_SET:
3162
+ case MYSQL_TYPE_TINY_BLOB:
3163
+ case MYSQL_TYPE_MEDIUM_BLOB:
3164
+ case MYSQL_TYPE_LONG_BLOB:
3165
+ case MYSQL_TYPE_BLOB:
3166
+ case MYSQL_TYPE_GEOMETRY:
3167
+ // If you are going to use the above types, you have to pass a
3168
+ // pack_length as parameter. Assert that is really done.
3169
+ DBUG_ASSERT(pack_length != ~0U);
3170
+ pack_flag|= pack_length_to_packflag(pack_length);
3178
+ (maybe_null ? FIELDFLAG_MAYBE_NULL : 0) |
3179
+ (is_unsigned ? 0 : FIELDFLAG_DECIMAL);
3181
+ DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s, pack_type: %d",
3182
+ FLAGSTR(pack_flag, FIELDFLAG_BINARY),
3183
+ FLAGSTR(pack_flag, FIELDFLAG_NUMBER),
3184
+ FLAGSTR(pack_flag, FIELDFLAG_INTERVAL),
3185
+ FLAGSTR(pack_flag, FIELDFLAG_GEOM),
3186
+ FLAGSTR(pack_flag, FIELDFLAG_BLOB),
3187
+ f_packtype(pack_flag)));
3192
@@ -10036,6 +10160,14 @@
3196
+ DBUG_PRINT("debug", ("field_type: %d, field_length: %u, interval: %p, pack_flag: %s%s%s%s%s",
3197
+ field_type, field_length, interval,
3198
+ FLAGSTR(pack_flag, FIELDFLAG_BINARY),
3199
+ FLAGSTR(pack_flag, FIELDFLAG_INTERVAL),
3200
+ FLAGSTR(pack_flag, FIELDFLAG_NUMBER),
3201
+ FLAGSTR(pack_flag, FIELDFLAG_PACK),
3202
+ FLAGSTR(pack_flag, FIELDFLAG_BLOB)));
3204
if (f_is_alpha(pack_flag))
3206
if (!f_is_packed(pack_flag))
3207
diff -Nur a/sql/field.h b/sql/field.h
3208
--- a/sql/field.h 2010-08-04 19:22:43.438463876 +0400
3209
+++ b/sql/field.h 2010-08-04 19:23:00.768460103 +0400
3210
@@ -168,22 +168,13 @@
3211
table, which is located on disk).
3213
virtual uint32 pack_length_in_rec() const { return pack_length(); }
3214
- virtual int compatible_field_size(uint field_metadata,
3215
- const Relay_log_info *, uint16 mflags);
3216
- virtual uint pack_length_from_metadata(uint field_metadata)
3217
- { return field_metadata; }
3219
- This method is used to return the size of the data in a row-based
3220
- replication row record. The default implementation of returning 0 is
3221
- designed to allow fields that do not use metadata to return TRUE (1)
3222
- from compatible_field_size() which uses this function in the comparison.
3223
- The default value for field metadata for fields that do not have
3224
- metadata is 0. Thus, 0 == 0 means the fields are compatible in size.
3226
- Note: While most classes that override this method return pack_length(),
3227
- the classes Field_string, Field_varstring, and Field_blob return
3228
- field_length + 1, field_length, and pack_length_no_ptr() respectfully.
3230
+ virtual bool compatible_field_size(uint metadata, Relay_log_info *rli,
3231
+ uint16 mflags, int *order);
3232
+ virtual uint pack_length_from_metadata(uint field_metadata)
3234
+ DBUG_ENTER("Field::pack_length_from_metadata");
3235
+ DBUG_RETURN(field_metadata);
3237
virtual uint row_pack_length() { return 0; }
3238
virtual int save_field_metadata(uchar *first_byte)
3239
{ return do_save_field_metadata(first_byte); }
3240
@@ -643,6 +634,13 @@
3241
uint size_of() const { return sizeof(*this); }
3242
bool eq_def(Field *field);
3243
int store_decimal(const my_decimal *);
3244
+ uint row_pack_length() { return pack_length(); }
3245
+ uint32 pack_length_from_metadata(uint field_metadata) {
3246
+ uint32 length= pack_length();
3247
+ DBUG_PRINT("result", ("pack_length_from_metadata(%d): %u",
3248
+ field_metadata, length));
3251
my_decimal *val_decimal(my_decimal *);
3252
uint is_equal(Create_field *new_field);
3253
int check_int(CHARSET_INFO *cs, const char *str, int length,
3255
uint32 pack_length() const { return (uint32) bin_size; }
3256
uint pack_length_from_metadata(uint field_metadata);
3257
uint row_pack_length() { return pack_length(); }
3258
- int compatible_field_size(uint field_metadata,
3259
- const Relay_log_info *rli, uint16 mflags);
3260
+ bool compatible_field_size(uint field_metadata, Relay_log_info *rli,
3261
+ uint16 mflags, int *order_var);
3262
uint is_equal(Create_field *new_field);
3263
virtual const uchar *unpack(uchar* to, const uchar *from,
3264
uint param_data, bool low_byte_first);
3265
@@ -1505,9 +1503,9 @@
3266
return row_pack_length();
3267
return (((field_metadata >> 4) & 0x300) ^ 0x300) + (field_metadata & 0x00ff);
3269
- int compatible_field_size(uint field_metadata,
3270
- const Relay_log_info *rli, uint16 mflags);
3271
- uint row_pack_length() { return (field_length + 1); }
3272
+ bool compatible_field_size(uint field_metadata, Relay_log_info *rli,
3273
+ uint16 mflags, int *order_var);
3274
+ uint row_pack_length() { return field_length; }
3275
int pack_cmp(const uchar *a,const uchar *b,uint key_length,
3276
my_bool insert_or_update);
3277
int pack_cmp(const uchar *b,uint key_length,my_bool insert_or_update);
3278
@@ -1974,8 +1972,8 @@
3279
uint pack_length_from_metadata(uint field_metadata);
3280
uint row_pack_length()
3281
{ return (bytes_in_rec + ((bit_len > 0) ? 1 : 0)); }
3282
- int compatible_field_size(uint field_metadata,
3283
- const Relay_log_info *rli, uint16 mflags);
3284
+ bool compatible_field_size(uint metadata, Relay_log_info *rli,
3285
+ uint16 mflags, int *order_var);
3286
void sql_type(String &str) const;
3287
virtual uchar *pack(uchar *to, const uchar *from,
3288
uint max_length, bool low_byte_first);
3289
@@ -2078,7 +2076,8 @@
3290
/* Init for a tmp table field. To be extended if need be. */
3291
void init_for_tmp_table(enum_field_types sql_type_arg,
3292
uint32 max_length, uint32 decimals,
3293
- bool maybe_null, bool is_unsigned);
3294
+ bool maybe_null, bool is_unsigned,
3295
+ uint pack_length = ~0U);
3297
bool init(THD *thd, char *field_name, enum_field_types type, char *length,
3298
char *decimals, uint type_modifier, Item *default_value,
3299
diff -Nur a/sql/log_event.cc b/sql/log_event.cc
3300
--- a/sql/log_event.cc 2010-08-04 19:22:43.438463876 +0400
3301
+++ b/sql/log_event.cc 2010-08-04 19:23:00.768460103 +0400
3303
#include "rpl_rli.h"
3305
#include "rpl_filter.h"
3306
-#include "rpl_utility.h"
3307
#include "rpl_record.h"
3313
#include <my_bitmap.h>
3314
+#include "rpl_utility.h"
3316
#define log_cs &my_charset_latin1
3318
@@ -1570,37 +1570,14 @@
3319
/* a long CHAR() field: see #37426 */
3320
length= byte1 | (((byte0 & 0x30) ^ 0x30) << 4);
3327
- case MYSQL_TYPE_SET:
3328
- case MYSQL_TYPE_ENUM:
3329
- case MYSQL_TYPE_STRING:
3338
- my_snprintf(tmp, sizeof(tmp), "%04X", meta);
3340
- "!! Don't know how to handle column type=%d meta=%d (%s)",
3346
+ length = meta & 0xFF;
3356
case MYSQL_TYPE_LONG:
3358
@@ -1737,6 +1714,33 @@
3362
+ case MYSQL_TYPE_NEWDATE:
3364
+ uint32 tmp= uint3korr(ptr);
3367
+ char *pos= &buf[10];
3369
+ /* Copied from field.cc */
3370
+ *pos--=0; // End NULL
3371
+ part=(int) (tmp & 31);
3372
+ *pos--= (char) ('0'+part%10);
3373
+ *pos--= (char) ('0'+part/10);
3375
+ part=(int) (tmp >> 5 & 15);
3376
+ *pos--= (char) ('0'+part%10);
3377
+ *pos--= (char) ('0'+part/10);
3379
+ part=(int) (tmp >> 9);
3380
+ *pos--= (char) ('0'+part%10); part/=10;
3381
+ *pos--= (char) ('0'+part%10); part/=10;
3382
+ *pos--= (char) ('0'+part%10); part/=10;
3383
+ *pos= (char) ('0'+part);
3384
+ my_b_printf(file , "'%s'", buf);
3385
+ my_snprintf(typestr, typestr_length, "DATE");
3389
case MYSQL_TYPE_DATE:
3391
uint i32= uint3korr(ptr);
3392
@@ -1755,7 +1759,7 @@
3395
case MYSQL_TYPE_ENUM:
3397
+ switch (meta & 0xFF) {
3399
my_b_printf(file, "%d", (int) *ptr);
3400
my_snprintf(typestr, typestr_length, "ENUM(1 byte)");
3401
@@ -1768,15 +1772,15 @@
3405
- my_b_printf(file, "!! Unknown ENUM packlen=%d", length);
3406
+ my_b_printf(file, "!! Unknown ENUM packlen=%d", meta & 0xFF);
3411
case MYSQL_TYPE_SET:
3412
- my_b_write_bit(file, ptr , length * 8);
3413
- my_snprintf(typestr, typestr_length, "SET(%d bytes)", length);
3415
+ my_b_write_bit(file, ptr , (meta & 0xFF) * 8);
3416
+ my_snprintf(typestr, typestr_length, "SET(%d bytes)", meta & 0xFF);
3417
+ return meta & 0xFF;
3419
case MYSQL_TYPE_BLOB:
3421
@@ -7386,11 +7390,18 @@
3425
+ DBUG_PRINT("debug", ("Checking compability of tables to lock - tables_to_lock: %p",
3426
+ rli->tables_to_lock));
3427
RPL_TABLE_LIST *ptr= rli->tables_to_lock;
3428
for ( ; ptr ; ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global))
3430
- if (ptr->m_tabledef.compatible_with(rli, ptr->table))
3431
+ TABLE *conv_table;
3432
+ if (!ptr->m_tabledef.compatible_with(thd, const_cast<Relay_log_info*>(rli),
3433
+ ptr->table, &conv_table))
3435
+ DBUG_PRINT("debug", ("Table: %s.%s is not compatible with master",
3436
+ ptr->table->s->db.str,
3437
+ ptr->table->s->table_name.str));
3439
We should not honour --slave-skip-errors at this point as we are
3440
having severe errors which should not be skiped.
3441
@@ -7401,12 +7412,17 @@
3442
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
3443
DBUG_RETURN(ERR_BAD_TABLE_DEF);
3445
+ DBUG_PRINT("debug", ("Table: %s.%s is compatible with master"
3446
+ " - conv_table: %p",
3447
+ ptr->table->s->db.str,
3448
+ ptr->table->s->table_name.str, conv_table));
3449
+ ptr->m_conv_table= conv_table;
3454
- ... and then we add all the tables to the table map and remove
3455
- them from tables to lock.
3456
+ ... and then we add all the tables to the table map and but keep
3457
+ them in the tables to lock list.
3459
We also invalidate the query cache for all the tables, since
3460
they will now be changed.
3461
@@ -7896,7 +7912,10 @@
3462
DBUG_ENTER("Table_map_log_event::save_field_metadata");
3464
for (unsigned int i= 0 ; i < m_table->s->fields ; i++)
3466
+ DBUG_PRINT("debug", ("field_type: %d", m_coltype[i]));
3467
index+= m_table->s->field[i]->save_field_metadata(&m_field_metadata[index]);
3471
#endif /* !defined(MYSQL_CLIENT) */
3472
diff -Nur a/sql/log_event_old.cc b/sql/log_event_old.cc
3473
--- a/sql/log_event_old.cc 2010-08-04 19:22:43.428461764 +0400
3474
+++ b/sql/log_event_old.cc 2010-08-04 19:23:00.778482050 +0400
3475
@@ -107,14 +107,24 @@
3476
RPL_TABLE_LIST *ptr= rli->tables_to_lock;
3477
for ( ; ptr ; ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global))
3479
- if (ptr->m_tabledef.compatible_with(rli, ptr->table))
3480
+ TABLE *conv_table;
3481
+ if (!ptr->m_tabledef.compatible_with(thd, const_cast<Relay_log_info*>(rli),
3482
+ ptr->table, &conv_table))
3484
+ DBUG_PRINT("debug", ("Table: %s.%s is not compatible with master",
3485
+ ptr->table->s->db.str,
3486
+ ptr->table->s->table_name.str));
3487
mysql_unlock_tables(ev_thd, ev_thd->lock);
3489
ev_thd->is_slave_error= 1;
3490
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
3491
DBUG_RETURN(Old_rows_log_event::ERR_BAD_TABLE_DEF);
3493
+ DBUG_PRINT("debug", ("Table: %s.%s is compatible with master"
3494
+ " - conv_table: %p",
3495
+ ptr->table->s->db.str,
3496
+ ptr->table->s->table_name.str, conv_table));
3497
+ ptr->m_conv_table= conv_table;
3501
@@ -1601,7 +1611,9 @@
3502
RPL_TABLE_LIST *ptr= rli->tables_to_lock;
3503
for ( ; ptr ; ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global))
3505
- if (ptr->m_tabledef.compatible_with(rli, ptr->table))
3506
+ TABLE *conv_table;
3507
+ if (ptr->m_tabledef.compatible_with(thd, const_cast<Relay_log_info*>(rli),
3508
+ ptr->table, &conv_table))
3510
mysql_unlock_tables(thd, thd->lock);
3512
@@ -1609,12 +1621,14 @@
3513
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
3514
DBUG_RETURN(ERR_BAD_TABLE_DEF);
3516
+ ptr->m_conv_table= conv_table;
3521
- ... and then we add all the tables to the table map and remove
3522
- them from tables to lock.
3523
+ ... and then we add all the tables to the table map but keep
3524
+ them in the tables to lock list.
3527
We also invalidate the query cache for all the tables, since
3528
they will now be changed.
3529
diff -Nur a/sql/mysqld.cc b/sql/mysqld.cc
3530
--- a/sql/mysqld.cc 2010-08-04 19:22:43.428461764 +0400
3531
+++ b/sql/mysqld.cc 2010-08-04 19:23:00.778482050 +0400
3533
ulong slave_net_timeout, slave_trans_retries;
3534
ulong slave_exec_mode_options;
3535
const char *slave_exec_mode_str= "STRICT";
3536
+ulong slave_type_conversions_options;
3537
+const char *slave_type_conversions_default= "";
3538
ulong thread_cache_size=0, thread_pool_size= 0;
3539
ulong binlog_cache_size=0;
3540
ulonglong max_binlog_cache_size=0;
3541
@@ -5992,6 +5994,7 @@
3542
#endif /* defined(ENABLED_DEBUG_SYNC) */
3544
OPT_SLAVE_EXEC_MODE,
3545
+ OPT_SLAVE_TYPE_CONVERSIONS,
3546
OPT_GENERAL_LOG_FILE,
3547
OPT_SLOW_QUERY_LOG_FILE,
3548
OPT_USERSTAT_RUNNING,
3549
@@ -6805,6 +6808,15 @@
3550
"not stop for operations that are idempotent. In STRICT mode, replication "
3551
"will stop on any unexpected difference between the master and the slave.",
3552
&slave_exec_mode_str, &slave_exec_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3553
+ {"slave-type-conversions", OPT_SLAVE_TYPE_CONVERSIONS,
3554
+ "Set of slave type conversions that are enabled. Legal values are:"
3555
+ " ALL_LOSSY to enable lossy conversions and"
3556
+ " ALL_NON_LOSSY to enable non-lossy conversions."
3557
+ " If the variable is assigned the empty set, no conversions are"
3558
+ " allowed and it is expected that the types match exactly.",
3559
+ (uchar**) &slave_type_conversions_default,
3560
+ (uchar**) &slave_type_conversions_default,
3561
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3563
{"slow-query-log", OPT_SLOW_LOG,
3564
"Enable/disable slow query log.", &opt_slow_log,
3565
@@ -8188,6 +8200,11 @@
3566
slave_exec_mode_options= (uint)
3567
find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL,
3569
+ /* Slave type conversions */
3570
+ slave_type_conversions_options= 0;
3571
+ slave_type_conversions_options=
3572
+ find_bit_type_or_exit(slave_type_conversions_default, &slave_type_conversions_typelib,
3576
opt_specialflag= SPECIAL_ENGLISH;
3577
@@ -8432,6 +8449,12 @@
3581
+ case OPT_SLAVE_TYPE_CONVERSIONS:
3582
+ slave_type_conversions_options= (uint)
3583
+ find_bit_type_or_exit(argument, &slave_type_conversions_typelib, "", &error);
3588
case OPT_SAFEMALLOC_MEM_LIMIT:
3589
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
3590
diff -Nur a/sql/mysql_priv.h b/sql/mysql_priv.h
3591
--- a/sql/mysql_priv.h 2010-08-04 19:22:43.438463876 +0400
3592
+++ b/sql/mysql_priv.h 2010-08-04 19:23:00.778482050 +0400
3593
@@ -2079,6 +2079,7 @@
3594
extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
3595
extern my_bool opt_slave_compressed_protocol, use_temp_pool;
3596
extern ulong slave_exec_mode_options;
3597
+extern ulong slave_type_conversions_options;
3598
extern my_bool opt_readonly, lower_case_file_system;
3599
extern my_bool opt_userstat_running, opt_thread_statistics;
3600
extern my_bool opt_optimizer_fix;
3601
diff -Nur a/sql/rpl_record.cc b/sql/rpl_record.cc
3602
--- a/sql/rpl_record.cc 2010-08-04 19:22:43.418464122 +0400
3603
+++ b/sql/rpl_record.cc 2010-08-04 19:23:00.778482050 +0400
3604
@@ -104,10 +104,10 @@
3606
pack_ptr= field->pack(pack_ptr, field->ptr + offset,
3607
field->max_data_length(), TRUE);
3608
- DBUG_PRINT("debug", ("field: %s; pack_ptr: 0x%lx;"
3609
+ DBUG_PRINT("debug", ("field: %s; real_type: %d, pack_ptr: 0x%lx;"
3610
" pack_ptr':0x%lx; bytes: %d",
3611
- field->field_name, (ulong) old_pack_ptr,
3613
+ field->field_name, field->real_type(),
3614
+ (ulong) old_pack_ptr, (ulong) pack_ptr,
3615
(int) (pack_ptr - old_pack_ptr)));
3618
@@ -150,13 +150,20 @@
3619
the various member functions of Field and subclasses expect to
3622
- The row is assumed to only consist of the fields for which the corresponding
3623
- bit in bitset @c cols is set; the other parts of the record are left alone.
3624
+ The row is assumed to only consist of the fields for which the
3625
+ corresponding bit in bitset @c cols is set; the other parts of the
3626
+ record are left alone.
3628
At most @c colcnt columns are read: if the table is larger than
3629
that, the remaining fields are not filled in.
3631
- @param rli Relay log info
3632
+ @note The relay log information can be NULL, which means that no
3633
+ checking or comparison with the source table is done, simply
3634
+ because it is not used. This feature is used by MySQL Backup to
3635
+ unpack a row from from the backup image, but can be used for other
3638
+ @param rli Relay log info, which can be NULL
3639
@param table Table to unpack into
3640
@param colcnt Number of columns to read from record
3642
@@ -170,11 +177,9 @@
3646
- @retval ER_NO_DEFAULT_FOR_FIELD
3647
- Returned if one of the fields existing on the slave but not on the
3648
- master does not have a default value (and isn't nullable)
3651
+ @retval HA_ERR_GENERIC
3652
+ A generic, internal, error caused the unpacking to fail.
3654
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
3656
unpack_row(Relay_log_info const *rli,
3659
DBUG_ENTER("unpack_row");
3660
DBUG_ASSERT(row_data);
3661
+ DBUG_ASSERT(table);
3662
size_t const master_null_byte_count= (bitmap_bits_set(cols) + 7) / 8;
3665
@@ -202,10 +208,37 @@
3666
// The "current" null bits
3667
unsigned int null_bits= *null_ptr++;
3669
- table_def *tabledef= ((Relay_log_info*)rli)->get_tabledef(table);
3670
+ table_def *tabledef= NULL;
3671
+ TABLE *conv_table= NULL;
3672
+ bool table_found= rli && rli->get_table_data(table, &tabledef, &conv_table);
3673
+ DBUG_PRINT("debug", ("Table data: table_found: %d, tabldef: %p, conv_table: %p",
3674
+ table_found, tabledef, conv_table));
3675
+ DBUG_ASSERT(table_found);
3678
+ If rli is NULL it means that there is no source table and that the
3679
+ row shall just be unpacked without doing any checks. This feature
3680
+ is used by MySQL Backup, but can be used for other purposes as
3683
+ if (rli && !table_found)
3684
+ DBUG_RETURN(HA_ERR_GENERIC);
3686
for (field_ptr= begin_ptr ; field_ptr < end_ptr && *field_ptr ; ++field_ptr)
3688
- Field *const f= *field_ptr;
3690
+ If there is a conversion table, we pick up the field pointer to
3691
+ the conversion table. If the conversion table or the field
3692
+ pointer is NULL, no conversions are necessary.
3694
+ Field *conv_field=
3695
+ conv_table ? conv_table->field[field_ptr - begin_ptr] : NULL;
3697
+ conv_field ? conv_field : *field_ptr;
3698
+ DBUG_PRINT("debug", ("Conversion %srequired for field '%s' (#%ld)",
3699
+ conv_field ? "" : "not ",
3700
+ (*field_ptr)->field_name, field_ptr - begin_ptr));
3701
+ DBUG_ASSERT(f != NULL);
3704
No need to bother about columns that does not exist: they have
3705
@@ -291,6 +324,39 @@
3706
(int) (pack_ptr - old_pack_ptr)));
3710
+ If conv_field is set, then we are doing a conversion. In this
3711
+ case, we have unpacked the master data to the conversion
3712
+ table, so we need to copy the value stored in the conversion
3713
+ table into the final table and do the conversion at the same time.
3719
+ char source_buf[MAX_FIELD_WIDTH];
3720
+ char value_buf[MAX_FIELD_WIDTH];
3721
+ String source_type(source_buf, sizeof(source_buf), system_charset_info);
3722
+ String value_string(value_buf, sizeof(value_buf), system_charset_info);
3723
+ conv_field->sql_type(source_type);
3724
+ conv_field->val_str(&value_string);
3725
+ DBUG_PRINT("debug", ("Copying field '%s' of type '%s' with value '%s'",
3726
+ (*field_ptr)->field_name,
3727
+ source_type.c_ptr_safe(), value_string.c_ptr_safe()));
3729
+ copy.set(*field_ptr, f, TRUE);
3730
+ (*copy.do_copy)(©);
3732
+ char target_buf[MAX_FIELD_WIDTH];
3733
+ String target_type(target_buf, sizeof(target_buf), system_charset_info);
3734
+ (*field_ptr)->sql_type(target_type);
3735
+ (*field_ptr)->val_str(&value_string);
3736
+ DBUG_PRINT("debug", ("Value of field '%s' of type '%s' is now '%s'",
3737
+ (*field_ptr)->field_name,
3738
+ target_type.c_ptr_safe(), value_string.c_ptr_safe()));
3745
diff -Nur a/sql/rpl_rli.h b/sql/rpl_rli.h
3746
--- a/sql/rpl_rli.h 2010-08-04 19:22:43.418464122 +0400
3747
+++ b/sql/rpl_rli.h 2010-08-04 19:23:00.778482050 +0400
3748
@@ -314,13 +314,21 @@
3749
uint tables_to_lock_count; /* RBR: Count of tables to lock */
3750
table_mapping m_table_map; /* RBR: Mapping table-id to table */
3752
- inline table_def *get_tabledef(TABLE *tbl)
3753
+ bool get_table_data(TABLE *table_arg, table_def **tabledef_var, TABLE **conv_table_var) const
3756
- for (TABLE_LIST *ptr= tables_to_lock; ptr && !td; ptr= ptr->next_global)
3757
- if (ptr->table == tbl)
3758
- td= &((RPL_TABLE_LIST *)ptr)->m_tabledef;
3760
+ DBUG_ASSERT(tabledef_var && conv_table_var);
3761
+ for (TABLE_LIST *ptr= tables_to_lock ; ptr != NULL ; ptr= ptr->next_global)
3762
+ if (ptr->table == table_arg)
3764
+ *tabledef_var= &static_cast<RPL_TABLE_LIST*>(ptr)->m_tabledef;
3765
+ *conv_table_var= static_cast<RPL_TABLE_LIST*>(ptr)->m_conv_table;
3766
+ DBUG_PRINT("debug", ("Fetching table data for table %s.%s:"
3767
+ " tabledef: %p, conv_table: %p",
3768
+ table_arg->s->db.str, table_arg->s->table_name.str,
3769
+ *tabledef_var, *conv_table_var));
3776
diff -Nur a/sql/rpl_utility.cc b/sql/rpl_utility.cc
3777
--- a/sql/rpl_utility.cc 2010-08-04 19:22:43.438463876 +0400
3778
+++ b/sql/rpl_utility.cc 2010-08-04 19:23:00.788458460 +0400
3780
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
3782
#include "rpl_utility.h"
3784
+#ifndef MYSQL_CLIENT
3785
#include "rpl_rli.h"
3788
+ Function to compare two size_t integers for their relative
3789
+ order. Used below.
3791
+int compare(size_t a, size_t b)
3802
+ Max value for an unsigned integer of 'bits' bits.
3804
+ The somewhat contorted expression is to avoid overflow.
3806
+uint32 uint_max(int bits) {
3807
+ return (((1UL << (bits - 1)) - 1) << 1) | 1;
3812
+ Compute the maximum display length of a field.
3814
+ @param sql_type Type of the field
3815
+ @param metadata The metadata from the master for the field.
3816
+ @return Maximum length of the field in bytes.
3819
+max_display_length_for_field(enum_field_types sql_type, unsigned int metadata)
3821
+ DBUG_PRINT("debug", ("sql_type: %d, metadata: 0x%x", sql_type, metadata));
3822
+ DBUG_ASSERT(metadata >> 16 == 0);
3824
+ switch (sql_type) {
3825
+ case MYSQL_TYPE_NEWDECIMAL:
3826
+ return metadata >> 8;
3828
+ case MYSQL_TYPE_FLOAT:
3831
+ case MYSQL_TYPE_DOUBLE:
3834
+ case MYSQL_TYPE_SET:
3835
+ case MYSQL_TYPE_ENUM:
3836
+ return metadata & 0x00ff;
3838
+ case MYSQL_TYPE_STRING:
3840
+ uchar type= metadata >> 8;
3841
+ if (type == MYSQL_TYPE_SET || type == MYSQL_TYPE_ENUM)
3842
+ return metadata & 0xff;
3844
+ /* This is taken from Field_string::unpack. */
3845
+ return (((metadata >> 4) & 0x300) ^ 0x300) + (metadata & 0x00ff);
3848
+ case MYSQL_TYPE_YEAR:
3849
+ case MYSQL_TYPE_TINY:
3852
+ case MYSQL_TYPE_SHORT:
3855
+ case MYSQL_TYPE_INT24:
3858
+ case MYSQL_TYPE_LONG:
3861
+#ifdef HAVE_LONG_LONG
3862
+ case MYSQL_TYPE_LONGLONG:
3866
+ case MYSQL_TYPE_NULL:
3869
+ case MYSQL_TYPE_NEWDATE:
3872
+ case MYSQL_TYPE_DATE:
3873
+ case MYSQL_TYPE_TIME:
3876
+ case MYSQL_TYPE_TIMESTAMP:
3879
+ case MYSQL_TYPE_DATETIME:
3882
+ case MYSQL_TYPE_BIT:
3884
+ Decode the size of the bit field from the master.
3886
+ DBUG_ASSERT((metadata & 0xff) <= 7);
3887
+ return 8 * (metadata >> 8U) + (metadata & 0x00ff);
3889
+ case MYSQL_TYPE_VAR_STRING:
3890
+ case MYSQL_TYPE_VARCHAR:
3894
+ The actual length for these types does not really matter since
3895
+ they are used to calc_pack_length, which ignores the given
3896
+ length for these types.
3898
+ Since we want this to be accurate for other uses, we return the
3899
+ maximum size in bytes of these BLOBs.
3902
+ case MYSQL_TYPE_TINY_BLOB:
3903
+ return uint_max(1 * 8);
3905
+ case MYSQL_TYPE_MEDIUM_BLOB:
3906
+ return uint_max(3 * 8);
3908
+ case MYSQL_TYPE_BLOB:
3910
+ For the blob type, Field::real_type() lies and say that all
3911
+ blobs are of type MYSQL_TYPE_BLOB. In that case, we have to look
3912
+ at the length instead to decide what the max display size is.
3914
+ return uint_max(metadata * 8);
3916
+ case MYSQL_TYPE_LONG_BLOB:
3917
+ case MYSQL_TYPE_GEOMETRY:
3918
+ return uint_max(4 * 8);
3921
+ return ~(uint32) 0;
3927
+ Compare the pack lengths of a source field (on the master) and a
3928
+ target field (on the slave).
3930
+ @param field Target field.
3931
+ @param type Source field type.
3932
+ @param metadata Source field metadata.
3934
+ @retval -1 The length of the source field is smaller than the target field.
3935
+ @retval 0 The length of the source and target fields are the same.
3936
+ @retval 1 The length of the source field is greater than the target field.
3938
+int compare_lengths(Field *field, enum_field_types source_type, uint16 metadata)
3940
+ DBUG_ENTER("compare_lengths");
3941
+ size_t const source_length=
3942
+ max_display_length_for_field(source_type, metadata);
3943
+ size_t const target_length= field->max_display_length();
3944
+ DBUG_PRINT("debug", ("source_length: %lu, source_type: %u,"
3945
+ " target_length: %lu, target_type: %u",
3946
+ (unsigned long) source_length, source_type,
3947
+ (unsigned long) target_length, field->real_type()));
3948
+ int result= compare(source_length, target_length);
3949
+ DBUG_PRINT("result", ("%d", result));
3950
+ DBUG_RETURN(result);
3953
/*********************************************************************
3954
* table_def member definitions *
3955
*********************************************************************/
3956
@@ -169,58 +337,718 @@
3963
+void show_sql_type(enum_field_types type, uint16 metadata, String *str)
3965
+ DBUG_ENTER("show_sql_type");
3966
+ DBUG_PRINT("enter", ("type: %d, metadata: 0x%x", type, metadata));
3970
+ case MYSQL_TYPE_TINY:
3971
+ str->set_ascii(STRING_WITH_LEN("tinyint"));
3974
+ case MYSQL_TYPE_SHORT:
3975
+ str->set_ascii(STRING_WITH_LEN("smallint"));
3978
+ case MYSQL_TYPE_LONG:
3979
+ str->set_ascii(STRING_WITH_LEN("int"));
3982
+ case MYSQL_TYPE_FLOAT:
3983
+ str->set_ascii(STRING_WITH_LEN("float"));
3986
+ case MYSQL_TYPE_DOUBLE:
3987
+ str->set_ascii(STRING_WITH_LEN("double"));
3990
+ case MYSQL_TYPE_NULL:
3991
+ str->set_ascii(STRING_WITH_LEN("null"));
3994
+ case MYSQL_TYPE_TIMESTAMP:
3995
+ str->set_ascii(STRING_WITH_LEN("timestamp"));
3998
+ case MYSQL_TYPE_LONGLONG:
3999
+ str->set_ascii(STRING_WITH_LEN("bigint"));
4002
+ case MYSQL_TYPE_INT24:
4003
+ str->set_ascii(STRING_WITH_LEN("mediumint"));
4006
+ case MYSQL_TYPE_NEWDATE:
4007
+ case MYSQL_TYPE_DATE:
4008
+ str->set_ascii(STRING_WITH_LEN("date"));
4011
+ case MYSQL_TYPE_TIME:
4012
+ str->set_ascii(STRING_WITH_LEN("time"));
4015
+ case MYSQL_TYPE_DATETIME:
4016
+ str->set_ascii(STRING_WITH_LEN("datetime"));
4019
+ case MYSQL_TYPE_YEAR:
4020
+ str->set_ascii(STRING_WITH_LEN("year"));
4023
+ case MYSQL_TYPE_VAR_STRING:
4024
+ case MYSQL_TYPE_VARCHAR:
4026
+ CHARSET_INFO *cs= str->charset();
4028
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
4029
+ "varchar(%u)", metadata);
4030
+ str->length(length);
4034
+ case MYSQL_TYPE_BIT:
4036
+ CHARSET_INFO *cs= str->charset();
4037
+ int bit_length= 8 * (metadata >> 8) + (metadata & 0xFF);
4039
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
4040
+ "bit(%d)", bit_length);
4041
+ str->length(length);
4045
+ case MYSQL_TYPE_DECIMAL:
4047
+ CHARSET_INFO *cs= str->charset();
4049
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
4050
+ "decimal(%d,?)", metadata);
4051
+ str->length(length);
4055
+ case MYSQL_TYPE_NEWDECIMAL:
4057
+ CHARSET_INFO *cs= str->charset();
4059
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
4060
+ "decimal(%d,%d)", metadata >> 8, metadata & 0xff);
4061
+ str->length(length);
4065
+ case MYSQL_TYPE_ENUM:
4066
+ str->set_ascii(STRING_WITH_LEN("enum"));
4069
+ case MYSQL_TYPE_SET:
4070
+ str->set_ascii(STRING_WITH_LEN("set"));
4073
+ case MYSQL_TYPE_BLOB:
4075
+ Field::real_type() lies regarding the actual type of a BLOB, so
4076
+ it is necessary to check the pack length to figure out what kind
4077
+ of blob it really is.
4079
+ switch (get_blob_type_from_length(metadata))
4081
+ case MYSQL_TYPE_TINY_BLOB:
4082
+ str->set_ascii(STRING_WITH_LEN("tinyblob"));
4085
+ case MYSQL_TYPE_MEDIUM_BLOB:
4086
+ str->set_ascii(STRING_WITH_LEN("mediumblob"));
4089
+ case MYSQL_TYPE_LONG_BLOB:
4090
+ str->set_ascii(STRING_WITH_LEN("longblob"));
4093
+ case MYSQL_TYPE_BLOB:
4094
+ str->set_ascii(STRING_WITH_LEN("blob"));
4103
+ case MYSQL_TYPE_STRING:
4106
+ This is taken from Field_string::unpack.
4108
+ CHARSET_INFO *cs= str->charset();
4109
+ uint bytes= (((metadata >> 4) & 0x300) ^ 0x300) + (metadata & 0x00ff);
4111
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
4112
+ "char(%d)", bytes / cs->mbmaxlen);
4113
+ str->length(length);
4117
+ case MYSQL_TYPE_GEOMETRY:
4118
+ str->set_ascii(STRING_WITH_LEN("geometry"));
4122
+ str->set_ascii(STRING_WITH_LEN("<unknown type>"));
4129
+ Check the order variable and print errors if the order is not
4130
+ acceptable according to the current settings.
4132
+ @param order The computed order of the conversion needed.
4133
+ @param rli The relay log info data structure: for error reporting.
4135
+bool is_conversion_ok(int order, Relay_log_info *rli)
4137
+ DBUG_ENTER("is_conversion_ok");
4138
+ bool allow_non_lossy=
4139
+ bit_is_set(slave_type_conversions_options, SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY);
4141
+ bit_is_set(slave_type_conversions_options, SLAVE_TYPE_CONVERSIONS_ALL_LOSSY);
4143
+ DBUG_PRINT("enter", ("order: %d, flags:%s%s", order,
4144
+ allow_non_lossy ? " ALL_NON_LOSSY" : "",
4145
+ allow_lossy ? " ALL_LOSSY" : ""));
4146
+ if (order < 0 && !allow_non_lossy)
4148
+ /* !!! Add error message saying that non-lossy conversions need to be allowed. */
4149
+ DBUG_RETURN(false);
4152
+ if (order > 0 && !allow_lossy)
4154
+ /* !!! Add error message saying that lossy conversions need to be allowed. */
4155
+ DBUG_RETURN(false);
4158
+ DBUG_RETURN(true);
4163
+ Can a type potentially be converted to another type?
4165
+ This function check if the types are convertible and what
4166
+ conversion is required.
4168
+ If conversion is not possible, and error is printed.
4170
+ If conversion is possible:
4172
+ - *order will be set to -1 if source type is smaller than target
4173
+ type and a non-lossy conversion can be required. This includes
4174
+ the case where the field types are different but types could
4175
+ actually be converted in either direction.
4177
+ - *order will be set to 0 if no conversion is required.
4179
+ - *order will be set to 1 if the source type is strictly larger
4180
+ than the target type and that conversion is potentially lossy.
4182
+ @param[in] field Target field
4183
+ @param[in] type Source field type
4184
+ @param[in] metadata Source field metadata
4185
+ @param[in] rli Relay log info (for error reporting)
4186
+ @param[in] mflags Flags from the table map event
4187
+ @param[out] order Order between source field and target field
4189
+ @return @c true if conversion is possible according to the current
4190
+ settings, @c false if conversion is not possible according to the
4194
+can_convert_field_to(Field *field,
4195
+ enum_field_types source_type, uint16 metadata,
4196
+ Relay_log_info *rli, uint16 mflags,
4199
+ DBUG_ENTER("can_convert_field_to");
4201
+ char field_type_buf[MAX_FIELD_WIDTH];
4202
+ String field_type(field_type_buf, sizeof(field_type_buf), field->charset());
4203
+ field->sql_type(field_type);
4204
+ DBUG_PRINT("enter", ("field_type: %s, target_type: %d, source_type: %d, source_metadata: 0x%x",
4205
+ field_type.c_ptr_safe(), field->real_type(), source_type, metadata));
4208
+ If the real type is the same, we need to check the metadata to
4209
+ decide if conversions are allowed.
4211
+ if (field->real_type() == source_type)
4213
+ if (metadata == 0) // Metadata can only be zero if no metadata was provided
4216
+ If there is no metadata, we either have an old event where no
4217
+ metadata were supplied, or a type that does not require any
4218
+ metadata. In either case, conversion can be done but no
4219
+ conversion table is necessary.
4221
+ DBUG_PRINT("debug", ("Base types are identical, but there is no metadata"));
4223
+ DBUG_RETURN(true);
4226
+ DBUG_PRINT("debug", ("Base types are identical, doing field size comparison"));
4227
+ if (field->compatible_field_size(metadata, rli, mflags, order_var))
4228
+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
4230
+ DBUG_RETURN(false);
4232
+ else if (!slave_type_conversions_options)
4233
+ DBUG_RETURN(false);
4236
+ Here, from and to will always be different. Since the types are
4237
+ different, we cannot use the compatible_field_size() function, but
4238
+ have to rely on hard-coded max-sizes for fields.
4241
+ DBUG_PRINT("debug", ("Base types are different, checking conversion"));
4242
+ switch (source_type) // Source type (on master)
4244
+ case MYSQL_TYPE_DECIMAL:
4245
+ case MYSQL_TYPE_NEWDECIMAL:
4246
+ case MYSQL_TYPE_FLOAT:
4247
+ case MYSQL_TYPE_DOUBLE:
4248
+ switch (field->real_type())
4250
+ case MYSQL_TYPE_NEWDECIMAL:
4252
+ Then the other type is either FLOAT, DOUBLE, or old style
4253
+ DECIMAL, so we require lossy conversion.
4256
+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
4258
+ case MYSQL_TYPE_DECIMAL:
4259
+ case MYSQL_TYPE_FLOAT:
4260
+ case MYSQL_TYPE_DOUBLE:
4262
+ if (source_type == MYSQL_TYPE_NEWDECIMAL ||
4263
+ source_type == MYSQL_TYPE_DECIMAL)
4264
+ *order_var = 1; // Always require lossy conversions
4266
+ *order_var= compare_lengths(field, source_type, metadata);
4267
+ DBUG_ASSERT(*order_var != 0);
4268
+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
4272
+ DBUG_RETURN(false);
4277
+ The length comparison check will do the correct job of comparing
4278
+ the field lengths (in bytes) of two integer types.
4280
+ case MYSQL_TYPE_TINY:
4281
+ case MYSQL_TYPE_SHORT:
4282
+ case MYSQL_TYPE_INT24:
4283
+ case MYSQL_TYPE_LONG:
4284
+ case MYSQL_TYPE_LONGLONG:
4285
+ switch (field->real_type())
4287
+ case MYSQL_TYPE_TINY:
4288
+ case MYSQL_TYPE_SHORT:
4289
+ case MYSQL_TYPE_INT24:
4290
+ case MYSQL_TYPE_LONG:
4291
+ case MYSQL_TYPE_LONGLONG:
4292
+ *order_var= compare_lengths(field, source_type, metadata);
4293
+ DBUG_ASSERT(*order_var != 0);
4294
+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
4297
+ DBUG_RETURN(false);
4302
+ Since source and target type is different, and it is not possible
4303
+ to convert bit types to anything else, this will return false.
4305
+ case MYSQL_TYPE_BIT:
4306
+ DBUG_RETURN(false);
4309
+ If all conversions are disabled, it is not allowed to convert
4310
+ between these types. Since the TEXT vs. BINARY is distinguished by
4311
+ the charset, and the charset is not replicated, we cannot
4312
+ currently distinguish between , e.g., TEXT and BLOB.
4314
+ case MYSQL_TYPE_TINY_BLOB:
4315
+ case MYSQL_TYPE_MEDIUM_BLOB:
4316
+ case MYSQL_TYPE_LONG_BLOB:
4317
+ case MYSQL_TYPE_BLOB:
4318
+ case MYSQL_TYPE_STRING:
4319
+ case MYSQL_TYPE_VAR_STRING:
4320
+ case MYSQL_TYPE_VARCHAR:
4321
+ switch (field->real_type())
4323
+ case MYSQL_TYPE_TINY_BLOB:
4324
+ case MYSQL_TYPE_MEDIUM_BLOB:
4325
+ case MYSQL_TYPE_LONG_BLOB:
4326
+ case MYSQL_TYPE_BLOB:
4327
+ case MYSQL_TYPE_STRING:
4328
+ case MYSQL_TYPE_VAR_STRING:
4329
+ case MYSQL_TYPE_VARCHAR:
4330
+ *order_var= compare_lengths(field, source_type, metadata);
4332
+ Here we know that the types are different, so if the order
4333
+ gives that they do not require any conversion, we still need
4334
+ to have non-lossy conversion enabled to allow conversion
4335
+ between different (string) types of the same length.
4337
+ if (*order_var == 0)
4339
+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
4342
+ DBUG_RETURN(false);
4346
+ case MYSQL_TYPE_GEOMETRY:
4347
+ case MYSQL_TYPE_TIMESTAMP:
4348
+ case MYSQL_TYPE_DATE:
4349
+ case MYSQL_TYPE_TIME:
4350
+ case MYSQL_TYPE_DATETIME:
4351
+ case MYSQL_TYPE_YEAR:
4352
+ case MYSQL_TYPE_NEWDATE:
4353
+ case MYSQL_TYPE_NULL:
4354
+ case MYSQL_TYPE_ENUM:
4355
+ case MYSQL_TYPE_SET:
4356
+ DBUG_RETURN(false);
4358
+ DBUG_RETURN(false); // To keep GCC happy
4363
+ Is the definition compatible with a table?
4365
+ This function will compare the master table with an existing table
4366
+ on the slave and see if they are compatible with respect to the
4367
+ current settings of @c SLAVE_TYPE_CONVERSIONS.
4369
+ If the tables are compatible and conversions are required, @c
4370
+ *tmp_table_var will be set to a virtual temporary table with field
4371
+ pointers for the fields that require conversions. This allow simple
4372
+ checking of whether a conversion are to be applied or not.
4374
+ If tables are compatible, but no conversions are necessary, @c
4375
+ *tmp_table_var will be set to NULL.
4377
+ @param rli_arg[in]
4378
+ Relay log info, for error reporting.
4381
+ Table to compare with
4383
+ @param tmp_table_var[out]
4384
+ Virtual temporary table for performing conversions, if necessary.
4386
+ @retval true Master table is compatible with slave table.
4387
+ @retval false Master table is not compatible with slave table.
4388
Is the definition compatible with a table?
4392
-table_def::compatible_with(Relay_log_info const *rli_arg, TABLE *table)
4394
+table_def::compatible_with(THD *thd, Relay_log_info *rli,
4395
+ TABLE *table, TABLE **conv_table_var)
4399
We only check the initial columns for the tables.
4401
uint const cols_to_check= min(table->s->fields, size());
4403
- Relay_log_info const *rli= const_cast<Relay_log_info*>(rli_arg);
4405
- TABLE_SHARE const *const tsh= table->s;
4406
+ TABLE *tmp_table= NULL;
4408
for (uint col= 0 ; col < cols_to_check ; ++col)
4410
Field *const field= table->field[col];
4411
- if (field->type() != type(col))
4413
+ if (can_convert_field_to(field, type(col), field_metadata(col), rli, m_flags, &order))
4415
- DBUG_ASSERT(col < size() && col < tsh->fields);
4416
- DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
4419
- my_snprintf(buf, sizeof(buf), "Column %d type mismatch - "
4420
- "received type %d, %s.%s has type %d",
4421
- col, type(col), tsh->db.str, tsh->table_name.str,
4423
- rli->report(ERROR_LEVEL, ER_BINLOG_ROW_WRONG_TABLE_DEF,
4424
- ER(ER_BINLOG_ROW_WRONG_TABLE_DEF), buf);
4425
+ DBUG_PRINT("debug", ("Checking column %d -"
4426
+ " field '%s' can be converted - order: %d",
4427
+ col, field->field_name, order));
4428
+ DBUG_ASSERT(order >= -1 && order <= 1);
4431
+ If order is not 0, a conversion is required, so we need to set
4432
+ up the conversion table.
4434
+ if (order != 0 && tmp_table == NULL)
4437
+ This will create the full table with all fields. This is
4438
+ necessary to ge the correct field lengths for the record.
4440
+ tmp_table= create_conversion_table(thd, rli, table);
4441
+ if (tmp_table == NULL)
4444
+ Clear all fields up to, but not including, this column.
4446
+ for (unsigned int i= 0; i < col; ++i)
4447
+ tmp_table->field[i]= NULL;
4450
+ if (order == 0 && tmp_table != NULL)
4451
+ tmp_table->field[col]= NULL;
4454
- Check the slave's field size against that of the master.
4457
- !field->compatible_field_size(field_metadata(col), rli_arg, m_flags))
4460
+ DBUG_PRINT("debug", ("Checking column %d -"
4461
+ " field '%s' can not be converted",
4462
+ col, field->field_name));
4463
+ DBUG_ASSERT(col < size() && col < table->s->fields);
4464
+ DBUG_ASSERT(table->s->db.str && table->s->table_name.str);
4465
+ const char *db_name= table->s->db.str;
4466
+ const char *tbl_name= table->s->table_name.str;
4467
+ char source_buf[MAX_FIELD_WIDTH];
4468
+ char target_buf[MAX_FIELD_WIDTH];
4469
+ String source_type(source_buf, sizeof(source_buf), field->charset());
4470
+ String target_type(target_buf, sizeof(target_buf), field->charset());
4471
+ show_sql_type(type(col), field_metadata(col), &source_type);
4472
+ field->sql_type(target_type);
4473
+ rli->report(ERROR_LEVEL, ER_SLAVE_CONVERSION_FAILED,
4474
+ ER(ER_SLAVE_CONVERSION_FAILED),
4475
+ col, db_name, tbl_name,
4476
+ source_type.c_ptr_safe(), target_type.c_ptr_safe());
4484
+ for (unsigned int col= 0; col < tmp_table->s->fields; ++col)
4485
+ if (tmp_table->field[col])
4487
+ char source_buf[MAX_FIELD_WIDTH];
4488
+ char target_buf[MAX_FIELD_WIDTH];
4489
+ String source_type(source_buf, sizeof(source_buf), table->field[col]->charset());
4490
+ String target_type(target_buf, sizeof(target_buf), table->field[col]->charset());
4491
+ tmp_table->field[col]->sql_type(source_type);
4492
+ table->field[col]->sql_type(target_type);
4493
+ DBUG_PRINT("debug", ("Field %s - conversion required."
4494
+ " Source type: '%s', Target type: '%s'",
4495
+ tmp_table->field[col]->field_name,
4496
+ source_type.c_ptr_safe(), target_type.c_ptr_safe()));
4501
+ *conv_table_var= tmp_table;
4506
+ Create a conversion table.
4508
+ If the function is unable to create the conversion table, an error
4509
+ will be printed and NULL will be returned.
4511
+ @return Pointer to conversion table, or NULL if unable to create
4515
+TABLE *table_def::create_conversion_table(THD *thd, Relay_log_info *rli, TABLE *target_table) const
4517
+ DBUG_ENTER("table_def::create_conversion_table");
4519
+ List<Create_field> field_list;
4521
+ for (uint col= 0 ; col < size() ; ++col)
4523
+ Create_field *field_def=
4524
+ (Create_field*) alloc_root(thd->mem_root, sizeof(Create_field));
4525
+ if (field_list.push_back(field_def))
4526
+ DBUG_RETURN(NULL);
4529
+ TYPELIB* interval= NULL;
4530
+ uint pack_length= 0;
4531
+ uint32 max_length=
4532
+ max_display_length_for_field(type(col), field_metadata(col));
4537
+ case MYSQL_TYPE_ENUM:
4538
+ case MYSQL_TYPE_SET:
4539
+ interval= static_cast<Field_enum*>(target_table->field[col])->typelib;
4540
+ pack_length= field_metadata(col) & 0x00ff;
4543
+ case MYSQL_TYPE_NEWDECIMAL:
4545
+ The display length of a DECIMAL type is not the same as the
4546
+ length that should be supplied to make_field, so we correct
4549
+ precision= field_metadata(col) >> 8;
4550
+ decimals= field_metadata(col) & 0x00ff;
4552
+ my_decimal_precision_to_length(precision, decimals, FALSE);
4555
+ case MYSQL_TYPE_DECIMAL:
4556
+ precision= field_metadata(col);
4557
+ decimals= static_cast<Field_num*>(target_table->field[col])->dec;
4558
+ max_length= field_metadata(col);
4561
+ case MYSQL_TYPE_TINY_BLOB:
4562
+ case MYSQL_TYPE_MEDIUM_BLOB:
4563
+ case MYSQL_TYPE_LONG_BLOB:
4564
+ case MYSQL_TYPE_BLOB:
4565
+ case MYSQL_TYPE_GEOMETRY:
4566
+ pack_length= field_metadata(col) & 0x00ff;
4573
+ DBUG_PRINT("debug", ("sql_type: %d, target_field: '%s', max_length: %d, decimals: %d,"
4574
+ " maybe_null: %d, unsigned_flag: %d, pack_length: %u",
4575
+ type(col), target_table->field[col]->field_name,
4576
+ max_length, decimals, TRUE, FALSE, pack_length));
4577
+ field_def->init_for_tmp_table(type(col),
4580
+ TRUE, // maybe_null
4581
+ FALSE, // unsigned_flag
4583
+ field_def->charset= target_table->field[col]->charset();
4584
+ field_def->interval= interval;
4587
+ TABLE *conv_table= create_virtual_tmp_table(thd, field_list);
4588
+ if (conv_table == NULL)
4589
+ rli->report(ERROR_LEVEL, ER_SLAVE_CANT_CREATE_CONVERSION,
4590
+ ER(ER_SLAVE_CANT_CREATE_CONVERSION),
4591
+ target_table->s->db.str,
4592
+ target_table->s->table_name.str);
4593
+ DBUG_RETURN(conv_table);
4596
+#endif /* MYSQL_CLIENT */
4598
+table_def::table_def(unsigned char *types, ulong size,
4599
+ uchar *field_metadata, int metadata_size,
4600
+ uchar *null_bitmap, uint16 flags)
4601
+ : m_size(size), m_type(0), m_field_metadata_size(metadata_size),
4602
+ m_field_metadata(0), m_null_bits(0), m_flags(flags),
4605
+ m_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
4607
+ &m_field_metadata,
4608
+ size * sizeof(uint16),
4609
+ &m_null_bits, (size + 7) / 8,
4612
+ bzero(m_field_metadata, size * sizeof(uint16));
4615
+ memcpy(m_type, types, size);
4619
+ Extract the data from the table map into the field metadata array
4620
+ iff there is field metadata. The variable metadata_size will be
4621
+ 0 if we are replicating from an older version server since no field
4622
+ metadata was written to the table map. This can also happen if
4623
+ there were no fields in the master that needed extra metadata.
4625
+ if (m_size && metadata_size)
4628
+ for (unsigned int i= 0; i < m_size; i++)
4632
- my_snprintf(buf, sizeof(buf), "Column %d size mismatch - "
4633
- "master has size %d, %s.%s on slave has size %d."
4634
- " Master's column size should be <= the slave's "
4635
- "column size.", col,
4636
- field->pack_length_from_metadata(m_field_metadata[col]),
4637
- tsh->db.str, tsh->table_name.str,
4638
- field->row_pack_length());
4639
- rli->report(ERROR_LEVEL, ER_BINLOG_ROW_WRONG_TABLE_DEF,
4640
- ER(ER_BINLOG_ROW_WRONG_TABLE_DEF), buf);
4641
+ switch (m_type[i]) {
4642
+ case MYSQL_TYPE_TINY_BLOB:
4643
+ case MYSQL_TYPE_BLOB:
4644
+ case MYSQL_TYPE_MEDIUM_BLOB:
4645
+ case MYSQL_TYPE_LONG_BLOB:
4646
+ case MYSQL_TYPE_DOUBLE:
4647
+ case MYSQL_TYPE_FLOAT:
4648
+ case MYSQL_TYPE_GEOMETRY:
4651
+ These types store a single byte.
4653
+ m_field_metadata[i]= field_metadata[index];
4657
+ case MYSQL_TYPE_SET:
4658
+ case MYSQL_TYPE_ENUM:
4659
+ case MYSQL_TYPE_STRING:
4661
+ uint16 x= field_metadata[index++] << 8U; // real_type
4662
+ x+= field_metadata[index++]; // pack or field length
4663
+ m_field_metadata[i]= x;
4666
+ case MYSQL_TYPE_BIT:
4668
+ uint16 x= field_metadata[index++];
4669
+ x = x + (field_metadata[index++] << 8U);
4670
+ m_field_metadata[i]= x;
4673
+ case MYSQL_TYPE_VARCHAR:
4676
+ These types store two bytes.
4678
+ char *ptr= (char *)&field_metadata[index];
4679
+ m_field_metadata[i]= uint2korr(ptr);
4683
+ case MYSQL_TYPE_NEWDECIMAL:
4685
+ uint16 x= field_metadata[index++] << 8U; // precision
4686
+ x+= field_metadata[index++]; // decimals
4687
+ m_field_metadata[i]= x;
4691
+ m_field_metadata[i]= 0;
4696
+ if (m_size && null_bitmap)
4697
+ memcpy(m_null_bits, null_bitmap, (m_size + 7) / 8);
4702
+table_def::~table_def()
4704
+ my_free(m_memory, MYF(0));
4710
diff -Nur a/sql/rpl_utility.h b/sql/rpl_utility.h
4711
--- a/sql/rpl_utility.h 2010-08-04 19:22:43.428461764 +0400
4712
+++ b/sql/rpl_utility.h 2010-08-04 19:23:00.788458460 +0400
4716
#include "mysql_priv.h"
4717
+#include "mysql_com.h"
4719
class Relay_log_info;
4721
@@ -38,116 +39,18 @@
4725
- Convenience declaration of the type of the field type data in a
4728
- typedef unsigned char field_type;
4733
- @param types Array of types
4734
+ @param types Array of types, each stored as a byte
4735
@param size Number of elements in array 'types'
4736
@param field_metadata Array of extra information about fields
4737
@param metadata_size Size of the field_metadata array
4738
@param null_bitmap The bitmap of fields that can be null
4740
- table_def(field_type *types, ulong size, uchar *field_metadata,
4741
- int metadata_size, uchar *null_bitmap, uint16 flags)
4742
- : m_size(size), m_type(0), m_field_metadata_size(metadata_size),
4743
- m_field_metadata(0), m_null_bits(0), m_flags(flags), m_memory(NULL)
4745
- m_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
4747
- &m_field_metadata,
4748
- size * sizeof(uint16),
4749
- &m_null_bits, (size + 7) / 8,
4752
- bzero(m_field_metadata, size * sizeof(uint16));
4755
- memcpy(m_type, types, size);
4759
- Extract the data from the table map into the field metadata array
4760
- iff there is field metadata. The variable metadata_size will be
4761
- 0 if we are replicating from an older version server since no field
4762
- metadata was written to the table map. This can also happen if
4763
- there were no fields in the master that needed extra metadata.
4765
- if (m_size && metadata_size)
4768
- for (unsigned int i= 0; i < m_size; i++)
4770
- switch (m_type[i]) {
4771
- case MYSQL_TYPE_TINY_BLOB:
4772
- case MYSQL_TYPE_BLOB:
4773
- case MYSQL_TYPE_MEDIUM_BLOB:
4774
- case MYSQL_TYPE_LONG_BLOB:
4775
- case MYSQL_TYPE_DOUBLE:
4776
- case MYSQL_TYPE_FLOAT:
4777
- case MYSQL_TYPE_GEOMETRY:
4780
- These types store a single byte.
4782
- m_field_metadata[i]= field_metadata[index];
4786
- case MYSQL_TYPE_SET:
4787
- case MYSQL_TYPE_ENUM:
4788
- case MYSQL_TYPE_STRING:
4790
- uint16 x= field_metadata[index++] << 8U; // real_type
4791
- x+= field_metadata[index++]; // pack or field length
4792
- m_field_metadata[i]= x;
4795
- case MYSQL_TYPE_BIT:
4797
- uint16 x= field_metadata[index++];
4798
- x = x + (field_metadata[index++] << 8U);
4799
- m_field_metadata[i]= x;
4802
- case MYSQL_TYPE_VARCHAR:
4805
- These types store two bytes.
4807
- char *ptr= (char *)&field_metadata[index];
4808
- m_field_metadata[i]= uint2korr(ptr);
4812
- case MYSQL_TYPE_NEWDECIMAL:
4814
- uint16 x= field_metadata[index++] << 8U; // precision
4815
- x+= field_metadata[index++]; // decimals
4816
- m_field_metadata[i]= x;
4820
- m_field_metadata[i]= 0;
4825
- if (m_size && null_bitmap)
4826
- memcpy(m_null_bits, null_bitmap, (m_size + 7) / 8);
4828
+ table_def(unsigned char *types, ulong size, uchar *field_metadata,
4829
+ int metadata_size, uchar *null_bitmap, uint16 flags);
4832
- my_free(m_memory, MYF(0));
4841
Return the number of fields there is type data for.
4842
@@ -166,10 +69,40 @@
4843
<code>index</code>. Currently, only the type identifier is
4846
- field_type type(ulong index) const
4847
+ enum_field_types type(ulong index) const
4849
DBUG_ASSERT(index < m_size);
4850
- return m_type[index];
4852
+ If the source type is MYSQL_TYPE_STRING, it can in reality be
4853
+ either MYSQL_TYPE_STRING, MYSQL_TYPE_ENUM, or MYSQL_TYPE_SET, so
4854
+ we might need to modify the type to get the real type.
4856
+ enum_field_types source_type= static_cast<enum_field_types>(m_type[index]);
4857
+ uint16 source_metadata= m_field_metadata[index];
4858
+ switch (source_type)
4860
+ case MYSQL_TYPE_STRING:
4862
+ int real_type= source_metadata >> 8;
4863
+ if (real_type == MYSQL_TYPE_ENUM || real_type == MYSQL_TYPE_SET)
4864
+ source_type= static_cast<enum_field_types>(real_type);
4869
+ This type has not been used since before row-based replication,
4870
+ so we can safely assume that it really is MYSQL_TYPE_NEWDATE.
4872
+ case MYSQL_TYPE_DATE:
4873
+ source_type= MYSQL_TYPE_NEWDATE;
4881
+ return source_type;
4885
@@ -221,23 +154,58 @@
4888
A table definition is compatible with a table if:
4889
- - the columns types of the table definition is a (not
4890
- necessarily proper) prefix of the column type of the table, or
4891
- - the other way around
4892
+ - The columns types of the table definition is a (not
4893
+ necessarily proper) prefix of the column type of the table.
4895
+ - The other way around.
4897
+ - Each column on the master that also exists on the slave can be
4898
+ converted according to the current settings of @c
4899
+ SLAVE_TYPE_CONVERSIONS.
4902
@param rli Pointer to relay log info
4903
@param table Pointer to table to compare with.
4905
+ @param[out] tmp_table_var Pointer to temporary table for holding
4908
@retval 1 if the table definition is not compatible with @c table
4909
@retval 0 if the table definition is compatible with @c table
4911
#ifndef MYSQL_CLIENT
4912
- int compatible_with(Relay_log_info const *rli, TABLE *table) const;
4913
+ bool compatible_with(THD *thd, Relay_log_info *rli, TABLE *table,
4914
+ TABLE **conv_table_var) const;
4917
+ Create a virtual in-memory temporary table structure.
4919
+ The table structure has records and field array so that a row can
4920
+ be unpacked into the record for further processing.
4922
+ In the virtual table, each field that requires conversion will
4923
+ have a non-NULL value, while fields that do not require
4924
+ conversion will have a NULL value.
4926
+ Some information that is missing in the events, such as the
4927
+ character set for string types, are taken from the table that the
4928
+ field is going to be pushed into, so the target table that the data
4929
+ eventually need to be pushed into need to be supplied.
4931
+ @param thd Thread to allocate memory from.
4932
+ @param rli Relay log info structure, for error reporting.
4933
+ @param target_table Target table for fields.
4935
+ @return A pointer to a temporary table with memory allocated in the
4936
+ thread's memroot, NULL if the table could not be created
4938
+ TABLE *create_conversion_table(THD *thd, Relay_log_info *rli, TABLE *target_table) const;
4943
ulong m_size; // Number of elements in the types array
4944
- field_type *m_type; // Array of type descriptors
4945
+ unsigned char *m_type; // Array of type descriptors
4946
uint m_field_metadata_size;
4947
uint16 *m_field_metadata;
4951
bool m_tabledef_valid;
4952
table_def m_tabledef;
4953
+ TABLE *m_conv_table;
4957
diff -Nur a/sql/set_var.cc b/sql/set_var.cc
4958
--- a/sql/set_var.cc 2010-08-04 19:22:43.418464122 +0400
4959
+++ b/sql/set_var.cc 2010-08-04 19:23:00.788458460 +0400
4961
delay_key_write_type_names, NULL
4965
+ SLAVE_TYPE_CONVERSIONS variable.
4967
+ Definition is equivalent to
4969
+ SET('ALL_NON_LOSSY', 'ALL_LOSSY')
4972
+const char *slave_type_conversions_type_name[]= {
4978
+unsigned int slave_type_conversions_type_length[]= {
4979
+ sizeof("ALL_LOSSY")-1,
4980
+ sizeof("ALL_NON_LOSSY")-1,
4984
+TYPELIB slave_type_conversions_typelib=
4986
+ array_elements(slave_type_conversions_type_name)-1, "",
4987
+ slave_type_conversions_type_name,
4988
+ slave_type_conversions_type_length
4991
const char *slave_exec_mode_names[]=
4992
{ "STRICT", "IDEMPOTENT", NullS };
4993
static const unsigned int slave_exec_mode_names_len[]=
4994
@@ -665,6 +692,12 @@
4995
&slave_exec_mode_options,
4996
&slave_exec_mode_typelib,
4998
+static sys_var_set slave_type_conversions(&vars,
4999
+ "slave_type_conversions",
5000
+ &slave_type_conversions_options,
5001
+ &slave_type_conversions_typelib,
5004
static sys_var_long_ptr sys_slow_launch_time(&vars, "slow_launch_time",
5006
static sys_var_thd_ulong sys_sort_buffer(&vars, "sort_buffer_size",
5007
diff -Nur a/sql/set_var.h b/sql/set_var.h
5008
--- a/sql/set_var.h 2010-08-04 19:22:43.438463876 +0400
5009
+++ b/sql/set_var.h 2010-08-04 19:23:00.788458460 +0400
5012
extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib,
5013
optimizer_switch_typelib, slave_exec_mode_typelib;
5014
+extern TYPELIB slave_type_conversions_typelib;
5016
typedef int (*sys_check_func)(THD *, set_var *);
5017
typedef bool (*sys_update_func)(THD *, set_var *);
5018
diff -Nur a/sql/share/errmsg.txt b/sql/share/errmsg.txt
5019
--- a/sql/share/errmsg.txt 2010-08-04 19:22:43.448459561 +0400
5020
+++ b/sql/share/errmsg.txt 2010-08-04 19:23:00.788458460 +0400
5021
@@ -6235,3 +6235,57 @@
5022
eng "Fictive error for Percona patches"
5023
ER_QUERY_CACHE_DISABLED
5024
eng "Query cache is disabled; restart the server with query_cache_type=1 to enable it"
5025
+ER_PERCONA_FICTIVE_1652
5026
+ eng "Fictive error for Percona patches"
5027
+ER_PERCONA_FICTIVE_1653
5028
+ eng "Fictive error for Percona patches"
5029
+ER_PERCONA_FICTIVE_1654
5030
+ eng "Fictive error for Percona patches"
5031
+ER_PERCONA_FICTIVE_1655
5032
+ eng "Fictive error for Percona patches"
5033
+ER_PERCONA_FICTIVE_1656
5034
+ eng "Fictive error for Percona patches"
5035
+ER_PERCONA_FICTIVE_1657
5036
+ eng "Fictive error for Percona patches"
5037
+ER_PERCONA_FICTIVE_1658
5038
+ eng "Fictive error for Percona patches"
5039
+ER_PERCONA_FICTIVE_1659
5040
+ eng "Fictive error for Percona patches"
5041
+ER_PERCONA_FICTIVE_1660
5042
+ eng "Fictive error for Percona patches"
5043
+ER_PERCONA_FICTIVE_1661
5044
+ eng "Fictive error for Percona patches"
5045
+ER_PERCONA_FICTIVE_1662
5046
+ eng "Fictive error for Percona patches"
5047
+ER_PERCONA_FICTIVE_1663
5048
+ eng "Fictive error for Percona patches"
5049
+ER_PERCONA_FICTIVE_1664
5050
+ eng "Fictive error for Percona patches"
5051
+ER_PERCONA_FICTIVE_1665
5052
+ eng "Fictive error for Percona patches"
5053
+ER_PERCONA_FICTIVE_1666
5054
+ eng "Fictive error for Percona patches"
5055
+ER_PERCONA_FICTIVE_1667
5056
+ eng "Fictive error for Percona patches"
5057
+ER_PERCONA_FICTIVE_1668
5058
+ eng "Fictive error for Percona patches"
5059
+ER_PERCONA_FICTIVE_1669
5060
+ eng "Fictive error for Percona patches"
5061
+ER_PERCONA_FICTIVE_1670
5062
+ eng "Fictive error for Percona patches"
5063
+ER_PERCONA_FICTIVE_1671
5064
+ eng "Fictive error for Percona patches"
5065
+ER_PERCONA_FICTIVE_1672
5066
+ eng "Fictive error for Percona patches"
5067
+ER_PERCONA_FICTIVE_1673
5068
+ eng "Fictive error for Percona patches"
5069
+ER_PERCONA_FICTIVE_1674
5070
+ eng "Fictive error for Percona patches"
5071
+ER_PERCONA_FICTIVE_1675
5072
+ eng "Fictive error for Percona patches"
5073
+ER_PERCONA_FICTIVE_1676
5074
+ eng "Fictive error for Percona patches"
5075
+ER_SLAVE_CONVERSION_FAILED
5076
+ eng "Column %d of table '%-.192s.%-.192s' cannot be converted from type '%-.32s' to type '%-.32s'"
5077
+ER_SLAVE_CANT_CREATE_CONVERSION
5078
+ eng "Can't create conversion table for table '%-.192s.%-.192s'"
5079
diff -Nur a/sql/sql_class.h b/sql/sql_class.h
5080
--- a/sql/sql_class.h 2010-08-04 19:22:43.428461764 +0400
5081
+++ b/sql/sql_class.h 2010-08-04 19:23:00.798460852 +0400
5083
enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT,
5084
SLAVE_EXEC_MODE_IDEMPOTENT,
5085
SLAVE_EXEC_MODE_LAST_BIT};
5086
+enum enum_slave_type_conversions {
5087
+ SLAVE_TYPE_CONVERSIONS_ALL_LOSSY,
5088
+ SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY,
5089
+ SLAVE_TYPE_CONVERSIONS_COUNT
5092
enum enum_mark_columns
5093
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
5095
diff -Nur a/sql/sql_select.cc b/sql/sql_select.cc
5096
--- a/sql/sql_select.cc 2010-08-04 19:22:43.418464122 +0400
5097
+++ b/sql/sql_select.cc 2010-08-04 19:23:00.798460852 +0400
5098
@@ -10724,6 +10724,18 @@
5102
+ if (cur_field->type() == MYSQL_TYPE_BIT &&
5103
+ cur_field->key_type() == HA_KEYTYPE_BIT)
5105
+ /* This is a Field_bit since key_type is HA_KEYTYPE_BIT */
5106
+ static_cast<Field_bit*>(cur_field)->set_bit_ptr(null_pos, null_bit);
5107
+ null_bit+= cur_field->field_length & 7;
5116
field_pos+= cur_field->pack_length();