From add6a0557f3b4e94b8f8fc4494c990e393f99bc5 Mon Sep 17 00:00:00 2001 From: ParadoxV5 Date: Tue, 8 Jul 2025 19:13:58 -0600 Subject: [PATCH] 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 --- .../multi_source/mariadb-dump_slave.result | 56 +++++++++++++++++++ .../multi_source/mariadb-dump_slave.test | 55 ++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 mysql-test/suite/multi_source/mariadb-dump_slave.result create mode 100644 mysql-test/suite/multi_source/mariadb-dump_slave.test diff --git a/mysql-test/suite/multi_source/mariadb-dump_slave.result b/mysql-test/suite/multi_source/mariadb-dump_slave.result new file mode 100644 index 00000000000..41fa0536bba --- /dev/null +++ b/mysql-test/suite/multi_source/mariadb-dump_slave.result @@ -0,0 +1,56 @@ +connect active_master, 127.0.0.1, root, , , $SERVER_MYPORT_2; +connect inactive_master, 127.0.0.1, root, , , $SERVER_MYPORT_3; +connect slave, 127.0.0.1, root, , , $SERVER_MYPORT_1; +CHANGE MASTER TO +master_host='127.0.0.1', master_port=MYPORT_2, master_user='root'; +START SLAVE SQL_THREAD; +CHANGE MASTER 'inactive' TO +master_host='127.0.0.1', master_port=MYPORT_3; +include/wait_for_slave_sql_to_start.inc +# Control State +Connection_name = '' +Connection_name = 'inactive' +Slave_IO_Running = 'No' +Slave_IO_Running = 'No' +Slave_SQL_Running = 'Yes' +Slave_SQL_Running = 'No' +# Basic +$MYSQL_DUMP --compact --dump-slave --include-master-host-port test +/*M!999999\- enable the sandbox mode */ +CHANGE MASTER '' TO MASTER_HOST='127.0.0.1', MASTER_PORT=MYPORT_2, MASTER_LOG_FILE='', MASTER_LOG_POS=4; +CHANGE MASTER 'inactive' TO MASTER_HOST='127.0.0.1', MASTER_PORT=MYPORT_3, MASTER_LOG_FILE='', MASTER_LOG_POS=0; + +-- SET GLOBAL gtid_slave_pos=''; +# MDEV-7611 mysqldump --dump-slave always starts stopped slave +$MYSQL_DUMP --compact --dump-slave test +/*M!999999\- enable the sandbox mode */ +CHANGE MASTER '' TO MASTER_LOG_FILE='', MASTER_LOG_POS=4; +CHANGE MASTER 'inactive' TO MASTER_LOG_FILE='', MASTER_LOG_POS=0; + +-- SET GLOBAL gtid_slave_pos=''; +include/wait_for_slave_sql_to_start.inc +Connection_name = '' +Connection_name = 'inactive' +Slave_IO_Running = 'No' +Slave_IO_Running = 'No' +Slave_SQL_Running = 'Yes' +Slave_SQL_Running = 'No' +# MDEV-5624 mysqldump --dump-slave option does not restart the replication if the dump has failed +$MYSQL_DUMP --compact --dump-slave no_such_db +/*M!999999\- enable the sandbox mode */ +CHANGE MASTER '' TO MASTER_LOG_FILE='', MASTER_LOG_POS=4; +CHANGE MASTER 'inactive' TO MASTER_LOG_FILE='', MASTER_LOG_POS=0; + +include/wait_for_slave_sql_to_start.inc +Connection_name = '' +Connection_name = 'inactive' +Slave_IO_Running = 'No' +Slave_IO_Running = 'No' +Slave_SQL_Running = 'Yes' +Slave_SQL_Running = 'No' +# Cleanup +STOP SLAVE SQL_THREAD; +disconnect active_master; +disconnect inactive_master; +include/wait_for_slave_sql_to_stop.inc +disconnect slave; diff --git a/mysql-test/suite/multi_source/mariadb-dump_slave.test b/mysql-test/suite/multi_source/mariadb-dump_slave.test new file mode 100644 index 00000000000..35cdb6887ec --- /dev/null +++ b/mysql-test/suite/multi_source/mariadb-dump_slave.test @@ -0,0 +1,55 @@ +# `mariadb-dump --dump-slave` multi-source interactions +# (see `main.rpl_mysqldump_slave` for general testing with single-source) + +--source include/have_log_bin.inc +--let $status_items= Connection_name, Slave_IO_Running, Slave_SQL_Running +--let $all_slaves_status= 1 + +# $MYSQL_DUMP dumps the $SERVER_MYPORT_1 server +--connect ( active_master, 127.0.0.1, root, , , $SERVER_MYPORT_2) +--connect (inactive_master, 127.0.0.1, root, , , $SERVER_MYPORT_3) +--connect ( slave, 127.0.0.1, root, , , $SERVER_MYPORT_1) + +--replace_result $SERVER_MYPORT_2 MYPORT_2 +eval CHANGE MASTER TO + master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, master_user='root'; +START SLAVE SQL_THREAD; +--replace_result $SERVER_MYPORT_3 MYPORT_3 +eval CHANGE MASTER 'inactive' TO + master_host='127.0.0.1', master_port=$SERVER_MYPORT_3; +# wait for the active default '' connection only +--source include/wait_for_slave_sql_to_start.inc + + +--echo # Control State +--source include/show_slave_status.inc + +--echo # Basic +--echo \$MYSQL_DUMP --compact --dump-slave --include-master-host-port test +--replace_result $SERVER_MYPORT_2 MYPORT_2 $SERVER_MYPORT_3 MYPORT_3 +--exec $MYSQL_DUMP --compact --dump-slave --include-master-host-port test + + +# The 'inactive' connection should remain stopped +# while the active '' connection should restart. + +--echo # MDEV-7611 mysqldump --dump-slave always starts stopped slave +--echo \$MYSQL_DUMP --compact --dump-slave test +--exec $MYSQL_DUMP --compact --dump-slave test +--source include/wait_for_slave_sql_to_start.inc +--source include/show_slave_status.inc + +--echo # MDEV-5624 mysqldump --dump-slave option does not restart the replication if the dump has failed +--echo \$MYSQL_DUMP --compact --dump-slave no_such_db +--error 2 +--exec $MYSQL_DUMP --compact --dump-slave no_such_db +--source include/wait_for_slave_sql_to_start.inc +--source include/show_slave_status.inc + + +--echo # Cleanup +STOP SLAVE SQL_THREAD; +--disconnect active_master +--disconnect inactive_master +--source include/wait_for_slave_sql_to_stop.inc +--disconnect slave