diff --git a/mysql-test/suite/rpl/r/rpl_slave_status.result b/mysql-test/suite/rpl/r/rpl_slave_status.result index be978362c81eb8081edc3bf54504460e99951667..6257c8fb5b819d97747032b2bfb2067d7c676164 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_status.result +++ b/mysql-test/suite/rpl/r/rpl_slave_status.result @@ -5,6 +5,18 @@ include/master-slave.inc GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl'; [on slave] include/stop_slave.inc +set @save_relay_log_purge=@@global.relay_log_purge; +set @@global.relay_log_purge=0; +CHANGE MASTER TO master_user='rpl', master_password='rpl'; +select @@global.relay_log_purge; +@@global.relay_log_purge +0 +set @@global.relay_log_purge=1; +CHANGE MASTER TO master_user='rpl', master_password='rpl'; +select @@global.relay_log_purge; +@@global.relay_log_purge +1 +set @@global.relay_log_purge=@save_relay_log_purge; CHANGE MASTER TO master_user='rpl', master_password='rpl'; include/start_slave.inc ==== Do replication as new user ==== diff --git a/mysql-test/suite/rpl/t/rpl_slave_status.test b/mysql-test/suite/rpl/t/rpl_slave_status.test index d9da40d9d3f5df81576db59034fe82f2407f86dd..fc82b3f8df67719911491c83c7270e7bbad2988f 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_status.test +++ b/mysql-test/suite/rpl/t/rpl_slave_status.test @@ -2,7 +2,7 @@ # # Verify that a slave without replication privileges has # Slave_IO_Running = No -# +# Check that relay_log_status doesn't change by CHANGE MASTER # ==== Method ==== # # We do the following steps: @@ -28,6 +28,17 @@ GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl'; --echo [on slave] sync_slave_with_master; source include/stop_slave.inc; + +# Test that relay_log_purge doesn't change because of CHANGE MASTER +set @save_relay_log_purge=@@global.relay_log_purge; +set @@global.relay_log_purge=0; +CHANGE MASTER TO master_user='rpl', master_password='rpl'; +select @@global.relay_log_purge; +set @@global.relay_log_purge=1; +CHANGE MASTER TO master_user='rpl', master_password='rpl'; +select @@global.relay_log_purge; +set @@global.relay_log_purge=@save_relay_log_purge; + CHANGE MASTER TO master_user='rpl', master_password='rpl'; source include/start_slave.inc; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 717201d5dcc48ccbe5b04fb0bbbfa5450a26ceb7..b2b111dadc379b46c92d0bcfbffc65ed31e4bac3 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -3444,7 +3444,6 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added) } if (need_relay_log_purge) { - relay_log_purge= 1; THD_STAGE_INFO(thd, stage_purging_old_relay_logs); if (purge_relay_logs(&mi->rli, thd, 0 /* not only reset, but also reinit */, @@ -3458,7 +3457,6 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added) else { const char* msg; - relay_log_purge= 0; /* Relay log is already initialized */ if (init_relay_log_pos(&mi->rli, mi->rli.group_relay_log_name,