mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
2 bugfixes:
- 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.
This commit is contained in:
@ -6,6 +6,9 @@
|
||||
#
|
||||
# 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;
|
||||
|
||||
@ -44,3 +47,53 @@ 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;
|
||||
|
Reference in New Issue
Block a user