mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
f5be2159fe
Replication SQL thread does not set database default charset to thd->variables.collation_database properly, when executing LOAD DATA binlog. This bug can be repeated by using "LOAD DATA" command in STATEMENT mode. This patch adds code to find the default character set of the current database then assign it to thd->db_charset when slave server begins to execute a relay log. The test of this bug is added into rpl_loaddata_charset.test
78 lines
2 KiB
Text
78 lines
2 KiB
Text
stop slave;
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
reset master;
|
|
reset slave;
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
start slave;
|
|
create table t1 (a varchar(10) character set utf8);
|
|
load data infile '../std_data_ln/loaddata6.dat' into table t1;
|
|
set @@character_set_database=koi8r;
|
|
load data infile '../std_data_ln/loaddata6.dat' into table t1;
|
|
set @@character_set_database=DEFAULT;
|
|
load data infile '../std_data_ln/loaddata6.dat' into table t1;
|
|
load data infile '../std_data_ln/loaddata6.dat' into table t1;
|
|
load data infile '../std_data_ln/loaddata6.dat' into table t1;
|
|
set @@character_set_database=koi8r;
|
|
load data infile '../std_data_ln/loaddata6.dat' into table t1;
|
|
set @@character_set_database=DEFAULT;
|
|
load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
|
|
select hex(a) from t1;
|
|
hex(a)
|
|
C3BF
|
|
D0AA
|
|
C3BF
|
|
C3BF
|
|
C3BF
|
|
D0AA
|
|
D0AA
|
|
select hex(a) from t1;
|
|
hex(a)
|
|
C3BF
|
|
D0AA
|
|
C3BF
|
|
C3BF
|
|
C3BF
|
|
D0AA
|
|
D0AA
|
|
drop table t1;
|
|
-------------test bug#45516------------------
|
|
DROP DATABASE IF EXISTS mysqltest;
|
|
CREATE DATABASE mysqltest CHARSET UTF8;
|
|
USE mysqltest;
|
|
CREATE TABLE t (cl varchar(100)) CHARSET UTF8;
|
|
LOAD DATA LOCAL INFILE './std_data/loaddata_utf8.dat' INTO TABLE t
|
|
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
|
|
----------content on master----------
|
|
SELECT hex(cl) FROM t;
|
|
hex(cl)
|
|
E4B880E4BA8CE4B889
|
|
E59B9BE4BA94E585AD
|
|
E4B883E585ABE4B99D
|
|
----------content on slave----------
|
|
USE mysqltest;
|
|
SELECT hex(cl) FROM t;
|
|
hex(cl)
|
|
E4B880E4BA8CE4B889
|
|
E59B9BE4BA94E585AD
|
|
E4B883E585ABE4B99D
|
|
DROP DATABASE mysqltest;
|
|
DROP DATABASE IF EXISTS mysqltest;
|
|
CREATE DATABASE mysqltest CHARSET UTF8;
|
|
USE mysqltest;
|
|
CREATE TABLE t (cl varchar(100)) CHARSET UTF8;
|
|
LOAD DATA INFILE '../std_data_ln/loaddata_utf8.dat' INTO TABLE t
|
|
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
|
|
----------content on master----------
|
|
SELECT hex(cl) FROM t;
|
|
hex(cl)
|
|
E4B880E4BA8CE4B889
|
|
E59B9BE4BA94E585AD
|
|
E4B883E585ABE4B99D
|
|
----------content on slave----------
|
|
USE mysqltest;
|
|
SELECT hex(cl) FROM t;
|
|
hex(cl)
|
|
E4B880E4BA8CE4B889
|
|
E59B9BE4BA94E585AD
|
|
E4B883E585ABE4B99D
|
|
DROP DATABASE mysqltest;
|