summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/rpl_loaddata.result26
-rw-r--r--mysql-test/r/rpl_reset_slave.result22
-rw-r--r--mysql-test/t/rpl_loaddata.test53
-rw-r--r--mysql-test/t/rpl_reset_slave.test26
4 files changed, 127 insertions, 0 deletions
diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result
index b5154ca95cf..05bdad0fb84 100644
--- a/mysql-test/r/rpl_loaddata.result
+++ b/mysql-test/r/rpl_loaddata.result
@@ -25,3 +25,29 @@ drop table t3;
create table t1(a int, b int, unique(b));
insert into t1 values(1,10);
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
+set global sql_slave_skip_counter=1;
+start slave;
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+127.0.0.1 root MASTER_PORT 1 master-bin.001 1311 slave-relay-bin.002 1352 master-bin.001 Yes Yes 0 0 1311 1352
+set sql_log_bin=0;
+delete from t1;
+set sql_log_bin=1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
+stop slave;
+change master to master_user='test';
+change master to master_user='root';
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+127.0.0.1 root MASTER_PORT 1 master-bin.001 1442 slave-relay-bin.001 4 master-bin.001 No No 0 0 1442 4
+set global sql_slave_skip_counter=1;
+start slave;
+set sql_log_bin=0;
+delete from t1;
+set sql_log_bin=1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
+stop slave;
+reset slave;
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4
diff --git a/mysql-test/r/rpl_reset_slave.result b/mysql-test/r/rpl_reset_slave.result
new file mode 100644
index 00000000000..c1bc1e8e483
--- /dev/null
+++ b/mysql-test/r/rpl_reset_slave.result
@@ -0,0 +1,22 @@
+slave stop;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+slave start;
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120
+stop slave;
+change master to master_user='test';
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+127.0.0.1 test MASTER_PORT 1 master-bin.001 79 slave-relay-bin.001 4 master-bin.001 No No 0 0 79 4
+reset slave;
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4
+start slave;
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120
diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test
index 96a4eb3fb76..0a07dd7549b 100644
--- a/mysql-test/t/rpl_loaddata.test
+++ b/mysql-test/t/rpl_loaddata.test
@@ -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;
diff --git a/mysql-test/t/rpl_reset_slave.test b/mysql-test/t/rpl_reset_slave.test
new file mode 100644
index 00000000000..9c58ac0c787
--- /dev/null
+++ b/mysql-test/t/rpl_reset_slave.test
@@ -0,0 +1,26 @@
+# See SHOW SLAVE STATUS displays well after RESET SLAVE (it should display the
+# --master-* options from mysqld, as this is what is going to be used next time
+# slave threads will be started). In bug 985, it displayed old values (of before
+# RESET SLAVE).
+
+source include/master-slave.inc;
+connection master;
+save_master_pos;
+connection slave;
+sync_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+show slave status;
+
+stop slave;
+change master to master_user='test';
+--replace_result $MASTER_MYPORT MASTER_PORT
+show slave status;
+
+reset slave;
+--replace_result $MASTER_MYPORT MASTER_PORT
+show slave status;
+
+start slave;
+sync_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+show slave status;