mariadb/mysql-test/t/rpl_loaddata.test
unknown bc8f801bf0 Don't show Slave_IO_State in the testsuite (replace it with #) because it can't be predicted.
I manually edited rpl_openssl.result because the test is skipped on my
machine. Hope it's correct.


mysql-test/r/rpl000015.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/r/rpl_error_ignored_table.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/r/rpl_flush_log_loop.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/r/rpl_loaddata.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/r/rpl_log.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/r/rpl_log_pos.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/r/rpl_max_relay_size.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/r/rpl_openssl.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/r/rpl_replicate_do.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/r/rpl_reset_slave.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/r/rpl_rotate_logs.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/r/rpl_trunc_binlog.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/r/rpl_until.result:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl000015.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_empty_master_crash.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_error_ignored_table.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_flush_log_loop.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_loaddata.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_log.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_log_pos.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_max_relay_size.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_openssl.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_redirect.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_replicate_do.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_reset_slave.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_rotate_logs.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_trunc_binlog.test:
  Don't show Slave_IO_State because it can't be predicted.
mysql-test/t/rpl_until.test:
  Don't show Slave_IO_State because it can't be predicted.
2003-10-09 18:16:15 +02:00

133 lines
4.1 KiB
Text

# 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;
connection slave;
reset master;
connection master;
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
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;
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;
# We want to be sure that LOAD DATA is in the slave's binlog.
# But we can't simply read this binlog, because as the slave has not been
# restarted for this test, the file_id is uncertain (would cause test
# failures). So instead, we test if the binlog looks long enough to
# contain LOAD DATA. That is, I (Guilhem) have done SHOW BINLOG EVENTS on my
# machine, saw that the binlog is of size 964 when things go fine.
# If LOAD DATA was not logged, the binlog would be shorter.
show master status;
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/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
wait_for_slave_to_stop;
# 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 # 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/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
wait_for_slave_to_stop;
# 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 # 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/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
wait_for_slave_to_stop;
# 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 # 33 #
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;