Skip to content

Commit add6a05

Browse files
committed
MDEV-7611: create multi_source.mariadb-dump_slave
Create a Multi-Source Replication test for these `mariadb-dump --dump-slave` bugs: * MDEV-7611 (not fixed as of this commit) * MDEV-5624 (fixed a long time ago) Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
1 parent 7d7898a commit add6a05

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
connect active_master, 127.0.0.1, root, , , $SERVER_MYPORT_2;
2+
connect inactive_master, 127.0.0.1, root, , , $SERVER_MYPORT_3;
3+
connect slave, 127.0.0.1, root, , , $SERVER_MYPORT_1;
4+
CHANGE MASTER TO
5+
master_host='127.0.0.1', master_port=MYPORT_2, master_user='root';
6+
START SLAVE SQL_THREAD;
7+
CHANGE MASTER 'inactive' TO
8+
master_host='127.0.0.1', master_port=MYPORT_3;
9+
include/wait_for_slave_sql_to_start.inc
10+
# Control State
11+
Connection_name = ''
12+
Connection_name = 'inactive'
13+
Slave_IO_Running = 'No'
14+
Slave_IO_Running = 'No'
15+
Slave_SQL_Running = 'Yes'
16+
Slave_SQL_Running = 'No'
17+
# Basic
18+
$MYSQL_DUMP --compact --dump-slave --include-master-host-port test
19+
/*M!999999\- enable the sandbox mode */
20+
CHANGE MASTER '' TO MASTER_HOST='127.0.0.1', MASTER_PORT=MYPORT_2, MASTER_LOG_FILE='', MASTER_LOG_POS=4;
21+
CHANGE MASTER 'inactive' TO MASTER_HOST='127.0.0.1', MASTER_PORT=MYPORT_3, MASTER_LOG_FILE='', MASTER_LOG_POS=0;
22+
23+
-- SET GLOBAL gtid_slave_pos='';
24+
# MDEV-7611 mysqldump --dump-slave always starts stopped slave
25+
$MYSQL_DUMP --compact --dump-slave test
26+
/*M!999999\- enable the sandbox mode */
27+
CHANGE MASTER '' TO MASTER_LOG_FILE='', MASTER_LOG_POS=4;
28+
CHANGE MASTER 'inactive' TO MASTER_LOG_FILE='', MASTER_LOG_POS=0;
29+
30+
-- SET GLOBAL gtid_slave_pos='';
31+
include/wait_for_slave_sql_to_start.inc
32+
Connection_name = ''
33+
Connection_name = 'inactive'
34+
Slave_IO_Running = 'No'
35+
Slave_IO_Running = 'No'
36+
Slave_SQL_Running = 'Yes'
37+
Slave_SQL_Running = 'No'
38+
# MDEV-5624 mysqldump --dump-slave option does not restart the replication if the dump has failed
39+
$MYSQL_DUMP --compact --dump-slave no_such_db
40+
/*M!999999\- enable the sandbox mode */
41+
CHANGE MASTER '' TO MASTER_LOG_FILE='', MASTER_LOG_POS=4;
42+
CHANGE MASTER 'inactive' TO MASTER_LOG_FILE='', MASTER_LOG_POS=0;
43+
44+
include/wait_for_slave_sql_to_start.inc
45+
Connection_name = ''
46+
Connection_name = 'inactive'
47+
Slave_IO_Running = 'No'
48+
Slave_IO_Running = 'No'
49+
Slave_SQL_Running = 'Yes'
50+
Slave_SQL_Running = 'No'
51+
# Cleanup
52+
STOP SLAVE SQL_THREAD;
53+
disconnect active_master;
54+
disconnect inactive_master;
55+
include/wait_for_slave_sql_to_stop.inc
56+
disconnect slave;
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# `mariadb-dump --dump-slave` multi-source interactions
2+
# (see `main.rpl_mysqldump_slave` for general testing with single-source)
3+
4+
--source include/have_log_bin.inc
5+
--let $status_items= Connection_name, Slave_IO_Running, Slave_SQL_Running
6+
--let $all_slaves_status= 1
7+
8+
# $MYSQL_DUMP dumps the $SERVER_MYPORT_1 server
9+
--connect ( active_master, 127.0.0.1, root, , , $SERVER_MYPORT_2)
10+
--connect (inactive_master, 127.0.0.1, root, , , $SERVER_MYPORT_3)
11+
--connect ( slave, 127.0.0.1, root, , , $SERVER_MYPORT_1)
12+
13+
--replace_result $SERVER_MYPORT_2 MYPORT_2
14+
eval CHANGE MASTER TO
15+
master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, master_user='root';
16+
START SLAVE SQL_THREAD;
17+
--replace_result $SERVER_MYPORT_3 MYPORT_3
18+
eval CHANGE MASTER 'inactive' TO
19+
master_host='127.0.0.1', master_port=$SERVER_MYPORT_3;
20+
# wait for the active default '' connection only
21+
--source include/wait_for_slave_sql_to_start.inc
22+
23+
24+
--echo # Control State
25+
--source include/show_slave_status.inc
26+
27+
--echo # Basic
28+
--echo \$MYSQL_DUMP --compact --dump-slave --include-master-host-port test
29+
--replace_result $SERVER_MYPORT_2 MYPORT_2 $SERVER_MYPORT_3 MYPORT_3
30+
--exec $MYSQL_DUMP --compact --dump-slave --include-master-host-port test
31+
32+
33+
# The 'inactive' connection should remain stopped
34+
# while the active '' connection should restart.
35+
36+
--echo # MDEV-7611 mysqldump --dump-slave always starts stopped slave
37+
--echo \$MYSQL_DUMP --compact --dump-slave test
38+
--exec $MYSQL_DUMP --compact --dump-slave test
39+
--source include/wait_for_slave_sql_to_start.inc
40+
--source include/show_slave_status.inc
41+
42+
--echo # MDEV-5624 mysqldump --dump-slave option does not restart the replication if the dump has failed
43+
--echo \$MYSQL_DUMP --compact --dump-slave no_such_db
44+
--error 2
45+
--exec $MYSQL_DUMP --compact --dump-slave no_such_db
46+
--source include/wait_for_slave_sql_to_start.inc
47+
--source include/show_slave_status.inc
48+
49+
50+
--echo # Cleanup
51+
STOP SLAVE SQL_THREAD;
52+
--disconnect active_master
53+
--disconnect inactive_master
54+
--source include/wait_for_slave_sql_to_stop.inc
55+
--disconnect slave

0 commit comments

Comments
 (0)