mariadb/mysql-test/extra/rpl_tests/rpl_loaddata.test
unknown 4597814717 Post-merge fixes.
mysql-test/extra/rpl_tests/rpl_loaddata.test:
  Removing SHOW MASTER STATUS that does not seem to make sense.
mysql-test/extra/rpl_tests/rpl_log.test:
  Correcting test case to sync slave with master.
mysql-test/suite/binlog/r/binlog_unsafe.result:
  Result change.
mysql-test/suite/binlog/t/binlog_unsafe.test:
  Removing unsafe variable from list of safe variables.
mysql-test/suite/rpl/r/rpl_loaddata.result:
  Result change.
mysql-test/suite/rpl/r/rpl_skip_error.result:
  Result change.
mysql-test/suite/rpl/t/rpl_skip_error.test:
  Correcting bad manual+automatic merge. Test is now only relevant for statement-
  based replication.
sql/rpl_rli.cc:
  Correcting automerge undoing previous change of return value.
  Relay_log_info::wait_for_pos() should return -2 when not initialized to work
  correctly.
2008-03-14 17:52:57 +01:00

164 lines
4.8 KiB
Text

# Requires statement logging
-- source include/have_binlog_format_mixed_or_statement.inc
# See if replication of a "LOAD DATA in an autoincrement column"
# Honours autoincrement values
# i.e. if the master and slave have the same sequence
#
# check replication of load data for temporary tables with additional
# parameters
#
# check if duplicate entries trigger an error (they should unless IGNORE or
# REPLACE was used on the master) (bug 571).
#
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
-- source include/master-slave.inc
source include/have_innodb.inc;
connection slave;
reset master;
connection master;
select last_insert_id();
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
# verify that LAST_INSERT_ID() is set by LOAD DATA INFILE
select last_insert_id();
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
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;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t3;
connection master;
drop table t1;
drop table t2;
drop table t3;
create table t1(a int, b int, unique(b));
save_master_pos;
connection slave;
sync_with_master;
# See if slave stops when there's a duplicate entry for key error in LOAD DATA
insert into t1 values(1,10);
connection master;
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
--source include/wait_for_slave_sql_to_stop.inc
# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START
# SLAVE, even though we are not executing any event (as sql_slave_skip_counter
# takes us directly to the end of the relay log).
set global sql_slave_skip_counter=1;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# Trigger error again to test CHANGE MASTER
connection master;
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
# Exec_Master_Log_Pos should point to the start of Execute event
# for last load data.
--source include/wait_for_slave_sql_to_stop.inc
# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS.
stop slave;
change master to master_user='test';
change master to master_user='root';
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# Trigger error again to test RESET SLAVE
set global sql_slave_skip_counter=1;
start slave;
sync_with_master;
connection master;
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
--source include/wait_for_slave_sql_to_stop.inc
# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
stop slave;
reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
connection master;
reset master;
eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=$engine_type; # no transactions
--error ER_DUP_ENTRY
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;
select * from t2;
save_master_pos;
connection slave;
start slave;
sync_with_master;
select * from t2;
# verify that if no error on slave, this is an error
alter table t2 drop key day;
connection master;
delete from t2;
--error ER_DUP_ENTRY
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;
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
drop table t2;
connection master;
drop table t2;
drop table t1;
# BUG#17233 LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
--error ER_DUP_ENTRY
LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
# End of 4.1 tests