| 1 |
# |
| 2 |
# This include file is used by more than one test suite |
| 3 |
# (currently rpl and binlog_encryption suite). |
| 4 |
# Please check all dependent tests after modifying it |
| 5 |
# |
| 6 |
|
| 7 |
--source include/long_test.inc |
| 8 |
--source include/have_binlog_format_row.inc |
| 9 |
--source include/master-slave.inc |
| 10 |
--source include/test_db_charset_latin1.inc |
| 11 |
|
| 12 |
connection slave; |
| 13 |
set @saved_slave_type_conversions = @@global.slave_type_conversions; |
| 14 |
CREATE TABLE type_conversions ( |
| 15 |
TestNo INT AUTO_INCREMENT PRIMARY KEY, |
| 16 |
Source TEXT, |
| 17 |
Target TEXT, |
| 18 |
Flags TEXT, |
| 19 |
On_Master LONGTEXT, |
| 20 |
On_Slave LONGTEXT, |
| 21 |
Expected LONGTEXT, |
| 22 |
Compare INT, |
| 23 |
Error INT2); |
| 24 |
|
| 25 |
SELECT @@global.slave_type_conversions; |
| 26 |
SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; |
| 27 |
SELECT @@global.slave_type_conversions; |
| 28 |
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; |
| 29 |
SELECT @@global.slave_type_conversions; |
| 30 |
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; |
| 31 |
SELECT @@global.slave_type_conversions; |
| 32 |
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; |
| 33 |
SELECT @@global.slave_type_conversions; |
| 34 |
--error ER_WRONG_VALUE_FOR_VAR |
| 35 |
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT'; |
| 36 |
SELECT @@global.slave_type_conversions; |
| 37 |
|
| 38 |
# Checking strict interpretation of type conversions |
| 39 |
connection slave; |
| 40 |
SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; |
| 41 |
source suite/rpl/include/type_conversions.test; |
| 42 |
|
| 43 |
# Checking lossy integer type conversions |
| 44 |
connection slave; |
| 45 |
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; |
| 46 |
source suite/rpl/include/type_conversions.test; |
| 47 |
|
| 48 |
# Checking non-lossy integer type conversions |
| 49 |
connection slave; |
| 50 |
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; |
| 51 |
source suite/rpl/include/type_conversions.test; |
| 52 |
|
| 53 |
# Checking all type conversions |
| 54 |
connection slave; |
| 55 |
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; |
| 56 |
source suite/rpl/include/type_conversions.test; |
| 57 |
|
| 58 |
connection slave; |
| 59 |
--echo **** Result of conversions **** |
| 60 |
disable_query_log; |
| 61 |
SELECT RPAD(Source, 15, ' ') AS Source_Type, |
| 62 |
RPAD(Target, 15, ' ') AS Target_Type, |
| 63 |
RPAD(Flags, 25, ' ') AS All_Type_Conversion_Flags, |
| 64 |
IF(Compare IS NULL AND Error, '<Correct error>', |
| 65 |
IF(Compare, '<Correct value>', |
| 66 |
CONCAT("'", On_Slave, "' != '", Expected, "'"))) |
| 67 |
AS Value_On_Slave |
| 68 |
FROM type_conversions; |
| 69 |
enable_query_log; |
| 70 |
DROP TABLE type_conversions; |
| 71 |
|
| 72 |
call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677"); |
| 73 |
|
| 74 |
connection master; |
| 75 |
DROP TABLE t1; |
| 76 |
--source include/test_db_charset_restore.inc |
| 77 |
sync_slave_with_master; |
| 78 |
|
| 79 |
set global slave_type_conversions = @saved_slave_type_conversions; |
| 80 |
|
| 81 |
|
| 82 |
--source include/rpl_end.inc |