mariadb/mysql-test/t/rpl_loaddata_charset.test
unknown 0d821fafe9 BUG#45516 SQL thread does not use database charset properly
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
2009-08-12 11:54:05 +08:00

50 lines
1.4 KiB
Text

#
# Check LOAD DATA + character sets + replication
#
source include/master-slave.inc;
#
# Bug#15126 character_set_database is not replicated
# (LOAD DATA INFILE need it)
#
connection master;
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;
save_master_pos;
connection slave;
sync_with_master;
select hex(a) from t1;
connection master;
drop table t1;
sync_slave_with_master;
#
# Bug#45516
# When slave SQL thread executing LOAD DATA command, the
# thd->variables.collation_database was not set properly to the default
# database charset
#
echo -------------test bug#45516------------------;
# LOAD DATA INFILE
let $LOAD_LOCAL=1;
source include/rpl_loaddata_charset.inc;
# LOAD DATA LOCAL INFILE
let $LOAD_LOCAL=0;
source include/rpl_loaddata_charset.inc;