Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5, 10.6, 10.11, 11.1(EOL), 10.4(EOL), 10.9(EOL), 10.10(EOL), 11.0(EOL)
-
None
Description
Note: GLOBAL_STATUS is taken as an example, the same can be reproduced with different information_schema tables.
--source include/have_binlog_format_row.inc
|
--source include/master-slave.inc
|
|
# Not needed for MTR, but just in case |
CREATE DATABASE db CHARACTER SET latin1; |
|
CREATE TABLE db.t LIKE information_schema.GLOBAL_STATUS; |
SHOW CREATE TABLE db.t; |
|
--sync_slave_with_master
|
|
SHOW CREATE TABLE db.t; |
|
--connection master
|
INSERT INTO db.t VALUES ('foo','bar'); |
|
--sync_slave_with_master
|
|
# Cleanup
|
--connection master
|
DROP DATABASE db; |
--source include/rpl_end.inc |
10.4 f5dceafd |
SHOW CREATE TABLE db.t; |
Table Create Table |
t CREATE TABLE `t` ( |
`VARIABLE_NAME` varchar(64) NOT NULL, |
`VARIABLE_VALUE` varchar(2048) NOT NULL |
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci |
connection slave; |
SHOW CREATE TABLE db.t; |
Table Create Table |
t CREATE TABLE `t` ( |
`VARIABLE_NAME` varchar(64) NOT NULL, |
`VARIABLE_VALUE` varchar(2048) NOT NULL |
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci |
2023-06-27 22:16:37 13 [ERROR] Slave SQL: Column 0 of table 'db.t' cannot be converted from type 'varchar(192 octets)' to type 'varchar(64 octets) character set latin1', Gtid 0-1-3, Internal MariaDB error code: 1677 |
The problem can already be seen after CREATE, as the table's character set is different on master and slave. Further INSERT only shows how replication actually breaks.
On master, CREATE ... LIKE works properly and creates a table with the same character set as the I_S table, which is utf8.
However, when it is written into the binlog, it is converted from CREATE .. LIKE into an explicit CREATE statement. Probably it's special logic for information_schema, as it doesn't seem to happen for just any table.
All in all, the event in the binlog looks like this:
#230627 22:16:37 server id 1 end_log_pos 705 CRC32 0x9a36f132 Query thread_id=9 exec_time=0 error_code=0
|
use `test`/*!*/; |
SET TIMESTAMP=1687893397/*!*/; |
CREATE TABLE `db`.`t` ( |
`VARIABLE_NAME` varchar(64) NOT NULL, |
`VARIABLE_VALUE` varchar(2048) NOT NULL |
) ENGINE=MEMORY
|
/*!*/; |
Note that it doesn't specify the character set, so it's created with the database's default, which is in this case latin1.