mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 21:42:35 +01:00
d8df84aa43
- Bug #985: "Between RESET SLAVE and START SLAVE, SHOW SLAVE STATUS is wrong." Now RESET SLAVE puts correct info in mi->host etc. A new test rpl_reset_slave for that. - Bug #986: "CHANGE MASTER & START SLAVE do not reset error columns in SHOW SLAVE STATUS". Now these reset the errors. mysql-test/r/rpl_loaddata.result: result update. mysql-test/t/rpl_loaddata.test: Test that RESET SLAVE, START SLAVE and CHANGE MASTER all reset Last_slave_error and Last_slave_errno (columns of SHOW SLAVE STATUS). We do it in this test because that's one of tests which have an intentional query error on the slave. sql/slave.cc: As we need TWICE the code to copy command-line options (--master-host etc) to mi (we already had it in init_master_info, but we also need it in RESET SLAVE to fix bug#985), I make a function of this code. And a function to reset Last_slave_error and Last_slave_errno (we need it in CHANGE MASTER, RESET SLAVE, and at the start of the SQL thread). sql/slave.h: declarations for new functions. sql/sql_repl.cc: copy --master-host etc to mi in RESET SLAVE, so that SHOW SLAVE STATUS shows correct information.
99 lines
2.9 KiB
Text
99 lines
2.9 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;
|
|
|
|
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;
|
|
|
|
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;
|
|
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
|
|
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
|
|
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
|
|
show slave status;
|