Commit 0a20d762 authored by Michael Widenius's avatar Michael Widenius

Fix for MDEV-4117 @@global.relay_log_purge not per-master, conflicts between...

Fix for MDEV-4117 @@global.relay_log_purge not per-master, conflicts between different masters in multisource replication

The fix is to not change @relay_log_purge as part of the CHANGE MASTER.
(There is no logical reason why this is done in the current source)

mysql-test/suite/rpl/r/rpl_slave_status.result:
  Ensure that CHANGE MASTER doesn't change relay_log_purge
mysql-test/suite/rpl/t/rpl_slave_status.test:
  Ensure that CHANGE MASTER doesn't change relay_log_purge
sql/sql_repl.cc:
  Don't change relay_log_purge in CHANGE MASTER
parent 2ddbe0ec
......@@ -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 ====
......
......@@ -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;
......
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment