[MDEV-10288] Replication aborts when master uses swe7 Created: 2016-06-25  Updated: 2020-12-01

Status: Open
Project: MariaDB Server
Component/s: Character Sets, Replication
Affects Version/s: 10.1, 10.2
Fix Version/s: 10.2

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: None


 Description   

--source include/master-slave.inc
--source include/have_binlog_format_row.inc
 
set @a=1;
set names swe7;
create table t1 as select @a;
set names utf8;
show create table t1;
select * from t1;
 
--sync_slave_with_master
 
set names utf8;
show create table t1;
select * from t1;

Last_Errno	1300
Last_Error	Error 'Invalid swe7 character string: '\xC3\x89a'' on query. Default database: 'test'. Query: 'CREATE TABLE `t1` (
  `Éa` bigint(20) DEFAULT NULL
)'

The problem started happening in 10.1 tree after this commit:

commit e6f67c64cda4e4ca4f1463ae65f301358ed356a7
Author: Alexander Barkov <bar@mariadb.org>
Date:   Mon Mar 16 21:55:10 2015 +0400
 
    MDEV-6572 "USE dbname" with a bad sequence erroneously connects to a wrong database

I don't know if the change was intentional – it wasn't working quite well even before, even although replication did not abort, master and slave ended up with a different table definition; but still, replication failure is a regression, so it's worth checking what's happening.



 Comments   
Comment by Alexander Barkov [ 2016-06-27 ]

The tricky thing with swe7 is that it does not have characters:

  • U+0040 COMMERCIAL AT
  • U+0060 GRAVE ACCENT (also known as backtick)

The codes 0x40 and 0x60 are occupied by letters É and é.

Comment by Alexander Barkov [ 2016-06-27 ]

The problem is not specific to swe7. Replication is failing with other character sets as well.

If I put this file to mysql-test/t/TEST.test

--source include/master-slave.inc
 
SET NAMES cp1251;
CREATE TABLE t1 AS SELECT 'я';
SET NAMES utf8;
SHOW CREATE TABLE t1;
--sync_slave_with_master
SET NAMES utf8;
SHOW CREATE TABLE t1;
 
connection master;
DROP TABLE t1;
--sync_slave_with_master
 
--source include/rpl_end.inc

and record it with statement based replication:

./mtr --record --mysqld=--binlog-format=statement TEST

and then run it with row based binary log:

./mtr --mysqld=--binlog-format=row TEST

it fails with this diff:

--- /home/bar/maria-git/server/mysql-test/r/AAA2.result	2016-06-27 13:05:08.932486762 +0400
+++ /home/bar/maria-git/server/mysql-test/r/AAA2.reject	2016-06-27 13:14:27.194462723 +0400
@@ -12,7 +12,7 @@
 SHOW CREATE TABLE t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `СЏ` varchar(2) CHARACTER SET cp1251 NOT NULL
+  `РЎРЏ` varchar(2) CHARACTER SET cp1251 NOT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 DROP TABLE t1;
 include/rpl_end.inc

Notice, row based replication creates a wrong column name.

Generated at Thu Feb 08 07:41:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.