Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
b45813ca
Commit
b45813ca
authored
Aug 11, 2009
by
Browse files
Options
Browse Files
Download
Plain Diff
BUG#45516 SQL thread does not use database charset properly
Manual Merge
parents
eb94a707
10d5cba0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
106 additions
and
0 deletions
+106
-0
mysql-test/include/rpl_loaddata_charset.inc
mysql-test/include/rpl_loaddata_charset.inc
+35
-0
mysql-test/std_data/loaddata_utf8.dat
mysql-test/std_data/loaddata_utf8.dat
+3
-0
mysql-test/suite/rpl/r/rpl_loaddata_charset.result
mysql-test/suite/rpl/r/rpl_loaddata_charset.result
+41
-0
mysql-test/suite/rpl/t/rpl_loaddata_charset.test
mysql-test/suite/rpl/t/rpl_loaddata_charset.test
+17
-0
sql/log_event.cc
sql/log_event.cc
+10
-0
No files found.
mysql-test/include/rpl_loaddata_charset.inc
0 → 100644
View file @
b45813ca
connection
master
;
--
disable_warnings
DROP
DATABASE
IF
EXISTS
mysqltest
;
--
enable_warnings
CREATE
DATABASE
mysqltest
CHARSET
UTF8
;
USE
mysqltest
;
CREATE
TABLE
t
(
cl
varchar
(
100
))
CHARSET
UTF8
;
if
(
!
$LOAD_LOCAL
)
{
LOAD
DATA
INFILE
'../../std_data/loaddata_utf8.dat'
INTO
TABLE
t
FIELDS
TERMINATED
BY
','
LINES
TERMINATED
BY
'\n'
;
}
if
(
$LOAD_LOCAL
)
{
LOAD
DATA
LOCAL
INFILE
'./std_data/loaddata_utf8.dat'
INTO
TABLE
t
FIELDS
TERMINATED
BY
','
LINES
TERMINATED
BY
'\n'
;
}
save_master_pos
;
echo
----------
content
on
master
----------
;
SELECT
hex
(
cl
)
FROM
t
;
connection
slave
;
sync_with_master
;
echo
----------
content
on
slave
----------
;
USE
mysqltest
;
SELECT
hex
(
cl
)
FROM
t
;
connection
master
;
DROP
DATABASE
mysqltest
;
save_master_pos
;
connection
slave
;
sync_with_master
;
mysql-test/std_data/loaddata_utf8.dat
0 → 100644
View file @
b45813ca
一二三
四五六
七八九
mysql-test/suite/rpl/r/rpl_loaddata_charset.result
View file @
b45813ca
...
...
@@ -35,3 +35,44 @@ 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/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;
mysql-test/suite/rpl/t/rpl_loaddata_charset.test
View file @
b45813ca
...
...
@@ -31,3 +31,20 @@ 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
;
sql/log_event.cc
View file @
b45813ca
...
...
@@ -2949,6 +2949,8 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
{
LEX_STRING
new_db
;
int
expected_error
,
actual_error
=
0
;
HA_CREATE_INFO
db_options
;
/*
Colleagues: please never free(thd->catalog) in MySQL. This would
lead to bugs as here thd->catalog is a part of an alloced block,
...
...
@@ -2960,6 +2962,14 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
new_db
.
length
=
db_len
;
new_db
.
str
=
(
char
*
)
rpl_filter
->
get_rewrite_db
(
db
,
&
new_db
.
length
);
thd
->
set_db
(
new_db
.
str
,
new_db
.
length
);
/* allocates a copy of 'db' */
/*
Setting the character set and collation of the current database thd->db.
*/
load_db_opt_by_name
(
thd
,
thd
->
db
,
&
db_options
);
if
(
db_options
.
default_table_charset
)
thd
->
db_charset
=
db_options
.
default_table_charset
;
thd
->
variables
.
auto_increment_increment
=
auto_increment_increment
;
thd
->
variables
.
auto_increment_offset
=
auto_increment_offset
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment