1
# Requires statement logging
2
-- source include/have_binlog_format_mixed_or_statement.inc
4
# See if replication of a "LOAD DATA in an autoincrement column"
5
# Honours autoincrement values
6
# i.e. if the master and slave have the same sequence
8
# check replication of load data for temporary tables with additional
11
# check if duplicate entries trigger an error (they should unless IGNORE or
12
# REPLACE was used on the master) (bug 571).
14
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
15
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
17
-- source include/master-slave.inc
18
source include/have_innodb.inc;
24
select last_insert_id();
25
create table t1(a int not null auto_increment, b int, primary key(a) );
26
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
27
# verify that LAST_INSERT_ID() is set by LOAD DATA INFILE
28
select last_insert_id();
30
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
31
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
33
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
34
insert into t3 select * from t2;
48
create table t1(a int, b int, unique(b));
54
# See if slave stops when there's a duplicate entry for key error in LOAD DATA
56
insert into t1 values(1,10);
59
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
63
# The SQL slave thread should be stopped now.
64
--source include/wait_for_slave_sql_to_stop.inc
66
# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START
67
# SLAVE, even though we are not executing any event (as sql_slave_skip_counter
68
# takes us directly to the end of the relay log).
70
set global sql_slave_skip_counter=1;
73
--replace_result $MASTER_MYPORT MASTER_PORT
74
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
75
--query_vertical show slave status;
77
# Trigger error again to test CHANGE MASTER
83
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
86
# The SQL slave thread should be stopped now.
87
# Exec_Master_Log_Pos should point to the start of Execute event
89
--source include/wait_for_slave_sql_to_stop.inc
91
# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS.
93
change master to master_user='test';
94
change master to master_user='root';
95
--replace_result $MASTER_MYPORT MASTER_PORT
96
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
97
--query_vertical show slave status;
99
# Trigger error again to test RESET SLAVE
101
set global sql_slave_skip_counter=1;
108
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
111
# The SQL slave thread should be stopped now.
112
--source include/wait_for_slave_sql_to_stop.inc
114
# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
117
--replace_result $MASTER_MYPORT MASTER_PORT
118
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
119
--query_vertical show slave status;
121
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
125
eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
126
unique(day)) engine=$engine_type; # no transactions
128
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
129
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
130
'\n##\n' starting by '>' ignore 1 lines;
138
# verify that if no error on slave, this is an error
140
alter table t2 drop key day;
144
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
145
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
146
'\n##\n' starting by '>' ignore 1 lines;
148
--source include/wait_for_slave_sql_to_stop.inc
154
# BUG#17233 LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed
155
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
158
LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1;
161
DROP TABLE IF EXISTS t1;