Bug #78265 utf8 on master and utf8mb4 on slave leads to "cannot be converted from type" err
Submitted: 28 Aug 2015 20:48 Modified: 31 Aug 2015 22:37
Reporter: Sveta Smirnova (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S3 (Non-critical)
Version:5.6.26, 5.7.8, 5.7.9 OS:Any
Assigned to: CPU Architecture:Any

[28 Aug 2015 20:48] Sveta Smirnova
Description:
Similar to bug #71111, but test case is simpler, so reported as new bug

If a table has utf8 character set on master and utf8mb4 on slave replication fails with error " Column 1 of table 'test.t1' cannot be converted from type 'varchar(765)' to type 'varchar(255)'"

Workaround:

--slave-type-conversions=ALL_NON_LOSSY

or use statement-based replication

How to repeat:
$cat rpl_bug-master.opt
--innodb-file-per-table=1 --binlog-format=row 

$cat rpl_bug-slave.opt
--innodb-file-per-table=1 --binlog-format=row 

$cat rpl_bug.test
--source include/master-slave.inc

CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT primary key,
`bug` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

insert into t1 values(1, 'Света тестирует баг');

--sync_slave_with_master

ALTER TABLE t1 CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
ALTER TABLE t1 MODIFY COLUMN `bug` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL;
show create table t1;

connection master;

insert into t1 values(2, 'Света тестирует баг');

--sync_slave_with_master
[30 Aug 2015 9:05] Umesh Shastry
Thank you Sveta for the test case and report.

Thanks,
Umesh
[31 Aug 2015 20:38] Sveta Smirnova
Please also note what error message , printed says "Column 1 of table 'test.t1' cannot be converted from type 'varchar(765)' to type 'varchar(255)'" while affected column is "column 2", according to mysqlbinlog --verbose output. Not sure if this is result of this bug or should be reported separately.
[31 Aug 2015 22:37] Sveta Smirnova
Note also anomaly in the error message regarding size of the column on master.