mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
9be7e03f70
Because --delete-master-logs immediately purges logs after flushing, it is possible the binlog dump thread would still be using the old log when the purge executes, disallowing the file from being deleted. This patch institutes a work-around in the test as follows: 1) temporarily stop the slave so there is no chance the old binlog is still being referenced. 2) set master_use_gtid=Slave_pos so the slave can still appear up-to-date on the master after the master flushes/purges its logs (while the slave is offline). Otherwise (i.e. if using binlog file/pos), the slave would point to a purged log file, and receive an error immediately upon connecting to the master. Reviewed By ============ Andrei Elkin <andrei.elkin@mariadb.com>
84 lines
2.6 KiB
Text
84 lines
2.6 KiB
Text
include/master-slave.inc
|
|
[connection master]
|
|
#
|
|
# New --dump-slave, --apply-slave-statements functionality
|
|
#
|
|
connection slave;
|
|
connection master;
|
|
use test;
|
|
connection slave;
|
|
-- SET GLOBAL gtid_slave_pos='';
|
|
CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
|
|
STOP ALL SLAVES;
|
|
-- SET GLOBAL gtid_slave_pos='';
|
|
CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
|
|
START ALL SLAVES;
|
|
STOP ALL SLAVES;
|
|
-- SET GLOBAL gtid_slave_pos='';
|
|
CHANGE MASTER '' TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT, MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
|
|
START ALL SLAVES;
|
|
start slave;
|
|
Warnings:
|
|
Note 1254 Slave is already running
|
|
-- SET GLOBAL gtid_slave_pos='';
|
|
CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
|
|
start slave;
|
|
Warnings:
|
|
Note 1254 Slave is already running
|
|
*** Test mysqldump --dump-slave GTID functionality.
|
|
connection master;
|
|
SET gtid_seq_no = 1000;
|
|
CREATE TABLE t1 (a INT PRIMARY KEY);
|
|
DROP TABLE t1;
|
|
connection slave;
|
|
connection slave;
|
|
CREATE TABLE t2 (a INT PRIMARY KEY);
|
|
DROP TABLE t2;
|
|
|
|
1. --dump-slave=1
|
|
|
|
SET GLOBAL gtid_slave_pos='0-1-1001';
|
|
CHANGE MASTER '' TO MASTER_USE_GTID=slave_pos;
|
|
-- CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
|
|
|
|
2. --dump-slave=2
|
|
|
|
-- SET GLOBAL gtid_slave_pos='0-1-1001';
|
|
-- CHANGE MASTER '' TO MASTER_USE_GTID=slave_pos;
|
|
-- CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
|
|
*** Test mysqldump --master-data GTID functionality.
|
|
|
|
1. --master-data=1
|
|
|
|
-- CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START;
|
|
CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
|
|
SET GLOBAL gtid_slave_pos='0-2-1003';
|
|
|
|
2. --master-data=2
|
|
|
|
-- CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START;
|
|
-- CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
|
|
-- SET GLOBAL gtid_slave_pos='0-2-1003';
|
|
|
|
3. --master-data --single-transaction
|
|
|
|
-- CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START;
|
|
CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
|
|
SET GLOBAL gtid_slave_pos='0-2-1003';
|
|
connection master;
|
|
CREATE TABLE t (
|
|
id int
|
|
);
|
|
insert into t values (1);
|
|
insert into t values (2);
|
|
drop table t;
|
|
connection slave;
|
|
include/stop_slave.inc
|
|
change master to master_use_gtid=slave_pos;
|
|
connection master;
|
|
# Ensuring the binlog dump thread is killed on primary...
|
|
-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000002', MASTER_LOG_POS=BINLOG_START;
|
|
-- SET GLOBAL gtid_slave_pos='0-1-1005';
|
|
connection slave;
|
|
include/start_slave.inc
|
|
include/rpl_end.inc
|