mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-26: Global transaction ID.
Fix MDEV-4329. When user does CHANGE MASTER TO MASTER_GTID_POS='<explicit GTID state>', we check that this state does not conflict with the binlog. But the code forgot to give an error in the case where a domain was completely missing from the requested position (eg. MASTER_GTID_POS='').
This commit is contained in:
@@ -40,6 +40,8 @@ SET sql_log_bin = 1;
|
|||||||
INSERT INTO t1 VALUES (3);
|
INSERT INTO t1 VALUES (3);
|
||||||
CHANGE MASTER TO master_gtid_pos = "0-1-1";
|
CHANGE MASTER TO master_gtid_pos = "0-1-1";
|
||||||
ERROR HY000: Requested MASTER_GTID_POS 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-11. To use the requested MASTER_GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
|
ERROR HY000: Requested MASTER_GTID_POS 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-11. To use the requested MASTER_GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
|
||||||
|
CHANGE MASTER TO master_gtid_pos = "";
|
||||||
|
ERROR HY000: Requested MASTER_GTID_POS contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-11. To use the requested MASTER_GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
|
||||||
RESET MASTER;
|
RESET MASTER;
|
||||||
CHANGE MASTER TO master_gtid_pos = "0-1-1";
|
CHANGE MASTER TO master_gtid_pos = "0-1-1";
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
|
@@ -87,5 +87,29 @@ SELECT * FROM t1 ORDER BY a;
|
|||||||
a
|
a
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
|
*** MDEV-4329: MASTER_GTID_POS='' is not checked for conflicts with binlog ***
|
||||||
|
include/stop_slave.inc
|
||||||
|
DROP TABLE t1;
|
||||||
|
RESET SLAVE;
|
||||||
|
CHANGE MASTER TO master_gtid_pos='';
|
||||||
|
ERROR HY000: Requested MASTER_GTID_POS contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-4. To use the requested MASTER_GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
|
||||||
|
RESET MASTER;
|
||||||
|
CHANGE MASTER TO master_gtid_pos='';
|
||||||
|
include/start_slave.inc
|
||||||
|
SELECT * FROM t1 ORDER BY a;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
2
|
||||||
|
include/stop_slave.inc
|
||||||
|
SET SQL_LOG_BIN=0;
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET SQL_LOG_BIN=1;
|
||||||
|
RESET SLAVE;
|
||||||
|
CHANGE MASTER TO master_gtid_pos='';
|
||||||
|
include/start_slave.inc
|
||||||
|
SELECT * FROM t1 ORDER BY a;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
2
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
include/rpl_end.inc
|
include/rpl_end.inc
|
||||||
|
@@ -71,6 +71,8 @@ INSERT INTO t1 VALUES (3);
|
|||||||
|
|
||||||
--error ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG
|
--error ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG
|
||||||
CHANGE MASTER TO master_gtid_pos = "0-1-1";
|
CHANGE MASTER TO master_gtid_pos = "0-1-1";
|
||||||
|
--error ER_MASTER_GTID_POS_MISSING_DOMAIN
|
||||||
|
CHANGE MASTER TO master_gtid_pos = "";
|
||||||
RESET MASTER;
|
RESET MASTER;
|
||||||
CHANGE MASTER TO master_gtid_pos = "0-1-1";
|
CHANGE MASTER TO master_gtid_pos = "0-1-1";
|
||||||
|
|
||||||
|
@@ -143,6 +143,45 @@ INSERT INTO t1 VALUES (2);
|
|||||||
|
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
|
|
||||||
|
|
||||||
|
--echo *** MDEV-4329: MASTER_GTID_POS='' is not checked for conflicts with binlog ***
|
||||||
|
|
||||||
|
# Test starting the slave completely from scratch, deleting all tables and
|
||||||
|
# replicating from the start of the master's binlog. This requires RESET
|
||||||
|
# MASTER is run on the slave to avoid old junk in the binlog. The bug was
|
||||||
|
# that the code did not catch the error of missing RESET MASTER when an
|
||||||
|
# empty MASTER_GTID_POS='' was specified.
|
||||||
|
|
||||||
|
--connection server_2
|
||||||
|
--source include/stop_slave.inc
|
||||||
|
DROP TABLE t1;
|
||||||
|
RESET SLAVE;
|
||||||
|
--error ER_MASTER_GTID_POS_MISSING_DOMAIN
|
||||||
|
eval CHANGE MASTER TO master_gtid_pos='';
|
||||||
|
RESET MASTER;
|
||||||
|
eval CHANGE MASTER TO master_gtid_pos='';
|
||||||
|
|
||||||
|
--source include/start_slave.inc
|
||||||
|
--sync_with_master
|
||||||
|
SELECT * FROM t1 ORDER BY a;
|
||||||
|
|
||||||
|
|
||||||
|
# Same thing, but this time using SQL_LOG_BIN=0 to avoid polliting the
|
||||||
|
# slave binlog.
|
||||||
|
|
||||||
|
--connection server_2
|
||||||
|
--source include/stop_slave.inc
|
||||||
|
SET SQL_LOG_BIN=0;
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET SQL_LOG_BIN=1;
|
||||||
|
RESET SLAVE;
|
||||||
|
eval CHANGE MASTER TO master_gtid_pos='';
|
||||||
|
|
||||||
|
--source include/start_slave.inc
|
||||||
|
--sync_with_master
|
||||||
|
SELECT * FROM t1 ORDER BY a;
|
||||||
|
|
||||||
|
|
||||||
# Clean up.
|
# Clean up.
|
||||||
--connection server_1
|
--connection server_1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@@ -6617,3 +6617,5 @@ ER_CANNOT_LOAD_SLAVE_GTID_STATE
|
|||||||
eng "Failed to load replication slave GTID state from table %s.%s"
|
eng "Failed to load replication slave GTID state from table %s.%s"
|
||||||
ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG
|
ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG
|
||||||
eng "Requested MASTER_GTID_POS %u-%u-%llu conflicts with the binary log which contains a more recent GTID %u-%u-%llu. To use the requested MASTER_GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog"
|
eng "Requested MASTER_GTID_POS %u-%u-%llu conflicts with the binary log which contains a more recent GTID %u-%u-%llu. To use the requested MASTER_GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog"
|
||||||
|
ER_MASTER_GTID_POS_MISSING_DOMAIN
|
||||||
|
eng "Requested MASTER_GTID_POS contains no value for replication domain %u. This conflicts with the binary log which contains GTID %u-%u-%llu. To use the requested MASTER_GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog"
|
||||||
|
@@ -2533,7 +2533,12 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added)
|
|||||||
if (binlog_gtid->server_id != global_system_variables.server_id)
|
if (binlog_gtid->server_id != global_system_variables.server_id)
|
||||||
continue;
|
continue;
|
||||||
if (!(slave_gtid= tmp_slave_state.find(binlog_gtid->domain_id)))
|
if (!(slave_gtid= tmp_slave_state.find(binlog_gtid->domain_id)))
|
||||||
continue;
|
{
|
||||||
|
my_error(ER_MASTER_GTID_POS_MISSING_DOMAIN, MYF(0),
|
||||||
|
binlog_gtid->domain_id, binlog_gtid->domain_id,
|
||||||
|
binlog_gtid->server_id, binlog_gtid->seq_no);
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (slave_gtid->seq_no < binlog_gtid->seq_no)
|
if (slave_gtid->seq_no < binlog_gtid->seq_no)
|
||||||
{
|
{
|
||||||
my_error(ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG, MYF(0),
|
my_error(ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG, MYF(0),
|
||||||
|
Reference in New Issue
Block a user