summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2014-01-14 19:00:38 +0100
committerMichael Widenius <monty@askmonty.org>2014-01-14 19:00:38 +0100
commit0a20d762af01ec835c9c4e6d02b77b9defad8647 (patch)
treefd0fe7bf3c35d8367491ed8a960be64dfa2c958e
parent2ddbe0ec816136ce17a32d7bd14d85eb9bda8078 (diff)
downloadmariadb-git-0a20d762af01ec835c9c4e6d02b77b9defad8647.tar.gz
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
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_status.result12
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_status.test13
-rw-r--r--sql/sql_repl.cc2
3 files changed, 24 insertions, 3 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_slave_status.result b/mysql-test/suite/rpl/r/rpl_slave_status.result
index be978362c81..6257c8fb5b8 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 d9da40d9d3f..fc82b3f8df6 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 717201d5dcc..b2b111dadc3 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,