diff options
author | unknown <knielsen@knielsen-hq.org> | 2013-03-27 12:29:02 +0100 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2013-03-27 12:29:02 +0100 |
commit | cb65cee82a192e8e0fa77dcc7d49cec0d5334ba0 (patch) | |
tree | 430cdc13c10e67204f8e4c708b52202428e9e910 /mysql-test | |
parent | e5b60f0add3a05ebe617d5d8ccef22f8e6a16d07 (diff) | |
download | mariadb-git-cb65cee82a192e8e0fa77dcc7d49cec0d5334ba0.tar.gz |
MDEV-26: Global transaction ID.
When slave requested to start at some GTID, and that GTID was the very
last event (within its replication domain) in some binlog file, we did
not allow the binlog dump thread on the master to start from the
beginning of a following binlog file. This is a problem, since the
binlog file containing the GTID is likely to be purged if the
replication domain is unused for long.
With this fix, if the Gtid list event at the start of a binlog file
contains exactly the GTID requested by the slave, we allow to start
the binlog dump thread from this file, taking care not to skip any
events from that domain in the file.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_gtid_startpos.result | 20 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_gtid_startpos.test | 28 |
2 files changed, 48 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result index a4b67ccfe67..2428897345e 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result @@ -129,5 +129,25 @@ a SET SQL_LOG_BIN=0; call mtr.add_suppression("Slave: Table 't1' already exists Error_code: 1050"); SET SQL_LOG_BIN=1; +*** Test reconnecting slave with GTID after purge logs on master. *** +FLUSH LOGS; +INSERT INTO t1 VALUES (4); +include/stop_slave.inc +FLUSH LOGS; +FLUSH LOGS; +PURGE BINARY LOGS TO 'master-bin.000004'; +show binary logs; +Log_name File_size +master-bin.000004 # +INSERT INTO t1 VALUES (5); +CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT; +include/start_slave.inc +SELECT * FROM t1 ORDER BY a; +a +1 +2 +3 +4 +5 DROP TABLE t1; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test index 2e3cd306961..9c77e45ffd6 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test @@ -211,6 +211,34 @@ call mtr.add_suppression("Slave: Table 't1' already exists Error_code: 1050"); SET SQL_LOG_BIN=1; +--echo *** Test reconnecting slave with GTID after purge logs on master. *** + +--connection server_1 +FLUSH LOGS; +INSERT INTO t1 VALUES (4); + +--connection server_2 +--let $wait_condition= SELECT COUNT(*) = 4 FROM t1 +--source include/wait_condition.inc +--source include/stop_slave.inc + +--connection server_1 +FLUSH LOGS; +FLUSH LOGS; +--source include/wait_for_binlog_checkpoint.inc +PURGE BINARY LOGS TO 'master-bin.000004'; +--source include/show_binary_logs.inc +INSERT INTO t1 VALUES (5); + +--connection server_2 +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT; +--source include/start_slave.inc +--let $wait_condition= SELECT COUNT(*) = 5 FROM t1 +--source include/wait_condition.inc +SELECT * FROM t1 ORDER BY a; + + # Clean up. --connection server_1 DROP TABLE t1; |