mariadb/mysql-test/main/rpl_mysqldump_slave.result

69 lines
2.1 KiB
Text
Raw Normal View History

include/master-slave.inc
[connection master]
BUG #8368 "mysqldump needs --slave-data option" Added this option, named as "--dump-slave". The purpose of this option is to be able to produce a dump from a slave used for making backups of the master. Originally, dumping from the main master was fine, but as more data accumulated, the dump process would take over 30 minutes, locking up the master database hence website for 30 minutes. A slave dedicated to producing backups was the answer, but I needed a dump that could be used to restore a slave instantly and in order to do that, it has to have three things contained in the dump: 1. "STOP SLAVE;" at the beginning 2. "CHANGE MASTER TO ...<the master - info from 'show slave status'>" 3. "START SLAVE;" at the end These options in this changeset contain this. --stop-slave adds "STOP SLAVE" to the beginning of the dump and "STOP SLAVE" to the end of the dump. --include-host gives the user the option to have the host explicitely added to the "CHANGE MASTER TO ..." line. --dump-slave adds the "CHANGE MASTER ..." to the dump representing not the slave's master binlog info, but the slave's master's info from "SHOW SLAVE STATUS" client/client_priv.h: Added OPT_SLAVE_DATA to client_priv.h client/mysqldump.c: * Added --dump-slave option (name per Brian) * Added --stop-slave to print "STOP SLAVE;" into the dump * Added --include-host option to include "MASTER_HOST=..." and "MASTER_PORT=..." to the dump since unlike --master-data, the host can't be assumed to be the local host * Added do_start_slave and do_stop_slave to stop the slave sql thread upon start of the dump process, and to start the slave sql upon finish of dump process - to keep the log information frozen during this time. * Added do_show_slave_status for obtaining slave information needed to compose "CHANGE MASTER ..." output to the master of this slave. * Added necessary long options and defines required for new options
2009-11-04 14:31:03 +01:00
#
# New --dump-slave, --apply-slave-statements functionality
#
connection slave;
connection master;
BUG #8368 "mysqldump needs --slave-data option" Added this option, named as "--dump-slave". The purpose of this option is to be able to produce a dump from a slave used for making backups of the master. Originally, dumping from the main master was fine, but as more data accumulated, the dump process would take over 30 minutes, locking up the master database hence website for 30 minutes. A slave dedicated to producing backups was the answer, but I needed a dump that could be used to restore a slave instantly and in order to do that, it has to have three things contained in the dump: 1. "STOP SLAVE;" at the beginning 2. "CHANGE MASTER TO ...<the master - info from 'show slave status'>" 3. "START SLAVE;" at the end These options in this changeset contain this. --stop-slave adds "STOP SLAVE" to the beginning of the dump and "STOP SLAVE" to the end of the dump. --include-host gives the user the option to have the host explicitely added to the "CHANGE MASTER TO ..." line. --dump-slave adds the "CHANGE MASTER ..." to the dump representing not the slave's master binlog info, but the slave's master's info from "SHOW SLAVE STATUS" client/client_priv.h: Added OPT_SLAVE_DATA to client_priv.h client/mysqldump.c: * Added --dump-slave option (name per Brian) * Added --stop-slave to print "STOP SLAVE;" into the dump * Added --include-host option to include "MASTER_HOST=..." and "MASTER_PORT=..." to the dump since unlike --master-data, the host can't be assumed to be the local host * Added do_start_slave and do_stop_slave to stop the slave sql thread upon start of the dump process, and to start the slave sql upon finish of dump process - to keep the log information frozen during this time. * Added do_show_slave_status for obtaining slave information needed to compose "CHANGE MASTER ..." output to the master of this slave. * Added necessary long options and defines required for new options
2009-11-04 14:31:03 +01:00
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;
2014-02-26 15:28:07 +01:00
start slave;
Warnings:
Note 1254 Slave is already running
-- SET GLOBAL gtid_slave_pos='';
2014-02-26 15:28:07 +01:00
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';
include/rpl_end.inc