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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c5242d2f
Commit
c5242d2f
authored
Sep 25, 2003
by
guilhem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
parents
7795de89
9854acae
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
17 deletions
+52
-17
mysql-test/r/rpl_loaddata.result
mysql-test/r/rpl_loaddata.result
+12
-1
mysql-test/std_data/rpl_loaddata2.dat
mysql-test/std_data/rpl_loaddata2.dat
+1
-1
mysql-test/t/rpl_loaddata.test
mysql-test/t/rpl_loaddata.test
+15
-0
sql/sql_load.cc
sql/sql_load.cc
+24
-15
No files found.
mysql-test/r/rpl_loaddata.result
View file @
c5242d2f
...
@@ -19,7 +19,7 @@ select * from t3;
...
@@ -19,7 +19,7 @@ select * from t3;
day id category name
day id category name
2003-02-22 2461 b a a a @ % ' " a
2003-02-22 2461 b a a a @ % ' " a
2003-03-22 2161 c asdf
2003-03-22 2161 c asdf
2003-0
4
-22 2416 a bbbbb
2003-0
3
-22 2416 a bbbbb
show master status;
show master status;
File Position Binlog_do_db Binlog_ignore_db
File Position Binlog_do_db Binlog_ignore_db
slave-bin.001 964
slave-bin.001 964
...
@@ -55,3 +55,14 @@ reset slave;
...
@@ -55,3 +55,14 @@ reset slave;
show slave status;
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4
127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4
reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day));
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
Duplicate entry '2003-03-22' for key 1
show master status;
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 491
drop table t2;
mysql-test/std_data/rpl_loaddata2.dat
View file @
c5242d2f
...
@@ -4,5 +4,5 @@
...
@@ -4,5 +4,5 @@
##
##
>2003-03-22,2161,%c%,%asdf%
>2003-03-22,2161,%c%,%asdf%
##
##
>2003-0
4
-22,2416,%a%,%bbbbb%
>2003-0
3
-22,2416,%a%,%bbbbb%
##
##
mysql-test/t/rpl_loaddata.test
View file @
c5242d2f
...
@@ -112,3 +112,18 @@ stop slave;
...
@@ -112,3 +112,18 @@ stop slave;
reset
slave
;
reset
slave
;
--
replace_result
$MASTER_MYPORT
MASTER_PORT
--
replace_result
$MASTER_MYPORT
MASTER_PORT
show
slave
status
;
show
slave
status
;
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
connection
master
;
reset
master
;
create
table
t2
(
day
date
,
id
int
(
9
),
category
enum
(
'a'
,
'b'
,
'c'
),
name
varchar
(
60
),
unique
(
day
));
--
error
1062
;
load
data
infile
'../../std_data/rpl_loaddata2.dat'
into
table
t2
fields
terminated
by
','
optionally
enclosed
by
'%'
escaped
by
'@'
lines
terminated
by
'\n##\n'
starting
by
'>'
ignore
1
lines
;
# To test that there is Create_file & Delete_file, we test if the binlog is as
# long as expected (can't do SHOW BINLOG EVENTS because of varying file_id).
show
master
status
;
drop
table
t2
;
sql/sql_load.cc
View file @
c5242d2f
...
@@ -281,14 +281,14 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -281,14 +281,14 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if
(
transactional_table
)
if
(
transactional_table
)
ha_autocommit_or_rollback
(
thd
,
error
);
ha_autocommit_or_rollback
(
thd
,
error
);
if
(
!
opt_old_rpl_compat
&&
mysql_bin_log
.
is_open
())
if
(
!
opt_old_rpl_compat
&&
mysql_bin_log
.
is_open
())
{
if
(
lf_info
.
wrote_create_file
)
{
{
/*
/*
Make sure last block (the one which caused the error) gets logged.
Make sure last block (the one which caused the error) gets logged.
This is needed because otherwise after write of
This is needed because otherwise after write of
(to the binlog, not to read_info (which is a cache))
(to the binlog, not to read_info (which is a cache))
Delete_file_log_event the bad block will remain in read_info.
Delete_file_log_event the bad block will remain in read_info (because
pre_read is not called at the end of the last block; remember pre_read
is called whenever a new block is read from disk).
At the end of mysql_load(), the destructor of read_info will call
At the end of mysql_load(), the destructor of read_info will call
end_io_cache() which will flush read_info, so we will finally have
end_io_cache() which will flush read_info, so we will finally have
this in the binlog:
this in the binlog:
...
@@ -296,8 +296,17 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -296,8 +296,17 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
Delete_file
Delete_file
Append_block # The failing block
Append_block # The failing block
which is nonsense.
which is nonsense.
Or could also be (for a small file)
Create_file # The failing block
which is nonsense (Delete_file is not written in this case, because:
Create_file has not been written, so Delete_file is not written, then
when read_info is destroyed end_io_cache() is called which writes
Create_file.
*/
*/
read_info
.
end_io_cache
();
read_info
.
end_io_cache
();
/* If the file was not empty, wrote_create_file is true */
if
(
lf_info
.
wrote_create_file
)
{
Delete_file_log_event
d
(
thd
,
db
,
log_delayed
);
Delete_file_log_event
d
(
thd
,
db
,
log_delayed
);
mysql_bin_log
.
write
(
&
d
);
mysql_bin_log
.
write
(
&
d
);
}
}
...
@@ -327,7 +336,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -327,7 +336,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
}
}
else
else
{
{
read_info
.
end_io_cache
();
// make sure last block gets logged
read_info
.
end_io_cache
();
if
(
lf_info
.
wrote_create_file
)
if
(
lf_info
.
wrote_create_file
)
{
{
Execute_load_log_event
e
(
thd
,
db
,
log_delayed
);
Execute_load_log_event
e
(
thd
,
db
,
log_delayed
);
...
...
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