1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-4688: empty @@gtid_slave_pos during slave commit.

In record_gtid(), too many rows were deleted from the slave position
hash - we need to always keep on to the most recent committed row,
so we have a valid slave position at all times.
This commit is contained in:
unknown
2013-06-21 11:53:46 +02:00
parent 03fb90f3a7
commit 6e7d7f9bcd
4 changed files with 121 additions and 28 deletions

View File

@ -114,10 +114,41 @@ START SLAVE;
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY a;
--echo *** MDEV-4688: Empty value of @@GLOBAL.gtid_slave_pos ***
# The problem was that record_gtid() deleted too much of the in-memory state,
# leaving the state empty until after commit when we add the newly committed
# GTID. Test this by forcing an error after the delete of the old data but
# before the add of new data.
--source include/stop_slave.inc
--connection master
# This will be GTID 0-1-3
INSERT INTO t1 VALUES (5);
--connection slave
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,dummy_disable_default_dbug_output";
SET GLOBAL debug_dbug="+d,gtid_fail_after_record_gtid";
SET sql_log_bin=0;
CALL mtr.add_suppression('Got error 131 "Command not supported by database" during COMMIT');
SET sql_log_bin=1;
START SLAVE;
--let $slave_sql_errno= 1180
--source include/wait_for_slave_sql_error.inc
# The bug was that @@GLOBAL.gtid_slave_pos was empty here.
SELECT @@GLOBAL.gtid_slave_pos;
SELECT * FROM t1 ORDER BY a;
SET GLOBAL debug_dbug= @old_dbug;
START SLAVE SQL_THREAD;
--let $wait_condition= SELECT COUNT(*) = 5 FROM t1
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY a;
--echo *** Test slave requesting a GTID that is not present in the master's binlog ***
--source include/stop_slave.inc
SET GLOBAL gtid_slave_pos = "0-1-3";
SET GLOBAL gtid_slave_pos = "0-1-4";
START SLAVE;
SET sql_log_bin=0;
@ -130,15 +161,15 @@ SET sql_log_bin=1;
--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
SET GLOBAL gtid_slave_pos = "0-1-2";
SET GLOBAL gtid_slave_pos = "0-1-3";
START SLAVE;
--source include/wait_for_slave_to_start.inc
--connection master
INSERT INTO t1 VALUES (5);
INSERT INTO t1 VALUES (6);
--connection slave
--let $wait_condition= SELECT COUNT(*) = 5 FROM t1
--let $wait_condition= SELECT COUNT(*) = 6 FROM t1
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY a;
@ -159,7 +190,7 @@ START SLAVE;
--connection master
SET GLOBAL debug_dbug= @old_dbug;
INSERT INTO t1 VALUES (6);
INSERT INTO t1 VALUES (7);
--save_master_pos
--connection slave