mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
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
This commit is contained in:
@@ -5,6 +5,18 @@ include/master-slave.inc
|
|||||||
GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl';
|
GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl';
|
||||||
[on slave]
|
[on slave]
|
||||||
include/stop_slave.inc
|
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';
|
CHANGE MASTER TO master_user='rpl', master_password='rpl';
|
||||||
include/start_slave.inc
|
include/start_slave.inc
|
||||||
==== Do replication as new user ====
|
==== Do replication as new user ====
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Verify that a slave without replication privileges has
|
# Verify that a slave without replication privileges has
|
||||||
# Slave_IO_Running = No
|
# Slave_IO_Running = No
|
||||||
#
|
# Check that relay_log_status doesn't change by CHANGE MASTER
|
||||||
# ==== Method ====
|
# ==== Method ====
|
||||||
#
|
#
|
||||||
# We do the following steps:
|
# 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]
|
--echo [on slave]
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
source include/stop_slave.inc;
|
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';
|
CHANGE MASTER TO master_user='rpl', master_password='rpl';
|
||||||
source include/start_slave.inc;
|
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)
|
if (need_relay_log_purge)
|
||||||
{
|
{
|
||||||
relay_log_purge= 1;
|
|
||||||
THD_STAGE_INFO(thd, stage_purging_old_relay_logs);
|
THD_STAGE_INFO(thd, stage_purging_old_relay_logs);
|
||||||
if (purge_relay_logs(&mi->rli, thd,
|
if (purge_relay_logs(&mi->rli, thd,
|
||||||
0 /* not only reset, but also reinit */,
|
0 /* not only reset, but also reinit */,
|
||||||
@@ -3458,7 +3457,6 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char* msg;
|
const char* msg;
|
||||||
relay_log_purge= 0;
|
|
||||||
/* Relay log is already initialized */
|
/* Relay log is already initialized */
|
||||||
if (init_relay_log_pos(&mi->rli,
|
if (init_relay_log_pos(&mi->rli,
|
||||||
mi->rli.group_relay_log_name,
|
mi->rli.group_relay_log_name,
|
||||||
|
Reference in New Issue
Block a user